Commit 0e0f3250 authored by Daniel Vetter's avatar Daniel Vetter

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: default avatarDaniel Vetter <daniel.vetter@intel.com>
Reviewed-by: default avatarSam Ravnborg <sam@ravnborg.org>
Reviewed-by: default avatarMaarten 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
parent cf4a3ae4
...@@ -3046,7 +3046,7 @@ static int fbcon_mode_deleted(struct fb_info *info, ...@@ -3046,7 +3046,7 @@ static int fbcon_mode_deleted(struct fb_info *info,
} }
#ifdef CONFIG_VT_HW_CONSOLE_BINDING #ifdef CONFIG_VT_HW_CONSOLE_BINDING
static int fbcon_unbind(void) static void fbcon_unbind(void)
{ {
int ret; int ret;
...@@ -3055,25 +3055,21 @@ static int fbcon_unbind(void) ...@@ -3055,25 +3055,21 @@ static int fbcon_unbind(void)
if (!ret) if (!ret)
fbcon_has_console_bind = 0; fbcon_has_console_bind = 0;
return ret;
} }
#else #else
static inline int fbcon_unbind(void) static inline void fbcon_unbind(void) {}
{
return -EINVAL;
}
#endif /* CONFIG_VT_HW_CONSOLE_BINDING */ #endif /* CONFIG_VT_HW_CONSOLE_BINDING */
/* called with console_lock held */ /* called with console_lock held */
static int fbcon_fb_unbind(int idx) void fbcon_fb_unbind(struct fb_info *info)
{ {
int i, new_idx = -1, ret = 0; int i, new_idx = -1, ret = 0;
int idx = info->node;
WARN_CONSOLE_UNLOCKED(); WARN_CONSOLE_UNLOCKED();
if (!fbcon_has_console_bind) if (!fbcon_has_console_bind)
return 0; return;
for (i = first_fb_vc; i <= last_fb_vc; i++) { for (i = first_fb_vc; i <= last_fb_vc; i++) {
if (con2fb_map[i] != idx && if (con2fb_map[i] != idx &&
...@@ -3106,15 +3102,13 @@ static int fbcon_fb_unbind(int idx) ...@@ -3106,15 +3102,13 @@ static int fbcon_fb_unbind(int idx)
idx, 0); idx, 0);
if (ret) { if (ret) {
con2fb_map[i] = idx; con2fb_map[i] = idx;
return ret; return;
} }
} }
} }
} }
ret = fbcon_unbind(); fbcon_unbind();
} }
return ret;
} }
/* called with console_lock held */ /* called with console_lock held */
...@@ -3352,10 +3346,6 @@ static int fbcon_event_notify(struct notifier_block *self, ...@@ -3352,10 +3346,6 @@ static int fbcon_event_notify(struct notifier_block *self,
mode = event->data; mode = event->data;
ret = fbcon_mode_deleted(info, mode); ret = fbcon_mode_deleted(info, mode);
break; break;
case FB_EVENT_FB_UNBIND:
idx = info->node;
ret = fbcon_fb_unbind(idx);
break;
case FB_EVENT_SET_CONSOLE_MAP: case FB_EVENT_SET_CONSOLE_MAP:
/* called with console lock held */ /* called with console lock held */
con2fb = event->data; con2fb = event->data;
......
...@@ -1716,8 +1716,6 @@ static int do_register_framebuffer(struct fb_info *fb_info) ...@@ -1716,8 +1716,6 @@ static int do_register_framebuffer(struct fb_info *fb_info)
static int unbind_console(struct fb_info *fb_info) static int unbind_console(struct fb_info *fb_info)
{ {
struct fb_event event;
int ret;
int i = fb_info->node; int i = fb_info->node;
if (i < 0 || i >= FB_MAX || registered_fb[i] != fb_info) 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,12 +1723,11 @@ static int unbind_console(struct fb_info *fb_info)
console_lock(); console_lock();
lock_fb_info(fb_info); lock_fb_info(fb_info);
event.info = fb_info; fbcon_fb_unbind(fb_info);
ret = fb_notifier_call_chain(FB_EVENT_FB_UNBIND, &event);
unlock_fb_info(fb_info); unlock_fb_info(fb_info);
console_unlock(); console_unlock();
return ret; return 0;
} }
static int __unlink_framebuffer(struct fb_info *fb_info); static int __unlink_framebuffer(struct fb_info *fb_info);
......
...@@ -158,8 +158,6 @@ struct fb_cursor_user { ...@@ -158,8 +158,6 @@ struct fb_cursor_user {
#define FB_EVENT_CONBLANK 0x0C #define FB_EVENT_CONBLANK 0x0C
/* Get drawing requirements */ /* Get drawing requirements */
#define FB_EVENT_GET_REQ 0x0D #define FB_EVENT_GET_REQ 0x0D
/* Unbind from the console if possible */
#define FB_EVENT_FB_UNBIND 0x0E
/* CONSOLE-SPECIFIC: remap all consoles to new fb - for vga_switcheroo */ /* CONSOLE-SPECIFIC: remap all consoles to new fb - for vga_switcheroo */
#define FB_EVENT_REMAP_ALL_CONSOLE 0x0F #define FB_EVENT_REMAP_ALL_CONSOLE 0x0F
/* A hardware display blank early change occurred */ /* A hardware display blank early change occurred */
......
...@@ -6,11 +6,13 @@ void __init fb_console_init(void); ...@@ -6,11 +6,13 @@ void __init fb_console_init(void);
void __exit fb_console_exit(void); void __exit fb_console_exit(void);
int fbcon_fb_registered(struct fb_info *info); int fbcon_fb_registered(struct fb_info *info);
void fbcon_fb_unregistered(struct fb_info *info); void fbcon_fb_unregistered(struct fb_info *info);
void fbcon_fb_unbind(struct fb_info *info);
#else #else
static inline void fb_console_init(void) {} static inline void fb_console_init(void) {}
static inline void fb_console_exit(void) {} static inline void fb_console_exit(void) {}
static inline int fbcon_fb_registered(struct fb_info *info) { return 0; } static inline int fbcon_fb_registered(struct fb_info *info) { return 0; }
static inline void fbcon_fb_unregistered(struct fb_info *info) {} static inline void fbcon_fb_unregistered(struct fb_info *info) {}
static inline void fbcon_fb_unbind(struct fb_info *info) {}
#endif #endif
#endif /* _LINUX_FBCON_H */ #endif /* _LINUX_FBCON_H */
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