staging/xgifb: rewrite XGIfb_get_cmap_len
authorPeter Huewe <peterhuewe@gmx.de>
Sun, 3 Feb 2013 21:54:35 +0000 (22:54 +0100)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Mon, 4 Feb 2013 18:46:27 +0000 (10:46 -0800)
We don't need to use this switch-case here for a simple two case
if-else.

Signed-off-by: Peter Huewe <peterhuewe@gmx.de>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
drivers/staging/xgifb/XGI_main_26.c

index 106abc8d9cbbb3d31e311952fc018ad93034e994..840b497732852461ab09992ea073489d92f6ab1a 100644 (file)
@@ -1131,22 +1131,10 @@ static int XGIfb_release(struct fb_info *info, int user)
        return 0;
 }
 
+/* similar to sisfb_get_cmap_len */
 static int XGIfb_get_cmap_len(const struct fb_var_screeninfo *var)
 {
-       int rc = 16;
-
-       switch (var->bits_per_pixel) {
-       case 8:
-               rc = 256;
-               break;
-       case 16:
-               rc = 16;
-               break;
-       case 32:
-               rc = 16;
-               break;
-       }
-       return rc;
+       return (var->bits_per_pixel == 8) ? 256 : 16;
 }
 
 static int XGIfb_setcolreg(unsigned regno, unsigned red, unsigned green,