Re: [PATCH v5 11/16] console/braille: Lock console->setup() call during the registration

From: Petr Mladek

Date: Wed Nov 04 2026 - 09:22:36 EST


On Thu 2026-10-29 15:15:21, Chris Down wrote:
> Petr Mladek writes:
> >In braille_register_console(), the console->setup() callback must be
> >called while holding the console_lock. This prevents a race condition
> >with a possible active boot console that might be using the same hardware
> >registers.
>
> Acked-by: Chris Down <chris@xxxxxxxxxxxxxx>
>
> >index d780f6de303a..11d6b854ee63 100644
> >--- a/include/linux/console.h
> >+++ b/include/linux/console.h
> >@@ -699,6 +699,7 @@ enum con_flush_mode {
> > };
> >
> > extern int add_preferred_console(const char *name, const short idx, char *options);
> >+extern int console_call_setup(struct console *newcon, char *options);
>
> Hmm, now that console_call_setup() is global, a short comment saying it is only
> meant for the Braille driver might discourage other users if you want. But not
> a big deal either way.

OK, I am going to do the following change in v6:

--- a/kernel/printk/printk.c
+++ b/kernel/printk/printk.c
@@ -3957,6 +3957,12 @@ static int __init keep_bootcon_setup(char *str)

early_param("keep_bootcon", keep_bootcon_setup);

+/*
+ * The function is intended only for the generic console registration code.
+ * It has been made global only for the Braille console driver which
+ * is partly using the generic console registration code but it is
+ * integrated with VT code instead of printk().
+ */
int console_call_setup(struct console *newcon, char *options)
{
int err;

Best Regards,
Petr