From: Aaro Koskinen Date: Tue, 11 Oct 2011 18:47:26 +0000 (+0300) Subject: staging: xgifb: eliminate default_var X-Git-Url: https://git.karo-electronics.de/?a=commitdiff_plain;h=e9865d47d44600b86e00a274adc8bf28e10677da;p=mv-sheeva.git staging: xgifb: eliminate default_var Eliminate default_var and initialize needed fields of fb_info->var in probe(). Signed-off-by: Aaro Koskinen Reviewed-by: Dan Carpenter Signed-off-by: Greg Kroah-Hartman --- diff --git a/drivers/staging/xgifb/XGI_main.h b/drivers/staging/xgifb/XGI_main.h index 7e5d029512d..0d439e90961 100644 --- a/drivers/staging/xgifb/XGI_main.h +++ b/drivers/staging/xgifb/XGI_main.h @@ -125,35 +125,6 @@ MODULE_DEVICE_TABLE(pci, xgifb_pci_table); /* ------------------- Global Variables ----------------------------- */ -static struct fb_var_screeninfo default_var = { - .xres = 0, - .yres = 0, - .xres_virtual = 0, - .yres_virtual = 0, - .xoffset = 0, - .yoffset = 0, - .bits_per_pixel = 0, - .grayscale = 0, - .red = {0, 8, 0}, - .green = {0, 8, 0}, - .blue = {0, 8, 0}, - .transp = {0, 0, 0}, - .nonstd = 0, - .activate = FB_ACTIVATE_NOW, - .height = -1, - .width = -1, - .accel_flags = 0, - .pixclock = 0, - .left_margin = 0, - .right_margin = 0, - .upper_margin = 0, - .lower_margin = 0, - .hsync_len = 0, - .vsync_len = 0, - .sync = 0, - .vmode = FB_VMODE_NONINTERLACED, -}; - static struct fb_fix_screeninfo XGIfb_fix = { .id = "XGI", .type = FB_TYPE_PACKED_PIXELS, diff --git a/drivers/staging/xgifb/XGI_main_26.c b/drivers/staging/xgifb/XGI_main_26.c index 8c9c187e7e3..5eed802225a 100644 --- a/drivers/staging/xgifb/XGI_main_26.c +++ b/drivers/staging/xgifb/XGI_main_26.c @@ -2345,17 +2345,22 @@ static int __devinit xgifb_probe(struct pci_dev *pdev, xgifb_info->video_bpp, xgifb_info->refresh_rate); - default_var.xres = - default_var.xres_virtual = - xgifb_info->video_width; - default_var.yres = - default_var.yres_virtual = - xgifb_info->video_height; - default_var.bits_per_pixel = xgifb_info->video_bpp; - - XGIfb_bpp_to_var(xgifb_info, &default_var); - - default_var.pixclock = (u32) (1000000000 / + fb_info->var.red.length = 8; + fb_info->var.green.length = 8; + fb_info->var.blue.length = 8; + fb_info->var.activate = FB_ACTIVATE_NOW; + fb_info->var.height = -1; + fb_info->var.width = -1; + fb_info->var.vmode = FB_VMODE_NONINTERLACED; + fb_info->var.xres = xgifb_info->video_width; + fb_info->var.xres_virtual = xgifb_info->video_width; + fb_info->var.yres = xgifb_info->video_height; + fb_info->var.yres_virtual = xgifb_info->video_height; + fb_info->var.bits_per_pixel = xgifb_info->video_bpp; + + XGIfb_bpp_to_var(xgifb_info, &fb_info->var); + + fb_info->var.pixclock = (u32) (1000000000 / XGIfb_mode_rate_to_dclock(&XGI_Pr, hw_info, XGIbios_mode[xgifb_info->mode_idx].mode_no, xgifb_info->rate_idx)); @@ -2363,26 +2368,29 @@ static int __devinit xgifb_probe(struct pci_dev *pdev, if (XGIfb_mode_rate_to_ddata(&XGI_Pr, hw_info, XGIbios_mode[xgifb_info->mode_idx].mode_no, xgifb_info->rate_idx, - &default_var.left_margin, &default_var.right_margin, - &default_var.upper_margin, &default_var.lower_margin, - &default_var.hsync_len, &default_var.vsync_len, - &default_var.sync, &default_var.vmode)) { - - if ((default_var.vmode & FB_VMODE_MASK) == + &fb_info->var.left_margin, + &fb_info->var.right_margin, + &fb_info->var.upper_margin, + &fb_info->var.lower_margin, + &fb_info->var.hsync_len, + &fb_info->var.vsync_len, + &fb_info->var.sync, + &fb_info->var.vmode)) { + + if ((fb_info->var.vmode & FB_VMODE_MASK) == FB_VMODE_INTERLACED) { - default_var.yres <<= 1; - default_var.yres_virtual <<= 1; - } else if ((default_var.vmode & FB_VMODE_MASK) == + fb_info->var.yres <<= 1; + fb_info->var.yres_virtual <<= 1; + } else if ((fb_info->var.vmode & FB_VMODE_MASK) == FB_VMODE_DOUBLE) { - default_var.pixclock >>= 1; - default_var.yres >>= 1; - default_var.yres_virtual >>= 1; + fb_info->var.pixclock >>= 1; + fb_info->var.yres >>= 1; + fb_info->var.yres_virtual >>= 1; } } fb_info->flags = FBINFO_FLAG_DEFAULT; - fb_info->var = default_var; fb_info->fix = XGIfb_fix; fb_info->screen_base = xgifb_info->video_vbase; fb_info->fbops = &XGIfb_ops;