
From: "Antonino A. Daplas" <adaplas@hotpop.com>

Set color depth to 8 if in pseudocolor in vesafb.  The CLUT size,
previously saved as {red|green|blue}.length, is now private to vesafb.

Signed-off-by: Antonino Daplas <adaplas@pol.net>
Signed-off-by: Andrew Morton <akpm@osdl.org>
---

 25-akpm/drivers/video/vesafb.c |   16 +++++++++++++---
 1 files changed, 13 insertions(+), 3 deletions(-)

diff -puN drivers/video/vesafb.c~fbdev-set-color-depth-to-8-if-in-pseudocolor-in-vesafb drivers/video/vesafb.c
--- 25/drivers/video/vesafb.c~fbdev-set-color-depth-to-8-if-in-pseudocolor-in-vesafb	2004-11-07 16:32:28.375526000 -0800
+++ 25-akpm/drivers/video/vesafb.c	2004-11-07 16:32:28.379525392 -0800
@@ -56,6 +56,7 @@ static int             ypan       = 0;  
 static unsigned short  *pmi_base  = NULL;
 static void            (*pmi_start)(void);
 static void            (*pmi_pal)(void);
+static int             depth;
 
 /* --------------------------------------------------------------------- */
 
@@ -89,11 +90,11 @@ static int vesafb_pan_display(struct fb_
 }
 
 static void vesa_setpalette(int regno, unsigned red, unsigned green,
-			    unsigned blue, struct fb_var_screeninfo *var)
+			    unsigned blue)
 {
 #ifdef __i386__
 	struct { u_char blue, green, red, pad; } entry;
-	int shift = 16 - var->green.length;
+	int shift = 16 - depth;
 
 	if (pmi_setpal) {
 		entry.red   = red   >> shift;
@@ -135,7 +136,7 @@ static int vesafb_setcolreg(unsigned reg
 
 	switch (info->var.bits_per_pixel) {
 	case 8:
-		vesa_setpalette(regno,red,green,blue, &info->var);
+		vesa_setpalette(regno,red,green,blue);
 		break;
 	case 16:
 		if (info->var.red.offset == 10) {
@@ -358,6 +359,15 @@ static int __init vesafb_probe(struct de
 	vesafb_defined.blue.length   = screen_info.blue_size;
 	vesafb_defined.transp.offset = screen_info.rsvd_pos;
 	vesafb_defined.transp.length = screen_info.rsvd_size;
+
+	if (vesafb_defined.bits_per_pixel <= 8) {
+		depth = vesafb_defined.green.length;
+		vesafb_defined.red.length =
+		vesafb_defined.green.length =
+		vesafb_defined.blue.length =
+		vesafb_defined.bits_per_pixel;
+	}
+
 	printk(KERN_INFO "vesafb: %s: "
 	       "size=%d:%d:%d:%d, shift=%d:%d:%d:%d\n",
 	       (vesafb_defined.bits_per_pixel > 8) ?
_
