summaryrefslogtreecommitdiff
path: root/drivers/video/fbdev/core/fbcon.c
diff options
context:
space:
mode:
authorHans de Goede <hdegoede@redhat.com>2018-08-10 17:23:02 +0200
committerBartlomiej Zolnierkiewicz <b.zolnierkie@samsung.com>2018-08-10 17:23:02 +0200
commitdf37e225f25933732c17e43cbe7d21eec31b24be (patch)
treeb451fe45b3a6280bf88fa0fed28c144dd2c6e6ec /drivers/video/fbdev/core/fbcon.c
parent4d64c8e02cdad5ada0b9e1e3d20b73c279cafaf2 (diff)
fbcon: Do not takeover the console from atomic context
Taking over the console involves allocating mem with GFP_KERNEL, talking to drm drivers, etc. So this should not be done from an atomic context. But the console-output trigger deferred console takeover may happen from an atomic context, which leads to "BUG: sleeping function called from invalid context" errors. This commit fixes these errors by doing the deferred takeover from a workqueue. Signed-off-by: Hans de Goede <hdegoede@redhat.com> [b.zolnierkie: remove unused variable] Signed-off-by: Bartlomiej Zolnierkiewicz <b.zolnierkie@samsung.com>
Diffstat (limited to 'drivers/video/fbdev/core/fbcon.c')
-rw-r--r--drivers/video/fbdev/core/fbcon.c19
1 files changed, 15 insertions, 4 deletions
diff --git a/drivers/video/fbdev/core/fbcon.c b/drivers/video/fbdev/core/fbcon.c
index ef8b2d0b7071..75ebbbf0a1fb 100644
--- a/drivers/video/fbdev/core/fbcon.c
+++ b/drivers/video/fbdev/core/fbcon.c
@@ -3592,13 +3592,24 @@ static int fbcon_init_device(void)
}
#ifdef CONFIG_FRAMEBUFFER_CONSOLE_DEFERRED_TAKEOVER
+static void fbcon_register_existing_fbs(struct work_struct *work)
+{
+ int i;
+
+ console_lock();
+
+ for_each_registered_fb(i)
+ fbcon_fb_registered(registered_fb[i]);
+
+ console_unlock();
+}
+
static struct notifier_block fbcon_output_nb;
+static DECLARE_WORK(fbcon_deferred_takeover_work, fbcon_register_existing_fbs);
static int fbcon_output_notifier(struct notifier_block *nb,
unsigned long action, void *data)
{
- int i;
-
WARN_CONSOLE_UNLOCKED();
pr_info("fbcon: Taking over console\n");
@@ -3607,8 +3618,8 @@ static int fbcon_output_notifier(struct notifier_block *nb,
deferred_takeover = false;
logo_shown = FBCON_LOGO_DONTSHOW;
- for_each_registered_fb(i)
- fbcon_fb_registered(registered_fb[i]);
+ /* We may get called in atomic context */
+ schedule_work(&fbcon_deferred_takeover_work);
return NOTIFY_OK;
}