Re: [PATCH v3 3/3] serial: core: Move console character device handling from printk

From: Tony Lindgren
Date: Fri Nov 24 2023 - 00:57:22 EST


* Tony Lindgren <tony@xxxxxxxxxxx> [231122 10:16]:
> * Tony Lindgren <tony@xxxxxxxxxxx> [231122 09:04]:
> > * Tony Lindgren <tony@xxxxxxxxxxx> [700101 02:00]:
> > > - __add_preferred_console(buf, idx, options, brl_options, true);
> > > return 1;
> >
> > Looks like this can't be dropped yet. We need to keep it for the
> > brl_options. I'll change it to return early if brl_options is NULL.
>
> Looks like we can drop the parsing from printk :) In console_setup()
> we can call console_opt_save() after _braille_console_setup(), and
> then save also the brl_options for the port.

I noticed we have more issues remaining trying to drop the console
parsing completely from console_setup().

If add_preferred_console() gets called later, register_console() can
try to call try_enable_default_console() before we get around to call
try_enable_preferred_console(), and that may lead to no serial console.

To avoid that, setting console_set_on_cmdline = 1 in console_setup(),
and patching register_console() console to check for the flag helps.
But looks like that leads to bootconsole not getting disabled and
more patching for that is needed.. And of course we'd need to check
the other register_console() callers too, not just 8250..

So I think for now, it's best to just drop the 8250 and sparc quirks
from console_setup(), that already simplifies things in printk a bit :)

And for 8250, we should have serial8250_isa_init_ports() call
add_preferred_console_match() to avoid console getting registered
later on when the hardware specific driver takes over for x86, m68k,
and alpha that define SERIAL_PORT_DFNS.

Regards,

Tony