summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDaniel Vetter <daniel.vetter@ffwll.ch>2019-05-28 05:02:48 -0400
committerDaniel Vetter <daniel.vetter@ffwll.ch>2019-06-12 14:28:45 -0400
commit0e0f3250d4402d60f4571d076ab27d5af049853e (patch)
treeb96a971bc309c1808bea8d882109499503437ebb
parentcf4a3ae4ef3399179166a464af1d6b172225bef4 (diff)
fbcon: call fbcon_fb_bind directly
Also remove the error return value. That's all errors for either driver bugs (trying to unbind something that isn't bound), or errors of the new driver that will take over. There's nothing the outgoing driver can do about this anyway, so switch over to void. Signed-off-by: Daniel Vetter <daniel.vetter@intel.com> Reviewed-by: Sam Ravnborg <sam@ravnborg.org> Reviewed-by: Maarten Lankhorst <maarten.lankhorst@linux.intel.com> Cc: Bartlomiej Zolnierkiewicz <b.zolnierkie@samsung.com> Cc: Daniel Vetter <daniel.vetter@ffwll.ch> Cc: Hans de Goede <hdegoede@redhat.com> Cc: Sergey Senozhatsky <sergey.senozhatsky@gmail.com> Cc: Peter Rosin <peda@axentia.se> Cc: Kees Cook <keescook@chromium.org> Cc: Konstantin Khorenko <khorenko@virtuozzo.com> Cc: Yisheng Xie <ysxie@foxmail.com> Cc: "Michał Mirosław" <mirq-linux@rere.qmqm.pl> Cc: Mikulas Patocka <mpatocka@redhat.com> Cc: Thomas Zimmermann <tzimmermann@suse.de> Cc: linux-fbdev@vger.kernel.org Link: https://patchwork.freedesktop.org/patch/msgid/20190528090304.9388-18-daniel.vetter@ffwll.ch
-rw-r--r--drivers/video/fbdev/core/fbcon.c24
-rw-r--r--drivers/video/fbdev/core/fbmem.c7
-rw-r--r--include/linux/fb.h2
-rw-r--r--include/linux/fbcon.h2
4 files changed, 11 insertions, 24 deletions
diff --git a/drivers/video/fbdev/core/fbcon.c b/drivers/video/fbdev/core/fbcon.c
index f7f3eb0f1893..d1e37afa6f80 100644
--- a/drivers/video/fbdev/core/fbcon.c
+++ b/drivers/video/fbdev/core/fbcon.c
@@ -3046,7 +3046,7 @@ static int fbcon_mode_deleted(struct fb_info *info,
3046} 3046}
3047 3047
3048#ifdef CONFIG_VT_HW_CONSOLE_BINDING 3048#ifdef CONFIG_VT_HW_CONSOLE_BINDING
3049static int fbcon_unbind(void) 3049static void fbcon_unbind(void)
3050{ 3050{
3051 int ret; 3051 int ret;
3052 3052
@@ -3055,25 +3055,21 @@ static int fbcon_unbind(void)
3055 3055
3056 if (!ret) 3056 if (!ret)
3057 fbcon_has_console_bind = 0; 3057 fbcon_has_console_bind = 0;
3058
3059 return ret;
3060} 3058}
3061#else 3059#else
3062static inline int fbcon_unbind(void) 3060static inline void fbcon_unbind(void) {}
3063{
3064 return -EINVAL;
3065}
3066#endif /* CONFIG_VT_HW_CONSOLE_BINDING */ 3061#endif /* CONFIG_VT_HW_CONSOLE_BINDING */
3067 3062
3068/* called with console_lock held */ 3063/* called with console_lock held */
3069static int fbcon_fb_unbind(int idx) 3064void fbcon_fb_unbind(struct fb_info *info)
3070{ 3065{
3071 int i, new_idx = -1, ret = 0; 3066 int i, new_idx = -1, ret = 0;
3067 int idx = info->node;
3072 3068
3073 WARN_CONSOLE_UNLOCKED(); 3069 WARN_CONSOLE_UNLOCKED();
3074 3070
3075 if (!fbcon_has_console_bind) 3071 if (!fbcon_has_console_bind)
3076 return 0; 3072 return;
3077 3073
3078 for (i = first_fb_vc; i <= last_fb_vc; i++) { 3074 for (i = first_fb_vc; i <= last_fb_vc; i++) {
3079 if (con2fb_map[i] != idx && 3075 if (con2fb_map[i] != idx &&
@@ -3106,15 +3102,13 @@ static int fbcon_fb_unbind(int idx)
3106 idx, 0); 3102 idx, 0);
3107 if (ret) { 3103 if (ret) {
3108 con2fb_map[i] = idx; 3104 con2fb_map[i] = idx;
3109 return ret; 3105 return;
3110 } 3106 }
3111 } 3107 }
3112 } 3108 }
3113 } 3109 }
3114 ret = fbcon_unbind(); 3110 fbcon_unbind();
3115 } 3111 }
3116
3117 return ret;
3118} 3112}
3119 3113
3120/* called with console_lock held */ 3114/* called with console_lock held */
@@ -3352,10 +3346,6 @@ static int fbcon_event_notify(struct notifier_block *self,
3352 mode = event->data; 3346 mode = event->data;
3353 ret = fbcon_mode_deleted(info, mode); 3347 ret = fbcon_mode_deleted(info, mode);
3354 break; 3348 break;
3355 case FB_EVENT_FB_UNBIND:
3356 idx = info->node;
3357 ret = fbcon_fb_unbind(idx);
3358 break;
3359 case FB_EVENT_SET_CONSOLE_MAP: 3349 case FB_EVENT_SET_CONSOLE_MAP:
3360 /* called with console lock held */ 3350 /* called with console lock held */
3361 con2fb = event->data; 3351 con2fb = event->data;
diff --git a/drivers/video/fbdev/core/fbmem.c b/drivers/video/fbdev/core/fbmem.c
index d73762324ca2..f3fc2e5b193c 100644
--- a/drivers/video/fbdev/core/fbmem.c
+++ b/drivers/video/fbdev/core/fbmem.c
@@ -1716,8 +1716,6 @@ static int do_register_framebuffer(struct fb_info *fb_info)
1716 1716
1717static int unbind_console(struct fb_info *fb_info) 1717static int unbind_console(struct fb_info *fb_info)
1718{ 1718{
1719 struct fb_event event;
1720 int ret;
1721 int i = fb_info->node; 1719 int i = fb_info->node;
1722 1720
1723 if (i < 0 || i >= FB_MAX || registered_fb[i] != fb_info) 1721 if (i < 0 || i >= FB_MAX || registered_fb[i] != fb_info)
@@ -1725,12 +1723,11 @@ static int unbind_console(struct fb_info *fb_info)
1725 1723
1726 console_lock(); 1724 console_lock();
1727 lock_fb_info(fb_info); 1725 lock_fb_info(fb_info);
1728 event.info = fb_info; 1726 fbcon_fb_unbind(fb_info);
1729 ret = fb_notifier_call_chain(FB_EVENT_FB_UNBIND, &event);
1730 unlock_fb_info(fb_info); 1727 unlock_fb_info(fb_info);
1731 console_unlock(); 1728 console_unlock();
1732 1729
1733 return ret; 1730 return 0;
1734} 1731}
1735 1732
1736static int __unlink_framebuffer(struct fb_info *fb_info); 1733static int __unlink_framebuffer(struct fb_info *fb_info);
diff --git a/include/linux/fb.h b/include/linux/fb.h
index aa8f18163151..b6ce041d9e13 100644
--- a/include/linux/fb.h
+++ b/include/linux/fb.h
@@ -158,8 +158,6 @@ struct fb_cursor_user {
158#define FB_EVENT_CONBLANK 0x0C 158#define FB_EVENT_CONBLANK 0x0C
159/* Get drawing requirements */ 159/* Get drawing requirements */
160#define FB_EVENT_GET_REQ 0x0D 160#define FB_EVENT_GET_REQ 0x0D
161/* Unbind from the console if possible */
162#define FB_EVENT_FB_UNBIND 0x0E
163/* CONSOLE-SPECIFIC: remap all consoles to new fb - for vga_switcheroo */ 161/* CONSOLE-SPECIFIC: remap all consoles to new fb - for vga_switcheroo */
164#define FB_EVENT_REMAP_ALL_CONSOLE 0x0F 162#define FB_EVENT_REMAP_ALL_CONSOLE 0x0F
165/* A hardware display blank early change occurred */ 163/* A hardware display blank early change occurred */
diff --git a/include/linux/fbcon.h b/include/linux/fbcon.h
index 94a71e9e1257..38d44fdb6d14 100644
--- a/include/linux/fbcon.h
+++ b/include/linux/fbcon.h
@@ -6,11 +6,13 @@ void __init fb_console_init(void);
6void __exit fb_console_exit(void); 6void __exit fb_console_exit(void);
7int fbcon_fb_registered(struct fb_info *info); 7int fbcon_fb_registered(struct fb_info *info);
8void fbcon_fb_unregistered(struct fb_info *info); 8void fbcon_fb_unregistered(struct fb_info *info);
9void fbcon_fb_unbind(struct fb_info *info);
9#else 10#else
10static inline void fb_console_init(void) {} 11static inline void fb_console_init(void) {}
11static inline void fb_console_exit(void) {} 12static inline void fb_console_exit(void) {}
12static inline int fbcon_fb_registered(struct fb_info *info) { return 0; } 13static inline int fbcon_fb_registered(struct fb_info *info) { return 0; }
13static inline void fbcon_fb_unregistered(struct fb_info *info) {} 14static inline void fbcon_fb_unregistered(struct fb_info *info) {}
15static inline void fbcon_fb_unbind(struct fb_info *info) {}
14#endif 16#endif
15 17
16#endif /* _LINUX_FBCON_H */ 18#endif /* _LINUX_FBCON_H */