]> xenbits.xensource.com Git - people/aperard/linux-chromebook.git/commitdiff
drm/exynos: move checks outside of exynos_drm_crtc_update
authorMandeep Singh Baines <msb@chromium.org>
Wed, 31 Oct 2012 21:13:41 +0000 (14:13 -0700)
committerGerrit <chrome-bot@google.com>
Tue, 13 Nov 2012 20:26:45 +0000 (12:26 -0800)
Refactor the code so that exynos_drm_crtc_update cannot fail.

BUG=chrome-os-partner:15349,chrome-os-partner:14965
TEST=Multiple VT switch, HDMI plug/unplug, sign in/out, suspend/resume,
     idle suspend/resume.

Change-Id: I77335d6142f2363ca19b113ddcd5909c3a067121
Signed-off-by: Mandeep Singh Baines <msb@chromium.org>
Reviewed-on: https://gerrit.chromium.org/gerrit/37570
Reviewed-by: Sean Paul <seanpaul@chromium.org>
Reviewed-by: Stéphane Marchesin <marcheu@chromium.org>
drivers/gpu/drm/exynos/exynos_drm_crtc.c

index ab77dfa146a3dbb550262a804b0ced63d86347bf..e8271b4893193575da79d36451527933a1dc4902 100644 (file)
@@ -124,16 +124,13 @@ static void exynos_drm_crtc_page_flip_apply(struct drm_crtc *crtc,
                        exynos_drm_encoder_crtc_commit);
 }
 
-static int exynos_drm_crtc_update(struct drm_crtc *crtc)
+static void exynos_drm_crtc_update(struct drm_crtc *crtc,
+                                  struct drm_framebuffer *fb)
 {
        struct exynos_drm_crtc *exynos_crtc;
        struct exynos_drm_overlay *overlay;
        struct exynos_drm_crtc_pos pos;
        struct drm_display_mode *mode = &crtc->mode;
-       struct drm_framebuffer *fb = crtc->fb;
-
-       if (!mode || !fb)
-               return -EINVAL;
 
        exynos_crtc = to_exynos_crtc(crtc);
        overlay = &exynos_crtc->overlay;
@@ -152,9 +149,7 @@ static int exynos_drm_crtc_update(struct drm_crtc *crtc)
        pos.crtc_w = fb->width - crtc->x;
        pos.crtc_h = fb->height - crtc->y;
 
-       exynos_drm_overlay_update(overlay, crtc->fb, mode, &pos);
-
-       return 0;
+       exynos_drm_overlay_update(overlay, fb, mode, &pos);
 }
 
 static void exynos_drm_crtc_dpms(struct drm_crtc *crtc, int mode)
@@ -263,31 +258,38 @@ exynos_drm_crtc_mode_set(struct drm_crtc *crtc, struct drm_display_mode *mode,
                          struct drm_display_mode *adjusted_mode, int x, int y,
                          struct drm_framebuffer *old_fb)
 {
+       struct drm_framebuffer *fb = crtc->fb;
+
        DRM_DEBUG_KMS("%s\n", __FILE__);
 
+       if (!fb)
+               return -EINVAL;
+
        /*
         * copy the mode data adjusted by mode_fixup() into crtc->mode
         * so that hardware can be seet to proper mode.
         */
        memcpy(&crtc->mode, adjusted_mode, sizeof(*adjusted_mode));
 
-       return exynos_drm_crtc_update(crtc);
+       exynos_drm_crtc_update(crtc, fb);
+
+       return 0;
 }
 
 static int exynos_drm_crtc_mode_set_base(struct drm_crtc *crtc, int x, int y,
                                          struct drm_framebuffer *old_fb)
 {
-       int ret;
+       struct drm_framebuffer *fb = crtc->fb;
 
        DRM_DEBUG_KMS("%s\n", __FILE__);
 
-       ret = exynos_drm_crtc_update(crtc);
-       if (ret)
-               return ret;
+       if (!fb)
+               return -EINVAL;
 
+       exynos_drm_crtc_update(crtc, fb);
        exynos_drm_crtc_apply(crtc);
 
-       return ret;
+       return 0;
 }
 
 static void exynos_drm_crtc_load_lut(struct drm_crtc *crtc)