Commit 3218286b authored by Thomas Zimmermann's avatar Thomas Zimmermann

fbdev/vesafb: Replace references to global screen_info by local pointer

Get the global screen_info's address once and access the data via
this pointer. Limits the use of global state.
Signed-off-by: default avatarThomas Zimmermann <tzimmermann@suse.de>
Reviewed-by: default avatarJavier Martinez Canillas <javierm@redhat.com>
Link: https://patchwork.freedesktop.org/patch/msgid/20231206135153.2599-4-tzimmermann@suse.de
parent b9cfd1d2
...@@ -243,6 +243,7 @@ static int vesafb_setup(char *options) ...@@ -243,6 +243,7 @@ static int vesafb_setup(char *options)
static int vesafb_probe(struct platform_device *dev) static int vesafb_probe(struct platform_device *dev)
{ {
struct screen_info *si = &screen_info;
struct fb_info *info; struct fb_info *info;
struct vesafb_par *par; struct vesafb_par *par;
int i, err; int i, err;
...@@ -255,17 +256,17 @@ static int vesafb_probe(struct platform_device *dev) ...@@ -255,17 +256,17 @@ static int vesafb_probe(struct platform_device *dev)
fb_get_options("vesafb", &option); fb_get_options("vesafb", &option);
vesafb_setup(option); vesafb_setup(option);
if (screen_info.orig_video_isVGA != VIDEO_TYPE_VLFB) if (si->orig_video_isVGA != VIDEO_TYPE_VLFB)
return -ENODEV; return -ENODEV;
vga_compat = (screen_info.capabilities & 2) ? 0 : 1; vga_compat = (si->capabilities & 2) ? 0 : 1;
vesafb_fix.smem_start = screen_info.lfb_base; vesafb_fix.smem_start = si->lfb_base;
vesafb_defined.bits_per_pixel = screen_info.lfb_depth; vesafb_defined.bits_per_pixel = si->lfb_depth;
if (15 == vesafb_defined.bits_per_pixel) if (15 == vesafb_defined.bits_per_pixel)
vesafb_defined.bits_per_pixel = 16; vesafb_defined.bits_per_pixel = 16;
vesafb_defined.xres = screen_info.lfb_width; vesafb_defined.xres = si->lfb_width;
vesafb_defined.yres = screen_info.lfb_height; vesafb_defined.yres = si->lfb_height;
vesafb_fix.line_length = screen_info.lfb_linelength; vesafb_fix.line_length = si->lfb_linelength;
vesafb_fix.visual = (vesafb_defined.bits_per_pixel == 8) ? vesafb_fix.visual = (vesafb_defined.bits_per_pixel == 8) ?
FB_VISUAL_PSEUDOCOLOR : FB_VISUAL_TRUECOLOR; FB_VISUAL_PSEUDOCOLOR : FB_VISUAL_TRUECOLOR;
...@@ -277,7 +278,7 @@ static int vesafb_probe(struct platform_device *dev) ...@@ -277,7 +278,7 @@ static int vesafb_probe(struct platform_device *dev)
/* size_total -- all video memory we have. Used for mtrr /* size_total -- all video memory we have. Used for mtrr
* entries, resource allocation and bounds * entries, resource allocation and bounds
* checking. */ * checking. */
size_total = screen_info.lfb_size * 65536; size_total = si->lfb_size * 65536;
if (vram_total) if (vram_total)
size_total = vram_total * 1024 * 1024; size_total = vram_total * 1024 * 1024;
if (size_total < size_vmode) if (size_total < size_vmode)
...@@ -297,7 +298,7 @@ static int vesafb_probe(struct platform_device *dev) ...@@ -297,7 +298,7 @@ static int vesafb_probe(struct platform_device *dev)
vesafb_fix.smem_len = size_remap; vesafb_fix.smem_len = size_remap;
#ifndef __i386__ #ifndef __i386__
screen_info.vesapm_seg = 0; si->vesapm_seg = 0;
#endif #endif
if (!request_mem_region(vesafb_fix.smem_start, size_total, "vesafb")) { if (!request_mem_region(vesafb_fix.smem_start, size_total, "vesafb")) {
...@@ -317,23 +318,26 @@ static int vesafb_probe(struct platform_device *dev) ...@@ -317,23 +318,26 @@ static int vesafb_probe(struct platform_device *dev)
par = info->par; par = info->par;
info->pseudo_palette = par->pseudo_palette; info->pseudo_palette = par->pseudo_palette;
par->base = screen_info.lfb_base; par->base = si->lfb_base;
par->size = size_total; par->size = size_total;
printk(KERN_INFO "vesafb: mode is %dx%dx%d, linelength=%d, pages=%d\n", printk(KERN_INFO "vesafb: mode is %dx%dx%d, linelength=%d, pages=%d\n",
vesafb_defined.xres, vesafb_defined.yres, vesafb_defined.bits_per_pixel, vesafb_fix.line_length, screen_info.pages); vesafb_defined.xres, vesafb_defined.yres, vesafb_defined.bits_per_pixel,
vesafb_fix.line_length, si->pages);
if (screen_info.vesapm_seg) { if (si->vesapm_seg) {
printk(KERN_INFO "vesafb: protected mode interface info at %04x:%04x\n", printk(KERN_INFO "vesafb: protected mode interface info at %04x:%04x\n",
screen_info.vesapm_seg,screen_info.vesapm_off); si->vesapm_seg, si->vesapm_off);
} }
if (screen_info.vesapm_seg < 0xc000) if (si->vesapm_seg < 0xc000)
ypan = pmi_setpal = 0; /* not available or some DOS TSR ... */ ypan = pmi_setpal = 0; /* not available or some DOS TSR ... */
if (ypan || pmi_setpal) { if (ypan || pmi_setpal) {
unsigned long pmi_phys;
unsigned short *pmi_base; unsigned short *pmi_base;
pmi_base = (unsigned short*)phys_to_virt(((unsigned long)screen_info.vesapm_seg << 4) + screen_info.vesapm_off); pmi_phys = ((unsigned long)si->vesapm_seg << 4) + si->vesapm_off;
pmi_base = (unsigned short *)phys_to_virt(pmi_phys);
pmi_start = (void*)((char*)pmi_base + pmi_base[1]); pmi_start = (void*)((char*)pmi_base + pmi_base[1]);
pmi_pal = (void*)((char*)pmi_base + pmi_base[2]); pmi_pal = (void*)((char*)pmi_base + pmi_base[2]);
printk(KERN_INFO "vesafb: pmi: set display start = %p, set palette = %p\n",pmi_start,pmi_pal); printk(KERN_INFO "vesafb: pmi: set display start = %p, set palette = %p\n",pmi_start,pmi_pal);
...@@ -377,14 +381,14 @@ static int vesafb_probe(struct platform_device *dev) ...@@ -377,14 +381,14 @@ static int vesafb_probe(struct platform_device *dev)
vesafb_defined.left_margin = (vesafb_defined.xres / 8) & 0xf8; vesafb_defined.left_margin = (vesafb_defined.xres / 8) & 0xf8;
vesafb_defined.hsync_len = (vesafb_defined.xres / 8) & 0xf8; vesafb_defined.hsync_len = (vesafb_defined.xres / 8) & 0xf8;
vesafb_defined.red.offset = screen_info.red_pos; vesafb_defined.red.offset = si->red_pos;
vesafb_defined.red.length = screen_info.red_size; vesafb_defined.red.length = si->red_size;
vesafb_defined.green.offset = screen_info.green_pos; vesafb_defined.green.offset = si->green_pos;
vesafb_defined.green.length = screen_info.green_size; vesafb_defined.green.length = si->green_size;
vesafb_defined.blue.offset = screen_info.blue_pos; vesafb_defined.blue.offset = si->blue_pos;
vesafb_defined.blue.length = screen_info.blue_size; vesafb_defined.blue.length = si->blue_size;
vesafb_defined.transp.offset = screen_info.rsvd_pos; vesafb_defined.transp.offset = si->rsvd_pos;
vesafb_defined.transp.length = screen_info.rsvd_size; vesafb_defined.transp.length = si->rsvd_size;
if (vesafb_defined.bits_per_pixel <= 8) { if (vesafb_defined.bits_per_pixel <= 8) {
depth = vesafb_defined.green.length; depth = vesafb_defined.green.length;
...@@ -399,14 +403,14 @@ static int vesafb_probe(struct platform_device *dev) ...@@ -399,14 +403,14 @@ static int vesafb_probe(struct platform_device *dev)
(vesafb_defined.bits_per_pixel > 8) ? (vesafb_defined.bits_per_pixel > 8) ?
"Truecolor" : (vga_compat || pmi_setpal) ? "Truecolor" : (vga_compat || pmi_setpal) ?
"Pseudocolor" : "Static Pseudocolor", "Pseudocolor" : "Static Pseudocolor",
screen_info.rsvd_size, si->rsvd_size,
screen_info.red_size, si->red_size,
screen_info.green_size, si->green_size,
screen_info.blue_size, si->blue_size,
screen_info.rsvd_pos, si->rsvd_pos,
screen_info.red_pos, si->red_pos,
screen_info.green_pos, si->green_pos,
screen_info.blue_pos); si->blue_pos);
vesafb_fix.ypanstep = ypan ? 1 : 0; vesafb_fix.ypanstep = ypan ? 1 : 0;
vesafb_fix.ywrapstep = (ypan>1) ? 1 : 0; vesafb_fix.ywrapstep = (ypan>1) ? 1 : 0;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment