@@ -83,6 +83,32 @@ static int dummycon_blank(struct vc_data *vc, int blank, int mode_switch)
/* Redraw, so that we get putc(s) for output done while blanked */
return 1;
}
+
+/* This is protected by the console_lock */
+static RAW_NOTIFIER_HEAD(dummycon_switch_nh);
+
+void dummycon_register_switch_notifier(struct notifier_block *nb)
+{
+ WARN_CONSOLE_UNLOCKED();
+
+ raw_notifier_chain_register(&dummycon_switch_nh, nb);
+}
+
+void dummycon_unregister_switch_notifier(struct notifier_block *nb)
+{
+ WARN_CONSOLE_UNLOCKED();
+
+ raw_notifier_chain_unregister(&dummycon_switch_nh, nb);
+}
+
+static int dummycon_switch(struct vc_data *vc)
+{
+ WARN_CONSOLE_UNLOCKED();
+
+ raw_notifier_call_chain(&dummycon_switch_nh, 0, vc);
+
+ return 0;
+}
#else
static void dummycon_putc(struct vc_data *vc, int c, int ypos, int xpos) { }
static void dummycon_putcs(struct vc_data *vc, const unsigned short *s,
@@ -91,6 +117,10 @@ static int dummycon_blank(struct vc_data *vc, int blank, int mode_switch)
{
return 0;
}
+static int dummycon_switch(struct vc_data *vc)
+{
+ return 0;
+}
#endif
static const char *dummycon_startup(void)
@@ -120,11 +150,6 @@ static bool dummycon_scroll(struct vc_data *vc, unsigned int top,
return false;
}
-static int dummycon_switch(struct vc_data *vc)
-{
- return 0;
-}
-
/*
* The console `switch' structure for the dummy console
*
@@ -531,5 +531,7 @@ extern void console_init(void);
/* For deferred console takeover */
void dummycon_register_output_notifier(struct notifier_block *nb);
void dummycon_unregister_output_notifier(struct notifier_block *nb);
+void dummycon_register_switch_notifier(struct notifier_block *nb);
+void dummycon_unregister_switch_notifier(struct notifier_block *nb);
#endif /* _LINUX_CONSOLE_H */
To detect switch attempts before a real console exists. This will be used for the same purpose as dummycon_(un)register_output_notifier, for fbcon to detect a more polite time to take over. Signed-off-by: Daniel van Vugt <daniel.van.vugt@canonical.com> --- drivers/video/console/dummycon.c | 35 +++++++++++++++++++++++++++----- include/linux/console.h | 2 ++ 2 files changed, 32 insertions(+), 5 deletions(-)