From: "Antonino A. Daplas" 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: Antonino Daplas Acked-by: Petr Vandrovec Signed-off-by: Andrew Morton --- 25-akpm/drivers/video/matrox/matroxfb_base.c | 20 +++++++++----------- 25-akpm/drivers/video/matrox/matroxfb_base.h | 1 + 25-akpm/drivers/video/matrox/matroxfb_crtc2.c | 4 +++- 25-akpm/drivers/video/matrox/matroxfb_crtc2.h | 1 + 4 files changed, 14 insertions(+), 12 deletions(-) diff -puN drivers/video/matrox/matroxfb_base.c~fbdev-check-for-intialized-flag-before-registration-in-matroxfb drivers/video/matrox/matroxfb_base.c --- 25/drivers/video/matrox/matroxfb_base.c~fbdev-check-for-intialized-flag-before-registration-in-matroxfb Wed Nov 3 15:20:35 2004 +++ 25-akpm/drivers/video/matrox/matroxfb_base.c Wed Nov 3 15:20:35 2004 @@ -835,6 +835,7 @@ static int matroxfb_set_par(struct fb_in matrox_cfbX_init(PMINFO2); } } + ACCESS_FBINFO(initialized) = 1; return 0; } @@ -1876,20 +1877,17 @@ static int initMatrox2(WPMINFO struct bo } printk("fb%d: %s frame buffer device\n", 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 * until someone tells me what is proper thing to do */ - printk(KERN_INFO "fb%d: initializing hardware\n", - ACCESS_FBINFO(fbcon.node)); - /* We have to use FB_ACTIVATE_FORCE, as we had to put vesafb_defined to the fbcon.var - * already before, so register_framebuffer works correctly. */ - vesafb_defined.activate |= FB_ACTIVATE_FORCE; - fb_set_var(&ACCESS_FBINFO(fbcon), &vesafb_defined); + if (!ACCESS_FBINFO(initialized)) { + printk(KERN_INFO "fb%d: initializing hardware\n", + ACCESS_FBINFO(fbcon.node)); + /* We have to use FB_ACTIVATE_FORCE, as we had to put vesafb_defined to the fbcon.var + * already before, so register_framebuffer works correctly. */ + vesafb_defined.activate |= FB_ACTIVATE_FORCE; + fb_set_var(&ACCESS_FBINFO(fbcon), &vesafb_defined); + } return 0; failVideoIO:; diff -puN drivers/video/matrox/matroxfb_base.h~fbdev-check-for-intialized-flag-before-registration-in-matroxfb drivers/video/matrox/matroxfb_base.h --- 25/drivers/video/matrox/matroxfb_base.h~fbdev-check-for-intialized-flag-before-registration-in-matroxfb Wed Nov 3 15:20:35 2004 +++ 25-akpm/drivers/video/matrox/matroxfb_base.h Wed Nov 3 15:20:35 2004 @@ -372,6 +372,7 @@ struct matrox_fb_info { struct list_head next_fb; int dead; + int initialized; unsigned int usecount; unsigned int userusecount; diff -puN drivers/video/matrox/matroxfb_crtc2.c~fbdev-check-for-intialized-flag-before-registration-in-matroxfb drivers/video/matrox/matroxfb_crtc2.c --- 25/drivers/video/matrox/matroxfb_crtc2.c~fbdev-check-for-intialized-flag-before-registration-in-matroxfb Wed Nov 3 15:20:35 2004 +++ 25-akpm/drivers/video/matrox/matroxfb_crtc2.c Wed Nov 3 15:20:35 2004 @@ -387,6 +387,7 @@ static int matroxfb_dh_set_par(struct fb up_read(&ACCESS_FBINFO(altout).lock); matroxfb_dh_cfbX_init(m2info); } + m2info->initialized = 1; return 0; #undef m2info } @@ -633,7 +634,8 @@ static int matroxfb_dh_regit(CPMINFO str if (register_framebuffer(&m2info->fbcon)) { 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)); oldcrtc2 = ACCESS_FBINFO(crtc2.info); ACCESS_FBINFO(crtc2.info) = m2info; diff -puN drivers/video/matrox/matroxfb_crtc2.h~fbdev-check-for-intialized-flag-before-registration-in-matroxfb drivers/video/matrox/matroxfb_crtc2.h --- 25/drivers/video/matrox/matroxfb_crtc2.h~fbdev-check-for-intialized-flag-before-registration-in-matroxfb Wed Nov 3 15:20:35 2004 +++ 25-akpm/drivers/video/matrox/matroxfb_crtc2.h Wed Nov 3 15:20:35 2004 @@ -9,6 +9,7 @@ struct matroxfb_dh_fb_info { struct fb_info fbcon; int fbcon_registered; + int initialized; struct matrox_fb_info* primary_dev; _