aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRob Clark <robdclark@gmail.com>2015-03-11 10:23:13 -0400
committerDaniel Vetter <daniel.vetter@ffwll.ch>2015-03-11 17:09:39 -0400
commit675c8328db6548f00a4e60770e66ab53752d6bf2 (patch)
tree3bd54b03008a971013ee1c8ac63e79c764c74fe0
parentd3c8ea3460fa9ca8a19eea8813071dee0b07c293 (diff)
drm/fb: small cleanup
Flip conditional to reduce indentation level of rest of fxn, and use min/max to make the code clearer. v2: surface_width -> surface_height typo Signed-off-by: Rob Clark <robdclark@gmail.com> Reviewed-by: Daniel Kurtz <djkurtz@chromium.org> Reviewed-by: Alex Deucher <alexander.deucher@amd.com> Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch>
-rw-r--r--drivers/gpu/drm/drm_fb_helper.c28
1 files changed, 15 insertions, 13 deletions
diff --git a/drivers/gpu/drm/drm_fb_helper.c b/drivers/gpu/drm/drm_fb_helper.c
index 1e6a0c760c5d..dca98a40a550 100644
--- a/drivers/gpu/drm/drm_fb_helper.c
+++ b/drivers/gpu/drm/drm_fb_helper.c
@@ -1035,22 +1035,24 @@ static int drm_fb_helper_single_fb_probe(struct drm_fb_helper *fb_helper,
1035 for (i = 0; i < fb_helper->crtc_count; i++) { 1035 for (i = 0; i < fb_helper->crtc_count; i++) {
1036 struct drm_display_mode *desired_mode; 1036 struct drm_display_mode *desired_mode;
1037 int x, y; 1037 int x, y;
1038
1038 desired_mode = fb_helper->crtc_info[i].desired_mode; 1039 desired_mode = fb_helper->crtc_info[i].desired_mode;
1040
1041 if (!desired_mode)
1042 continue;
1043
1044 crtc_count++;
1045
1039 x = fb_helper->crtc_info[i].x; 1046 x = fb_helper->crtc_info[i].x;
1040 y = fb_helper->crtc_info[i].y; 1047 y = fb_helper->crtc_info[i].y;
1041 if (desired_mode) { 1048
1042 if (gamma_size == 0) 1049 if (gamma_size == 0)
1043 gamma_size = fb_helper->crtc_info[i].mode_set.crtc->gamma_size; 1050 gamma_size = fb_helper->crtc_info[i].mode_set.crtc->gamma_size;
1044 if (desired_mode->hdisplay + x < sizes.fb_width) 1051
1045 sizes.fb_width = desired_mode->hdisplay + x; 1052 sizes.surface_width = max_t(u32, desired_mode->hdisplay + x, sizes.surface_width);
1046 if (desired_mode->vdisplay + y < sizes.fb_height) 1053 sizes.surface_height = max_t(u32, desired_mode->vdisplay + y, sizes.surface_height);
1047 sizes.fb_height = desired_mode->vdisplay + y; 1054 sizes.fb_width = min_t(u32, desired_mode->hdisplay + x, sizes.fb_width);
1048 if (desired_mode->hdisplay + x > sizes.surface_width) 1055 sizes.fb_height = min_t(u32, desired_mode->vdisplay + y, sizes.fb_height);
1049 sizes.surface_width = desired_mode->hdisplay + x;
1050 if (desired_mode->vdisplay + y > sizes.surface_height)
1051 sizes.surface_height = desired_mode->vdisplay + y;
1052 crtc_count++;
1053 }
1054 } 1056 }
1055 1057
1056 if (crtc_count == 0 || sizes.fb_width == -1 || sizes.fb_height == -1) { 1058 if (crtc_count == 0 || sizes.fb_width == -1 || sizes.fb_height == -1) {