All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] drm/amdgpu: Make use of the helper macro SET_RUNTIME_PM_OPS()
@ 2021-08-28  8:41 Cai Huoqing
  2021-08-30  2:40 ` Quan, Evan
  2021-08-30 13:22 ` Alex Deucher
  0 siblings, 2 replies; 3+ messages in thread
From: Cai Huoqing @ 2021-08-28  8:41 UTC (permalink / raw)
  To: alexander.deucher, christian.koenig, Xinhui.Pan, airlied, daniel
  Cc: amd-gfx, dri-devel, 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.

Signed-off-by: Cai Huoqing <caihuoqing@baidu.com>
---
 drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c | 5 ++---
 1 file changed, 2 insertions(+), 3 deletions(-)

diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c
index b6640291f980..9e5fb8d2e0e0 100644
--- a/drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c
+++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c
@@ -1699,6 +1699,8 @@ long amdgpu_drm_ioctl(struct file *filp,
 }
 
 static const struct dev_pm_ops amdgpu_pm_ops = {
+	SET_RUNTIME_PM_OPS(amdgpu_pmops_runtime_suspend,
+			   amdgpu_pmops_runtime_resume, amdgpu_pmops_runtime_idle)
 	.prepare = amdgpu_pmops_prepare,
 	.complete = amdgpu_pmops_complete,
 	.suspend = amdgpu_pmops_suspend,
@@ -1707,9 +1709,6 @@ static const struct dev_pm_ops amdgpu_pm_ops = {
 	.thaw = amdgpu_pmops_thaw,
 	.poweroff = amdgpu_pmops_poweroff,
 	.restore = amdgpu_pmops_restore,
-	.runtime_suspend = amdgpu_pmops_runtime_suspend,
-	.runtime_resume = amdgpu_pmops_runtime_resume,
-	.runtime_idle = amdgpu_pmops_runtime_idle,
 };
 
 static int amdgpu_flush(struct file *f, fl_owner_t id)
-- 
2.25.1


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

* RE: [PATCH] drm/amdgpu: Make use of the helper macro SET_RUNTIME_PM_OPS()
  2021-08-28  8:41 [PATCH] drm/amdgpu: Make use of the helper macro SET_RUNTIME_PM_OPS() Cai Huoqing
@ 2021-08-30  2:40 ` Quan, Evan
  2021-08-30 13:22 ` Alex Deucher
  1 sibling, 0 replies; 3+ messages in thread
From: Quan, Evan @ 2021-08-30  2:40 UTC (permalink / raw)
  To: Cai Huoqing, Deucher, Alexander, Koenig, Christian, Pan, Xinhui,
	airlied, daniel
  Cc: amd-gfx, dri-devel

[AMD Official Use Only]

Reviewed-by: Evan Quan <evan.quan@amd.com>

> -----Original Message-----
> From: amd-gfx <amd-gfx-bounces@lists.freedesktop.org> On Behalf Of Cai
> Huoqing
> Sent: Saturday, August 28, 2021 4:41 PM
> To: Deucher, Alexander <Alexander.Deucher@amd.com>; Koenig, Christian
> <Christian.Koenig@amd.com>; Pan, Xinhui <Xinhui.Pan@amd.com>;
> airlied@linux.ie; daniel@ffwll.ch
> Cc: amd-gfx@lists.freedesktop.org; dri-devel@lists.freedesktop.org; Cai
> Huoqing <caihuoqing@baidu.com>
> Subject: [PATCH] drm/amdgpu: 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.
> 
> Signed-off-by: Cai Huoqing <caihuoqing@baidu.com>
> ---
>  drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c | 5 ++---
>  1 file changed, 2 insertions(+), 3 deletions(-)
> 
> diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c
> b/drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c
> index b6640291f980..9e5fb8d2e0e0 100644
> --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c
> +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c
> @@ -1699,6 +1699,8 @@ long amdgpu_drm_ioctl(struct file *filp,
>  }
> 
>  static const struct dev_pm_ops amdgpu_pm_ops = {
> +	SET_RUNTIME_PM_OPS(amdgpu_pmops_runtime_suspend,
> +			   amdgpu_pmops_runtime_resume,
> amdgpu_pmops_runtime_idle)
>  	.prepare = amdgpu_pmops_prepare,
>  	.complete = amdgpu_pmops_complete,
>  	.suspend = amdgpu_pmops_suspend,
> @@ -1707,9 +1709,6 @@ static const struct dev_pm_ops amdgpu_pm_ops =
> {
>  	.thaw = amdgpu_pmops_thaw,
>  	.poweroff = amdgpu_pmops_poweroff,
>  	.restore = amdgpu_pmops_restore,
> -	.runtime_suspend = amdgpu_pmops_runtime_suspend,
> -	.runtime_resume = amdgpu_pmops_runtime_resume,
> -	.runtime_idle = amdgpu_pmops_runtime_idle,
>  };
> 
>  static int amdgpu_flush(struct file *f, fl_owner_t id)
> --
> 2.25.1

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

* Re: [PATCH] drm/amdgpu: Make use of the helper macro SET_RUNTIME_PM_OPS()
  2021-08-28  8:41 [PATCH] drm/amdgpu: Make use of the helper macro SET_RUNTIME_PM_OPS() Cai Huoqing
  2021-08-30  2:40 ` Quan, Evan
@ 2021-08-30 13:22 ` Alex Deucher
  1 sibling, 0 replies; 3+ messages in thread
From: Alex Deucher @ 2021-08-30 13:22 UTC (permalink / raw)
  To: Cai Huoqing
  Cc: Deucher, Alexander, Christian Koenig, xinhui pan, Dave Airlie,
	Daniel Vetter, amd-gfx list, Maling list - DRI developers

On Sat, Aug 28, 2021 at 4:41 AM Cai Huoqing <caihuoqing@baidu.com> wrote:
>
> 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 think this makes readability worse and just causes code churn.

Alex


> Signed-off-by: Cai Huoqing <caihuoqing@baidu.com>
> ---
>  drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c | 5 ++---
>  1 file changed, 2 insertions(+), 3 deletions(-)
>
> diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c
> index b6640291f980..9e5fb8d2e0e0 100644
> --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c
> +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c
> @@ -1699,6 +1699,8 @@ long amdgpu_drm_ioctl(struct file *filp,
>  }
>
>  static const struct dev_pm_ops amdgpu_pm_ops = {
> +       SET_RUNTIME_PM_OPS(amdgpu_pmops_runtime_suspend,
> +                          amdgpu_pmops_runtime_resume, amdgpu_pmops_runtime_idle)
>         .prepare = amdgpu_pmops_prepare,
>         .complete = amdgpu_pmops_complete,
>         .suspend = amdgpu_pmops_suspend,
> @@ -1707,9 +1709,6 @@ static const struct dev_pm_ops amdgpu_pm_ops = {
>         .thaw = amdgpu_pmops_thaw,
>         .poweroff = amdgpu_pmops_poweroff,
>         .restore = amdgpu_pmops_restore,
> -       .runtime_suspend = amdgpu_pmops_runtime_suspend,
> -       .runtime_resume = amdgpu_pmops_runtime_resume,
> -       .runtime_idle = amdgpu_pmops_runtime_idle,
>  };
>
>  static int amdgpu_flush(struct file *f, fl_owner_t id)
> --
> 2.25.1
>

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

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

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-08-28  8:41 [PATCH] drm/amdgpu: Make use of the helper macro SET_RUNTIME_PM_OPS() Cai Huoqing
2021-08-30  2:40 ` Quan, Evan
2021-08-30 13:22 ` Alex Deucher

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.