Skip to content

Commit

Permalink
fbcon: Revise primary device selection
Browse files Browse the repository at this point in the history
Use set_con2fb_map() to select the primary display driver instead of using
unbind_con_driver() and bind_con_driver().  Using the former is much simpler
and safer than the current one.

Signed-off-by: Antonino Daplas <[email protected]>
Signed-off-by: Andrew Morton <[email protected]>
Signed-off-by: Linus Torvalds <[email protected]>
  • Loading branch information
adaplas authored and Linus Torvalds committed Jul 17, 2007
1 parent d1baa4f commit afd1db1
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 41 deletions.
6 changes: 1 addition & 5 deletions drivers/video/console/Kconfig
Original file line number Diff line number Diff line change
Expand Up @@ -120,7 +120,7 @@ config FRAMEBUFFER_CONSOLE

config FRAMEBUFFER_CONSOLE_DETECT_PRIMARY
bool "Map the console to the primary display device"
depends on FRAMEBUFFER_CONSOLE && VT_HW_CONSOLE_BINDING
depends on FRAMEBUFFER_CONSOLE
default n
---help---
If this option is selected, the framebuffer console will
Expand All @@ -132,10 +132,6 @@ config FRAMEBUFFER_CONSOLE_DETECT_PRIMARY
You can always override the automatic selection of the primary device
by using the fbcon=map: boot option.

To select this feature, "Support for binding and unbinding console
drivers", under "Device Drivers"->"Character Devices" must be set to
y.

If unsure, select n.

config FRAMEBUFFER_CONSOLE_ROTATION
Expand Down
49 changes: 13 additions & 36 deletions drivers/video/console/fbcon.c
Original file line number Diff line number Diff line change
Expand Up @@ -3041,62 +3041,40 @@ static int fbcon_fb_unregistered(struct fb_info *info)
}

#ifdef CONFIG_FRAMEBUFFER_CONSOLE_DETECT_PRIMARY
static int fbcon_select_primary(struct fb_info *info)
static void fbcon_select_primary(struct fb_info *info)
{
int ret = 0;

if (!map_override && primary_device == -1 &&
fb_is_primary_device(info)) {
int i, err;
int i;

printk(KERN_INFO "fbcon: %s is primary device\n",
info->fix.id);
printk(KERN_INFO "fbcon: %s (fb%i) is primary device\n",
info->fix.id, info->node);
primary_device = info->node;

if (!con_is_bound(&fb_con))
goto done;

printk(KERN_INFO "fbcon: Unbinding old driver\n");
unbind_con_driver(&fb_con, first_fb_vc, last_fb_vc,
fbcon_is_default);
info_idx = primary_device;

for (i = first_fb_vc; i <= last_fb_vc; i++) {
for (i = first_fb_vc; i <= last_fb_vc; i++)
con2fb_map_boot[i] = primary_device;
con2fb_map[i] = primary_device;
}

printk(KERN_INFO "fbcon: Selecting new driver\n");
err = bind_con_driver(&fb_con, first_fb_vc, last_fb_vc,
fbcon_is_default);

if (err) {
for (i = first_fb_vc; i <= last_fb_vc; i++)
con2fb_map[i] = -1;

info_idx = -1;
if (con_is_bound(&fb_con)) {
printk(KERN_INFO "fbcon: Remapping primary device, "
"fb%i, to tty %i-%i\n", info->node,
first_fb_vc + 1, last_fb_vc + 1);
info_idx = primary_device;
}

ret = 1;
}

done:
return ret;
}
#else
static inline int fbcon_select_primary(struct fb_info *info)
static inline void fbcon_select_primary(struct fb_info *info)
{
return 0;
return;
}
#endif /* CONFIG_FRAMEBUFFER_DETECT_PRIMARY */

static int fbcon_fb_registered(struct fb_info *info)
{
int ret = 0, i, idx = info->node;

if (fbcon_select_primary(info))
goto done;

fbcon_select_primary(info);

if (info_idx == -1) {
for (i = first_fb_vc; i <= last_fb_vc; i++) {
Expand All @@ -3115,7 +3093,6 @@ static int fbcon_fb_registered(struct fb_info *info)
}
}

done:
return ret;
}

Expand Down

0 comments on commit afd1db1

Please sign in to comment.