Skip to contentSkip to conversation

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

PATCH In review Cai Huoqing 2 participants 2 messages Aug 28, 2021 – Aug 30, 2021

Subsystems (3)
lore
Share & tools
lore
#0 lore raw

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

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.

---
 drivers/gpu/drm/tidss/tidss_drv.c | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)
drivers/gpu/drm/tidss/tidss_drv.c +1 -2
index d620f35688da..57605b80b526 100644
@@ -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 */
Signature · 1 line
2.25.1
#1 lore raw

Hi Cai,

Quoted 15 lines · 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.

---
 drivers/gpu/drm/tidss/tidss_drv.c | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)
drivers/gpu/drm/tidss/tidss_drv.c +0 -0
index d620f35688da..57605b80b526 100644

drivers/gpu/drm/tidss/tidss_drv.c static int __maybe_unused tidss_resume(struct device *dev) · line 98

Quoted 10 lines
drivers/gpu/drm/tidss/tidss_drv.c +1 -2
@@ -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