/* Set a single color register. The values supplied are already rounded down to the hardware's capabilities (according to the entries in the var structure). Return != 0 for invalid regno.  */
static int vfb_setcolreg(u_int regno, u_int red, u_int green, u_int blue, u_int transp, struct fb_info *info)
/* Set a single color register. The values supplied are already rounded down to the hardware's capabilities (according to the entries in the var structure). Return != 0 for invalid regno.  */
static int vfb_setcolreg(u_int regno, u_int red, u_int green, u_int blue, u_int transp, struct fb_info *info)
{
	unsigned int val;
	int ret = 1;
	if (info->var.grayscale) 
		red = green = blue = (19595 * red + 38470 * green +
					7471 * blue) >> 16;
	switch (info->fix.visual) 
	{
	case FB_VISUAL_TRUECOLOR:
		if (regno < 16) {
			u32 *pal = info->pseudo_palette;
			val  = chan_to_field(red,   &info->var.red);
			val |= chan_to_field(green, &info->var.green);
			val |= chan_to_field(blue,  &info->var.blue);
			pal[regno] = val;
			ret = 0;
		}
		break;
	case FB_VISUAL_STATIC_PSEUDOCOLOR:
	case FB_VISUAL_PSEUDOCOLOR:
		break;
	}
	return ret;
}