[PATCH] drm/hisilicon: Add the CONFIG_PM_SLEEP

Sam Ravnborg sam at ravnborg.org
Thu Dec 17 17:29:45 UTC 2020


Hi Tian,
On Wed, Dec 16, 2020 at 05:15:14PM +0800, Tian Tao wrote:
> add the CONFIG_PM_SLEEP to isolate the function of resume and suspend.
> 
> Signed-off-by: Tian Tao <tiantao6 at hisilicon.com>
> ---
>  drivers/gpu/drm/hisilicon/hibmc/hibmc_drm_drv.c | 2 ++
>  1 file changed, 2 insertions(+)
> 
> diff --git a/drivers/gpu/drm/hisilicon/hibmc/hibmc_drm_drv.c b/drivers/gpu/drm/hisilicon/hibmc/hibmc_drm_drv.c
> index 7e91ef1..faa664d 100644
> --- a/drivers/gpu/drm/hisilicon/hibmc/hibmc_drm_drv.c
> +++ b/drivers/gpu/drm/hisilicon/hibmc/hibmc_drm_drv.c
> @@ -65,6 +65,7 @@ static const struct drm_driver hibmc_driver = {
>  	.irq_handler		= hibmc_drm_interrupt,
>  };
>  
> +#ifdef CONFIG_PM_SLEEP
>  static int __maybe_unused hibmc_pm_suspend(struct device *dev)
>  {
>  	struct drm_device *drm_dev = dev_get_drvdata(dev);
> @@ -78,6 +79,7 @@ static int  __maybe_unused hibmc_pm_resume(struct device *dev)
>  
>  	return drm_mode_config_helper_resume(drm_dev);
>  }
> +#endif

The __maybe_unused in combination of the use of
SET_SYSTEM_SLEEP_PM_OPS() should cover all situations and the ifdef
should not be required.

So unless you are trying to fix a warning or so then there is no reason
to do this change. The linker will drop the function in the end and the
__maybe_unused will prevent a compile-time warning.

	Sam


More information about the dri-devel mailing list