Skip to contentSkip to conversation

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

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

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

PATCH 1/1 drm/radeon: 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/.runtime_idle", 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/radeon/radeon_drv.c | 5 ++---
 1 file changed, 2 insertions(+), 3 deletions(-)
drivers/gpu/drm/radeon/radeon_drv.c +2 -3
index b74cebca1f89..c2eb725e87f6 100644
@@ -529,15 +529,14 @@ static long radeon_kms_compat_ioctl(struct file *filp, unsigned int cmd, unsigne
 #endif
 
 static const struct dev_pm_ops radeon_pm_ops = {
+	SET_RUNTIME_PM_OPS(radeon_pmops_runtime_suspend,
+			   radeon_pmops_runtime_resume, radeon_pmops_runtime_idle)
 	.suspend = radeon_pmops_suspend,
 	.resume = radeon_pmops_resume,
 	.freeze = radeon_pmops_freeze,
 	.thaw = radeon_pmops_thaw,
 	.poweroff = radeon_pmops_freeze,
 	.restore = radeon_pmops_resume,
-	.runtime_suspend = radeon_pmops_runtime_suspend,
-	.runtime_resume = radeon_pmops_runtime_resume,
-	.runtime_idle = radeon_pmops_runtime_idle,
 };
 
 static const struct file_operations radeon_driver_kms_fops = {
Signature · 1 line
2.25.1
#1 lore raw
Quoted 5 lines · Cai Huoqing

Use the helper macro SET_RUNTIME_PM_OPS() instead of the verbose operators ".runtime_suspend/.runtime_resume/.runtime_idle", 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.

I don't personally think it really helps readability. Just seems to be code churn.

Alex

Quoted 31 lines
---
 drivers/gpu/drm/radeon/radeon_drv.c | 5 ++---
 1 file changed, 2 insertions(+), 3 deletions(-)
drivers/gpu/drm/radeon/radeon_drv.c +2 -4
index b74cebca1f89..c2eb725e87f6 100644
@@ -529,15 +529,14 @@ static long radeon_kms_compat_ioctl(struct file *filp, unsigned int cmd, unsigne
 #endif
 
 static const struct dev_pm_ops radeon_pm_ops = {
+       SET_RUNTIME_PM_OPS(radeon_pmops_runtime_suspend,
+                          radeon_pmops_runtime_resume, radeon_pmops_runtime_idle)
        .suspend = radeon_pmops_suspend,
        .resume = radeon_pmops_resume,
        .freeze = radeon_pmops_freeze,
        .thaw = radeon_pmops_thaw,
        .poweroff = radeon_pmops_freeze,
        .restore = radeon_pmops_resume,
-       .runtime_suspend = radeon_pmops_runtime_suspend,
-       .runtime_resume = radeon_pmops_runtime_resume,
-       .runtime_idle = radeon_pmops_runtime_idle,
 };
 
 static const struct file_operations radeon_driver_kms_fops = {
--

2.25.1

#2 lore raw
Quoted 7 lines · Alex Deucher
Quoted 5 lines · Cai Huoqing

Use the helper macro SET_RUNTIME_PM_OPS() instead of the verbose operators ".runtime_suspend/.runtime_resume/.runtime_idle", 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.

Quoted 5 lines

I don't personally think it really helps readability. Just seems to be code churn.

Alex

agree, just code churn, the macro seems to do it.

Cai

Quoted 32 lines
Quoted 32 lines
---
 drivers/gpu/drm/radeon/radeon_drv.c | 5 ++---
 1 file changed, 2 insertions(+), 3 deletions(-)
drivers/gpu/drm/radeon/radeon_drv.c +2 -4
index b74cebca1f89..c2eb725e87f6 100644
@@ -529,15 +529,14 @@ static long radeon_kms_compat_ioctl(struct file *filp, unsigned int cmd, unsigne
 #endif
 
 static const struct dev_pm_ops radeon_pm_ops = {
+       SET_RUNTIME_PM_OPS(radeon_pmops_runtime_suspend,
+                          radeon_pmops_runtime_resume, radeon_pmops_runtime_idle)
        .suspend = radeon_pmops_suspend,
        .resume = radeon_pmops_resume,
        .freeze = radeon_pmops_freeze,
        .thaw = radeon_pmops_thaw,
        .poweroff = radeon_pmops_freeze,
        .restore = radeon_pmops_resume,
-       .runtime_suspend = radeon_pmops_runtime_suspend,
-       .runtime_resume = radeon_pmops_runtime_resume,
-       .runtime_idle = radeon_pmops_runtime_idle,
 };
 
 static const struct file_operations radeon_driver_kms_fops = {
--

2.25.1

maintainer
#3 lore raw
In reply to Cai Huoqing

Am 28.08.21 um 10:50 schrieb Cai Huoqing:

Quoted 4 lines

Use the helper macro SET_RUNTIME_PM_OPS() instead of the verbose operators ".runtime_suspend/.runtime_resume/.runtime_idle", 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.

To be honest I don't think that this is cleaner at all.

Christian.

Quoted 28 lines
---
  drivers/gpu/drm/radeon/radeon_drv.c | 5 ++---
  1 file changed, 2 insertions(+), 3 deletions(-)
drivers/gpu/drm/radeon/radeon_drv.c +2 -3
index b74cebca1f89..c2eb725e87f6 100644
@@ -529,15 +529,14 @@ static long radeon_kms_compat_ioctl(struct file *filp, unsigned int cmd, unsigne
  #endif
 
  static const struct dev_pm_ops radeon_pm_ops = {
+	SET_RUNTIME_PM_OPS(radeon_pmops_runtime_suspend,
+			   radeon_pmops_runtime_resume, radeon_pmops_runtime_idle)
  	.suspend = radeon_pmops_suspend,
  	.resume = radeon_pmops_resume,
  	.freeze = radeon_pmops_freeze,
  	.thaw = radeon_pmops_thaw,
  	.poweroff = radeon_pmops_freeze,
  	.restore = radeon_pmops_resume,
-	.runtime_suspend = radeon_pmops_runtime_suspend,
-	.runtime_resume = radeon_pmops_runtime_resume,
-	.runtime_idle = radeon_pmops_runtime_idle,
  };
 
  static const struct file_operations radeon_driver_kms_fops = {