Commit 82755891 authored by Antonino Daplas's avatar Antonino Daplas Committed by Linus Torvalds

[PATCH] fbdev: Check for intialized flag before registration in matroxfb

In matroxfb_set_par, a flag is set to nonzero which is checked after
register_framebuffer().  If this flag is zero, the driver will initialize
the hardware.

This is necessary because info->currcon (previously checked by matroxfb)
has been removed from struct fb_info.
Signed-off-by: default avatarAntonino Daplas <adaplas@pol.net>
Acked-by: default avatarPetr Vandrovec <VANDROVE@vc.cvut.cz>
Signed-off-by: default avatarAndrew Morton <akpm@osdl.org>
Signed-off-by: default avatarLinus Torvalds <torvalds@osdl.org>
parent 01a9180b
...@@ -835,6 +835,7 @@ static int matroxfb_set_par(struct fb_info *info) ...@@ -835,6 +835,7 @@ static int matroxfb_set_par(struct fb_info *info)
matrox_cfbX_init(PMINFO2); matrox_cfbX_init(PMINFO2);
} }
} }
ACCESS_FBINFO(initialized) = 1;
return 0; return 0;
} }
...@@ -1876,20 +1877,17 @@ static int initMatrox2(WPMINFO struct board* b){ ...@@ -1876,20 +1877,17 @@ static int initMatrox2(WPMINFO struct board* b){
} }
printk("fb%d: %s frame buffer device\n", printk("fb%d: %s frame buffer device\n",
ACCESS_FBINFO(fbcon.node), ACCESS_FBINFO(fbcon.fix.id)); ACCESS_FBINFO(fbcon.node), ACCESS_FBINFO(fbcon.fix.id));
/*
* Tony: If this driver is to be mapped to the console, then
* fbcon will automatically do a set_par for us. The code below
* may not be needed.
*/
/* there is no console on this fb... but we have to initialize hardware /* there is no console on this fb... but we have to initialize hardware
* until someone tells me what is proper thing to do */ * until someone tells me what is proper thing to do */
printk(KERN_INFO "fb%d: initializing hardware\n", if (!ACCESS_FBINFO(initialized)) {
ACCESS_FBINFO(fbcon.node)); printk(KERN_INFO "fb%d: initializing hardware\n",
/* We have to use FB_ACTIVATE_FORCE, as we had to put vesafb_defined to the fbcon.var ACCESS_FBINFO(fbcon.node));
* already before, so register_framebuffer works correctly. */ /* We have to use FB_ACTIVATE_FORCE, as we had to put vesafb_defined to the fbcon.var
vesafb_defined.activate |= FB_ACTIVATE_FORCE; * already before, so register_framebuffer works correctly. */
fb_set_var(&ACCESS_FBINFO(fbcon), &vesafb_defined); vesafb_defined.activate |= FB_ACTIVATE_FORCE;
fb_set_var(&ACCESS_FBINFO(fbcon), &vesafb_defined);
}
return 0; return 0;
failVideoIO:; failVideoIO:;
......
...@@ -372,6 +372,7 @@ struct matrox_fb_info { ...@@ -372,6 +372,7 @@ struct matrox_fb_info {
struct list_head next_fb; struct list_head next_fb;
int dead; int dead;
int initialized;
unsigned int usecount; unsigned int usecount;
unsigned int userusecount; unsigned int userusecount;
......
...@@ -387,6 +387,7 @@ static int matroxfb_dh_set_par(struct fb_info* info) { ...@@ -387,6 +387,7 @@ static int matroxfb_dh_set_par(struct fb_info* info) {
up_read(&ACCESS_FBINFO(altout).lock); up_read(&ACCESS_FBINFO(altout).lock);
matroxfb_dh_cfbX_init(m2info); matroxfb_dh_cfbX_init(m2info);
} }
m2info->initialized = 1;
return 0; return 0;
#undef m2info #undef m2info
} }
...@@ -633,7 +634,8 @@ static int matroxfb_dh_regit(CPMINFO struct matroxfb_dh_fb_info* m2info) { ...@@ -633,7 +634,8 @@ static int matroxfb_dh_regit(CPMINFO struct matroxfb_dh_fb_info* m2info) {
if (register_framebuffer(&m2info->fbcon)) { if (register_framebuffer(&m2info->fbcon)) {
return -ENXIO; return -ENXIO;
} }
fb_set_var(&m2info->fbcon, &matroxfb_dh_defined); if (!m2info->initialized)
fb_set_var(&m2info->fbcon, &matroxfb_dh_defined);
down_write(&ACCESS_FBINFO(crtc2.lock)); down_write(&ACCESS_FBINFO(crtc2.lock));
oldcrtc2 = ACCESS_FBINFO(crtc2.info); oldcrtc2 = ACCESS_FBINFO(crtc2.info);
ACCESS_FBINFO(crtc2.info) = m2info; ACCESS_FBINFO(crtc2.info) = m2info;
......
...@@ -9,6 +9,7 @@ ...@@ -9,6 +9,7 @@
struct matroxfb_dh_fb_info { struct matroxfb_dh_fb_info {
struct fb_info fbcon; struct fb_info fbcon;
int fbcon_registered; int fbcon_registered;
int initialized;
struct matrox_fb_info* primary_dev; struct matrox_fb_info* primary_dev;
......
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