dri-devel.lists.freedesktop.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] drm/tidss: Make use of the helper macro SET_RUNTIME_PM_OPS()
@ 2021-08-28  8:52 Cai Huoqing
  2021-08-30 14:36 ` Sam Ravnborg
  0 siblings, 1 reply; 2+ messages in thread
From: Cai Huoqing @ 2021-08-28  8:52 UTC (permalink / raw)
  To: jyri.sarha, tomba, airlied, daniel; +Cc: dri-devel, Cai Huoqing

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@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 */
-- 
2.25.1


^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [PATCH] drm/tidss: Make use of the helper macro SET_RUNTIME_PM_OPS()
  2021-08-28  8:52 [PATCH] drm/tidss: Make use of the helper macro SET_RUNTIME_PM_OPS() Cai Huoqing
@ 2021-08-30 14:36 ` Sam Ravnborg
  0 siblings, 0 replies; 2+ messages in thread
From: Sam Ravnborg @ 2021-08-30 14:36 UTC (permalink / raw)
  To: Cai Huoqing; +Cc: jyri.sarha, tomba, airlied, daniel, dri-devel

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@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


^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2021-08-30 14:36 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-08-28  8:52 [PATCH] drm/tidss: Make use of the helper macro SET_RUNTIME_PM_OPS() Cai Huoqing
2021-08-30 14:36 ` Sam Ravnborg

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).