aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAntonino A. Daplas <adaplas@gmail.com>2007-07-17 07:05:32 -0400
committerLinus Torvalds <torvalds@woody.linux-foundation.org>2007-07-17 13:23:11 -0400
commitafd1db1632c3f8f95cbc2786bfa122cead79db58 (patch)
tree6708d77c3c790f32bd8d647f878a639d93b58dcc
parentd1baa4ffa677bf6986c460fcfd4cdaf8bfe66f0e (diff)
fbcon: Revise primary device selection
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 <adaplas@gmail.com> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
-rw-r--r--drivers/video/console/Kconfig6
-rw-r--r--drivers/video/console/fbcon.c49
2 files changed, 14 insertions, 41 deletions
diff --git a/drivers/video/console/Kconfig b/drivers/video/console/Kconfig
index 160f55f7ac96..49643969f9f8 100644
--- a/drivers/video/console/Kconfig
+++ b/drivers/video/console/Kconfig
@@ -120,7 +120,7 @@ config FRAMEBUFFER_CONSOLE
120 120
121config FRAMEBUFFER_CONSOLE_DETECT_PRIMARY 121config FRAMEBUFFER_CONSOLE_DETECT_PRIMARY
122 bool "Map the console to the primary display device" 122 bool "Map the console to the primary display device"
123 depends on FRAMEBUFFER_CONSOLE && VT_HW_CONSOLE_BINDING 123 depends on FRAMEBUFFER_CONSOLE
124 default n 124 default n
125 ---help--- 125 ---help---
126 If this option is selected, the framebuffer console will 126 If this option is selected, the framebuffer console will
@@ -132,10 +132,6 @@ config FRAMEBUFFER_CONSOLE_DETECT_PRIMARY
132 You can always override the automatic selection of the primary device 132 You can always override the automatic selection of the primary device
133 by using the fbcon=map: boot option. 133 by using the fbcon=map: boot option.
134 134
135 To select this feature, "Support for binding and unbinding console
136 drivers", under "Device Drivers"->"Character Devices" must be set to
137 y.
138
139 If unsure, select n. 135 If unsure, select n.
140 136
141config FRAMEBUFFER_CONSOLE_ROTATION 137config FRAMEBUFFER_CONSOLE_ROTATION
diff --git a/drivers/video/console/fbcon.c b/drivers/video/console/fbcon.c
index 13b67ee8b3c0..9b66331020dd 100644
--- a/drivers/video/console/fbcon.c
+++ b/drivers/video/console/fbcon.c
@@ -3041,52 +3041,32 @@ static int fbcon_fb_unregistered(struct fb_info *info)
3041} 3041}
3042 3042
3043#ifdef CONFIG_FRAMEBUFFER_CONSOLE_DETECT_PRIMARY 3043#ifdef CONFIG_FRAMEBUFFER_CONSOLE_DETECT_PRIMARY
3044static int fbcon_select_primary(struct fb_info *info) 3044static void fbcon_select_primary(struct fb_info *info)
3045{ 3045{
3046 int ret = 0;
3047
3048 if (!map_override && primary_device == -1 && 3046 if (!map_override && primary_device == -1 &&
3049 fb_is_primary_device(info)) { 3047 fb_is_primary_device(info)) {
3050 int i, err; 3048 int i;
3051 3049
3052 printk(KERN_INFO "fbcon: %s is primary device\n", 3050 printk(KERN_INFO "fbcon: %s (fb%i) is primary device\n",
3053 info->fix.id); 3051 info->fix.id, info->node);
3054 primary_device = info->node; 3052 primary_device = info->node;
3055 3053
3056 if (!con_is_bound(&fb_con)) 3054 for (i = first_fb_vc; i <= last_fb_vc; i++)
3057 goto done;
3058
3059 printk(KERN_INFO "fbcon: Unbinding old driver\n");
3060 unbind_con_driver(&fb_con, first_fb_vc, last_fb_vc,
3061 fbcon_is_default);
3062 info_idx = primary_device;
3063
3064 for (i = first_fb_vc; i <= last_fb_vc; i++) {
3065 con2fb_map_boot[i] = primary_device; 3055 con2fb_map_boot[i] = primary_device;
3066 con2fb_map[i] = primary_device;
3067 }
3068
3069 printk(KERN_INFO "fbcon: Selecting new driver\n");
3070 err = bind_con_driver(&fb_con, first_fb_vc, last_fb_vc,
3071 fbcon_is_default);
3072
3073 if (err) {
3074 for (i = first_fb_vc; i <= last_fb_vc; i++)
3075 con2fb_map[i] = -1;
3076 3056
3077 info_idx = -1; 3057 if (con_is_bound(&fb_con)) {
3058 printk(KERN_INFO "fbcon: Remapping primary device, "
3059 "fb%i, to tty %i-%i\n", info->node,
3060 first_fb_vc + 1, last_fb_vc + 1);
3061 info_idx = primary_device;
3078 } 3062 }
3079
3080 ret = 1;
3081 } 3063 }
3082 3064
3083done:
3084 return ret;
3085} 3065}
3086#else 3066#else
3087static inline int fbcon_select_primary(struct fb_info *info) 3067static inline void fbcon_select_primary(struct fb_info *info)
3088{ 3068{
3089 return 0; 3069 return;
3090} 3070}
3091#endif /* CONFIG_FRAMEBUFFER_DETECT_PRIMARY */ 3071#endif /* CONFIG_FRAMEBUFFER_DETECT_PRIMARY */
3092 3072
@@ -3094,9 +3074,7 @@ static int fbcon_fb_registered(struct fb_info *info)
3094{ 3074{
3095 int ret = 0, i, idx = info->node; 3075 int ret = 0, i, idx = info->node;
3096 3076
3097 if (fbcon_select_primary(info)) 3077 fbcon_select_primary(info);
3098 goto done;
3099
3100 3078
3101 if (info_idx == -1) { 3079 if (info_idx == -1) {
3102 for (i = first_fb_vc; i <= last_fb_vc; i++) { 3080 for (i = first_fb_vc; i <= last_fb_vc; i++) {
@@ -3115,7 +3093,6 @@ static int fbcon_fb_registered(struct fb_info *info)
3115 } 3093 }
3116 } 3094 }
3117 3095
3118done:
3119 return ret; 3096 return ret;
3120} 3097}
3121 3098