On 2017年05月31日 05:47, Alex Xie wrote:
  The original code convert pointer from amdgpu_crtc to
  drm_crtc then later convert the pointer back.
  It is difficult to understand why it was written
  that way.

Signed-off-by: Alex Xie <alexbin....@amd.com>
---
  drivers/gpu/drm/amd/amdgpu/amdgpu_kms.c | 3 +--
  1 file changed, 1 insertion(+), 2 deletions(-)

diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_kms.c 
b/drivers/gpu/drm/amd/amdgpu/amdgpu_kms.c
index 4dd83a3..7317fc9 100644
--- a/drivers/gpu/drm/amd/amdgpu/amdgpu_kms.c
+++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_kms.c
@@ -258,8 +258,7 @@ static int amdgpu_info_ioctl(struct drm_device *dev, void 
*data, struct drm_file
                for (i = 0, found = 0; i < adev->mode_info.num_crtc; i++) {
                        crtc = (struct drm_crtc *)minfo->crtcs[i];
                        if (crtc && crtc->base.id == info->mode_crtc.id) {
-                               struct amdgpu_crtc *amdgpu_crtc = 
to_amdgpu_crtc(crtc);
-                               ui32 = amdgpu_crtc->crtc_id;
+                               ui32 = minfo->crtcs[i]->crtc_id;
I feel previous code is more clear, it differentiates drm_crtc and amdgpu_crtc, which makes more clear for accessing their member. If totally not convert, then we will see the below code, when we read the code, we will need to check struct amdgpu_mode_info, struct amdgpu_crtc and struct drm_crtc for condition line. if (minfo->crtcs[i] && minfo->crtcs[i]->base.base.id == info->mode_crtc.id) {
    ui32 = minfo->crtcs[i]->crtc_id;


Regards,
David Zhou
                                found = 1;
                                break;
                        }

_______________________________________________
amd-gfx mailing list
amd-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/amd-gfx

Reply via email to