[PATCH] drm/tidss: Make use of the helper macro SET_RUNTIME_PM_OPS()

Sam Ravnborg sam at ravnborg.org
Mon Aug 30 14:36:00 UTC 2021


Hi Cai,

On Sat, Aug 28, 2021 at 04:52:52PM +0800, Cai Huoqing wrote:
> Use the helper macro SET_RUNTIME_PM_OPS() instead of the verbose
> operators ".runtime_suspend/.runtime_resume", because the
> SET_RUNTIME_PM_OPS() is a nice helper macro that could be brought
> in to make code a little clearer, a little more concise.
> 
> Signed-off-by: Cai Huoqing <caihuoqing at baidu.com>
> ---
>  drivers/gpu/drm/tidss/tidss_drv.c | 3 +--
>  1 file changed, 1 insertion(+), 2 deletions(-)
> 
> diff --git a/drivers/gpu/drm/tidss/tidss_drv.c b/drivers/gpu/drm/tidss/tidss_drv.c
> index d620f35688da..57605b80b526 100644
> --- a/drivers/gpu/drm/tidss/tidss_drv.c
> +++ b/drivers/gpu/drm/tidss/tidss_drv.c
> @@ -91,9 +91,8 @@ static int __maybe_unused tidss_resume(struct device *dev)
>  #ifdef CONFIG_PM
>  
>  static const struct dev_pm_ops tidss_pm_ops = {
> -	.runtime_suspend = tidss_pm_runtime_suspend,
> -	.runtime_resume = tidss_pm_runtime_resume,
>  	SET_SYSTEM_SLEEP_PM_OPS(tidss_suspend, tidss_resume)
> +	SET_RUNTIME_PM_OPS(tidss_pm_runtime_suspend, tidss_pm_runtime_resume, NULL)
>  };
>  
>  #endif /* CONFIG_PM */

This change would make sense if you:
- dropped the ifdef CONFIG_PM as they are now included in the macros.
- used pm_ptr() in the assignment in tidss_platform_driver

If this way you killed all CONFIG_PM uses in the driver.
I would do this in one patch - as it is all simple changes.

Note: For drivers with no CONFIG_PM use I would not introduce the
macros as in this cases they hurt readability.

	Sam



More information about the dri-devel mailing list