Good idea

-----Original Message-----
From: Deucher, Alexander 
Sent: 2017年11月16日 12:14
To: Liu, Monk <monk....@amd.com>; amd-gfx@lists.freedesktop.org
Cc: Liu, Monk <monk....@amd.com>
Subject: RE: [PATCH 2/2] drm/amdgpu:cancel timer of virtual DCE

> -----Original Message-----
> From: amd-gfx [mailto:amd-gfx-boun...@lists.freedesktop.org] On Behalf 
> Of Monk Liu
> Sent: Wednesday, November 15, 2017 10:14 PM
> To: amd-gfx@lists.freedesktop.org
> Cc: Liu, Monk
> Subject: [PATCH 2/2] drm/amdgpu:cancel timer of virtual DCE
> 
> virtual DCE Timer structure is already released after its sw_fini(), 
> so we need to cancel the its Timer in hw_fini() otherwise the Timer 
> canceling is missed.
> 
> Change-Id: I03d6ca7aa07591d287da379ef4fe008f06edaff6
> Signed-off-by: Monk Liu <monk....@amd.com>
> ---
>  drivers/gpu/drm/amd/amdgpu/dce_virtual.c | 13 +++++++++++++
>  1 file changed, 13 insertions(+)
> 
> diff --git a/drivers/gpu/drm/amd/amdgpu/dce_virtual.c
> b/drivers/gpu/drm/amd/amdgpu/dce_virtual.c
> index 39460eb..7438491 100644
> --- a/drivers/gpu/drm/amd/amdgpu/dce_virtual.c
> +++ b/drivers/gpu/drm/amd/amdgpu/dce_virtual.c
> @@ -489,8 +489,21 @@ static int dce_virtual_hw_init(void *handle)
>       return 0;
>  }
> 
> +static void dce_virtual_set_crtc_vblank_interrupt_state(struct
> amdgpu_device *adev,
> +                                                     int crtc,
> +                                                     enum
> amdgpu_interrupt_state state);
> +

Please put the forward declaration at the top of the file.  

>  static int dce_virtual_hw_fini(void *handle)  {
> +     struct amdgpu_device *adev = (struct amdgpu_device *)handle;
> +     int i = 0;
> +
> +     while (i < AMDGPU_MAX_CRTCS) {
> +             if (adev->mode_info.crtcs[i])
> +                     dce_virtual_set_crtc_vblank_interrupt_state(adev, i,
> AMDGPU_IRQ_STATE_DISABLE);
> +             i++;
> +     }

I think a for loop is clearer here. Also, why not use adev->mode_info.num_crtc 
so we don’t loop longer than we have to?

Alex

> +
>       return 0;
>  }
> 
> --
> 2.7.4
> 
> _______________________________________________
> amd-gfx mailing list
> amd-gfx@lists.freedesktop.org
> https://lists.freedesktop.org/mailman/listinfo/amd-gfx
_______________________________________________
amd-gfx mailing list
amd-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/amd-gfx

Reply via email to