]> err.no Git - linux-2.6/blobdiff - drivers/video/console/fbcon.c
[PATCH] fbcon: Initialize new driver when old driver is released
[linux-2.6] / drivers / video / console / fbcon.c
index 188053eafc6986d4e2a160359367fc65fdf7902a..5ff51cd0a2a98c23484a17719ecc1ebe2f19d32a 100644 (file)
@@ -630,6 +630,15 @@ static int con2fb_release_oldinfo(struct vc_data *vc, struct fb_info *oldinfo,
                kfree(oldinfo->fbcon_par);
                oldinfo->fbcon_par = NULL;
                module_put(oldinfo->fbops->owner);
+               /*
+                 If oldinfo and newinfo are driving the same hardware,
+                 the fb_release() method of oldinfo may attempt to
+                 restore the hardware state.  This will leave the
+                 newinfo in an undefined state. Thus, a call to
+                 fb_set_par() may be needed for the newinfo.
+               */
+               if (newinfo->fbops->fb_set_par)
+                       newinfo->fbops->fb_set_par(newinfo);
        }
 
        return err;
@@ -1886,24 +1895,11 @@ static int fbcon_resize(struct vc_data *vc, unsigned int width,
                mode = fb_find_best_mode(&var, &info->modelist);
                if (mode == NULL)
                        return -EINVAL;
+               display_to_var(&var, p);
                fb_videomode_to_var(&var, mode);
+
                if (width > var.xres/fw || height > var.yres/fh)
                        return -EINVAL;
-               /*
-                * The following can probably have any value... Do we need to
-                * set all of them?
-                */
-               var.bits_per_pixel = p->bits_per_pixel;
-               var.xres_virtual = p->xres_virtual;
-               var.yres_virtual = p->yres_virtual;
-               var.accel_flags = p->accel_flags;
-               var.width = p->width;
-               var.height = p->height;
-               var.red = p->red;
-               var.green = p->green;
-               var.blue = p->blue;
-               var.transp = p->transp;
-               var.nonstd = p->nonstd;
 
                DPRINTK("resize now %ix%i\n", var.xres, var.yres);
                if (CON_IS_VISIBLE(vc)) {