Commit 29b25594 authored by James Simmons's avatar James Simmons Committed by Linus Torvalds

[PATCH] Framebuffer console fix

This fixes a oops that happens when we map a framebuffer device to a
non-existant console.

set_con2fb_map wasn't testing to see the VC we where mapping to actually
exist.  Now it does.

I also added code to fbcon_cursor to reset the hotspot if it was changed
by userland.
parent e600cd23
...@@ -294,13 +294,16 @@ __setup("fbcon=", fb_console_setup); ...@@ -294,13 +294,16 @@ __setup("fbcon=", fb_console_setup);
* Maps a virtual console @unit to a frame buffer device * Maps a virtual console @unit to a frame buffer device
* @newidx. * @newidx.
*/ */
void set_con2fb_map(int unit, int newidx) int set_con2fb_map(int unit, int newidx)
{ {
struct vc_data *vc = vc_cons[unit].d; struct vc_data *vc = vc_cons[unit].d;
if (!vc)
return -ENODEV;
con2fb_map[unit] = newidx; con2fb_map[unit] = newidx;
fbcon_is_default = (vc->vc_sw == &fb_con) ? 1 : 0; fbcon_is_default = (vc->vc_sw == &fb_con) ? 1 : 0;
take_over_console(&fb_con, unit, unit, fbcon_is_default); take_over_console(&fb_con, unit, unit, fbcon_is_default);
return 0;
} }
/* /*
...@@ -1047,6 +1050,11 @@ static void fbcon_cursor(struct vc_data *vc, int mode) ...@@ -1047,6 +1050,11 @@ static void fbcon_cursor(struct vc_data *vc, int mode)
cursor.set |= FB_CUR_SETSIZE; cursor.set |= FB_CUR_SETSIZE;
} }
if (info->cursor.hot.x || info->cursor.hot.y) {
cursor.hot.x = cursor.hot.y = 0;
cursor.set |= FB_CUR_SETHOT;
}
if ((cursor.set & FB_CUR_SETSIZE) || ((vc->vc_cursor_type & 0x0f) != p->cursor_shape)) { if ((cursor.set & FB_CUR_SETSIZE) || ((vc->vc_cursor_type & 0x0f) != p->cursor_shape)) {
char *mask = kmalloc(w*vc->vc_font.height, GFP_ATOMIC); char *mask = kmalloc(w*vc->vc_font.height, GFP_ATOMIC);
int cur_height, size, i = 0; int cur_height, size, i = 0;
......
...@@ -38,7 +38,7 @@ struct display { ...@@ -38,7 +38,7 @@ struct display {
/* drivers/video/console/fbcon.c */ /* drivers/video/console/fbcon.c */
extern char con2fb_map[MAX_NR_CONSOLES]; extern char con2fb_map[MAX_NR_CONSOLES];
extern void set_con2fb_map(int unit, int newidx); extern int set_con2fb_map(int unit, int newidx);
/* /*
* Attribute Decoding * Attribute Decoding
......
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