diff mbox

[02/10] drm/fb-helper: Remove dead code in setcolreg

Message ID 1459331485-28376-3-git-send-email-daniel.vetter@ffwll.ch (mailing list archive)
State New, archived
Headers show

Commit Message

Daniel Vetter March 30, 2016, 9:51 a.m. UTC
DRM fbdev emulation only supports pallete_color with depth == 8, and
truecolor with depth > 8. Handling depth == 16 for palettes is hence
dead code, let's remove it.

Signed-off-by: Daniel Vetter <daniel.vetter@intel.com>
---
 drivers/gpu/drm/drm_fb_helper.c | 33 ++-------------------------------
 1 file changed, 2 insertions(+), 31 deletions(-)

Comments

Maarten Lankhorst May 31, 2016, 1:09 p.m. UTC | #1
Op 30-03-16 om 11:51 schreef Daniel Vetter:
> DRM fbdev emulation only supports pallete_color with depth == 8, and
> truecolor with depth > 8. Handling depth == 16 for palettes is hence
> dead code, let's remove it.
Hooray, less chance for failure!

Reviewed-by: Maarten Lankhorst <maarten.lankhorst@linux.intel.com>
Daniel Vetter May 31, 2016, 1:25 p.m. UTC | #2
On Tue, May 31, 2016 at 03:09:42PM +0200, Maarten Lankhorst wrote:
> Op 30-03-16 om 11:51 schreef Daniel Vetter:
> > DRM fbdev emulation only supports pallete_color with depth == 8, and
> > truecolor with depth > 8. Handling depth == 16 for palettes is hence
> > dead code, let's remove it.
> Hooray, less chance for failure!
> 
> Reviewed-by: Maarten Lankhorst <maarten.lankhorst@linux.intel.com>

Applied to drm-misc, thanks for the review.
-Daniel
diff mbox

Patch

diff --git a/drivers/gpu/drm/drm_fb_helper.c b/drivers/gpu/drm/drm_fb_helper.c
index 855108e6e1bd..39f9b8a41843 100644
--- a/drivers/gpu/drm/drm_fb_helper.c
+++ b/drivers/gpu/drm/drm_fb_helper.c
@@ -969,7 +969,6 @@  static int setcolreg(struct drm_crtc *crtc, u16 red, u16 green,
 {
 	struct drm_fb_helper *fb_helper = info->par;
 	struct drm_framebuffer *fb = fb_helper->fb;
-	int pindex;
 
 	if (info->fix.visual == FB_VISUAL_TRUECOLOR) {
 		u32 *palette;
@@ -1001,38 +1000,10 @@  static int setcolreg(struct drm_crtc *crtc, u16 red, u16 green,
 		    !fb_helper->funcs->gamma_get))
 		return -EINVAL;
 
-	pindex = regno;
+	WARN_ON(fb->bits_per_pixel != 8);
 
-	if (fb->bits_per_pixel == 16) {
-		pindex = regno << 3;
+	fb_helper->funcs->gamma_set(crtc, red, green, blue, regno);
 
-		if (fb->depth == 16 && regno > 63)
-			return -EINVAL;
-		if (fb->depth == 15 && regno > 31)
-			return -EINVAL;
-
-		if (fb->depth == 16) {
-			u16 r, g, b;
-			int i;
-			if (regno < 32) {
-				for (i = 0; i < 8; i++)
-					fb_helper->funcs->gamma_set(crtc, red,
-						green, blue, pindex + i);
-			}
-
-			fb_helper->funcs->gamma_get(crtc, &r,
-						    &g, &b,
-						    pindex >> 1);
-
-			for (i = 0; i < 4; i++)
-				fb_helper->funcs->gamma_set(crtc, r,
-							    green, b,
-							    (pindex >> 1) + i);
-		}
-	}
-
-	if (fb->depth != 16)
-		fb_helper->funcs->gamma_set(crtc, red, green, blue, pindex);
 	return 0;
 }