Re: [PATCH v6] drm/msm/dpu: ensure device suspend happens during PM sleep

From: Doug Anderson
Date: Thu Jun 04 2020 - 16:34:23 EST


Hi,

On Thu, Jun 4, 2020 at 6:20 AM Kalyan Thota <kalyan_t@xxxxxxxxxxxxxx> wrote:
>
> -#ifdef CONFIG_PM
> -static int msm_runtime_suspend(struct device *dev)
> +#ifdef CONFIG_PM_SLEEP
> +static int msm_pm_suspend(struct device *dev)
> {
> - struct drm_device *ddev = dev_get_drvdata(dev);
> - struct msm_drm_private *priv = ddev->dev_private;
> - struct msm_mdss *mdss = priv->mdss;
>

nit: remove blank line at the start of this function

> static const struct dev_pm_ops msm_pm_ops = {
> SET_SYSTEM_SLEEP_PM_OPS(msm_pm_suspend, msm_pm_resume)
> SET_RUNTIME_PM_OPS(msm_runtime_suspend, msm_runtime_resume, NULL)
> + .prepare = msm_pm_prepare,
> + .complete = msm_pm_complete,

Presumably you will get a compile failure if someone compiles without
CONFIG_PM_SLEEP since msm_pm_prepare() and msm_pm_complete() won't be
defined but you refer to them unconditionally. Probably the best
solution is to just add "__maybe_unused" to your prepare/complete
function and then always define them.


I can't say I've thought through every corner case but at least this
change no longer raises alarm bells in my mind when I look at it. ;-)
If it works for you and nobody else has objections then it seems good
enough and we can always make more improvements later. Feel free to
add my Reviewed-by tag when my nit is fixed and you make sure it
compiles even if CONFIG_PM_SLEEP isn't defined.

-Doug