OSDN Git Service

drm/radeon: Add local 'fb' variables
authorVille Syrjälä <ville.syrjala@linux.intel.com>
Fri, 18 Nov 2016 19:52:38 +0000 (21:52 +0200)
committerVille Syrjälä <ville.syrjala@linux.intel.com>
Wed, 14 Dec 2016 20:36:05 +0000 (22:36 +0200)
Add a local 'fb' variable to a few places to get rid of the
'crtc->primary->fb' stuff. Looks neater and helps me with my poor
coccinelle skills later.

Cc: Alex Deucher <alexander.deucher@amd.com>
Cc: "Christian König" <christian.koenig@amd.com>
Signed-off-by: Ville Syrjälä <ville.syrjala@linux.intel.com>
Reviewed-by: Alex Deucher <alexander.deucher@amd.com>
Reviewed-by: Christian König <christian.koenig@amd.com>
Link: http://patchwork.freedesktop.org/patch/msgid/1479498793-31021-3-git-send-email-ville.syrjala@linux.intel.com
drivers/gpu/drm/radeon/r100.c
drivers/gpu/drm/radeon/radeon_legacy_crtc.c

index f5e84f4..984b35f 100644 (file)
@@ -3225,13 +3225,19 @@ void r100_bandwidth_update(struct radeon_device *rdev)
        radeon_update_display_priority(rdev);
 
        if (rdev->mode_info.crtcs[0]->base.enabled) {
+               const struct drm_framebuffer *fb =
+                       rdev->mode_info.crtcs[0]->base.primary->fb;
+
                mode1 = &rdev->mode_info.crtcs[0]->base.mode;
-               pixel_bytes1 = rdev->mode_info.crtcs[0]->base.primary->fb->bits_per_pixel / 8;
+               pixel_bytes1 = fb->bits_per_pixel / 8;
        }
        if (!(rdev->flags & RADEON_SINGLE_CRTC)) {
                if (rdev->mode_info.crtcs[1]->base.enabled) {
+                       const struct drm_framebuffer *fb =
+                               rdev->mode_info.crtcs[1]->base.primary->fb;
+
                        mode2 = &rdev->mode_info.crtcs[1]->base.mode;
-                       pixel_bytes2 = rdev->mode_info.crtcs[1]->base.primary->fb->bits_per_pixel / 8;
+                       pixel_bytes2 = fb->bits_per_pixel / 8;
                }
        }
 
index d0de402..bb53468 100644 (file)
@@ -579,6 +579,7 @@ static bool radeon_set_crtc_timing(struct drm_crtc *crtc, struct drm_display_mod
        struct drm_device *dev = crtc->dev;
        struct radeon_device *rdev = dev->dev_private;
        struct radeon_crtc *radeon_crtc = to_radeon_crtc(crtc);
+       const struct drm_framebuffer *fb = crtc->primary->fb;
        struct drm_encoder *encoder;
        int format;
        int hsync_start;
@@ -602,7 +603,7 @@ static bool radeon_set_crtc_timing(struct drm_crtc *crtc, struct drm_display_mod
                }
        }
 
-       switch (crtc->primary->fb->bits_per_pixel) {
+       switch (fb->bits_per_pixel) {
        case 8:
                format = 2;
                break;