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

From: Andy Shevchenko
Date: Tue Nov 21 2023 - 13:00:21 EST


On Tue, Nov 21, 2023 at 01:31:57PM +0200, Tony Lindgren wrote:
> There's no need for console_setup() to try to figure out the console
> character device name for serial ports early on before uart_add_one_port()
> has been called. And for early debug console we have earlycon.
>
> Let's handle the serial port specific commandline options in the serial
> core subsystem and drop the handling from printk. The serial core
> subsystem can just call add_preferred_console() when the serial port is
> getting initialized.
>
> Note that eventually we may want to set up driver specific console quirk
> handling for the serial port device drivers to use. But we need to figure
> out which driver(s) need to call the quirk. So for now, we just move the
> sparc quirk and handle it directly.

...

> + ret = add_preferred_console_match(name, drv->dev_name, port->line);
> + if (ret && ret != -ENOENT)
> + return ret;
> +
> + return 0;

2nd time and so on, perhaps deserves a helper?

static inline int add_preferred_console...(...)
{
int ret;

ret = add_preferred_console_match(name, drv->dev_name, port->line);
if (ret == -ENOENT)
return 0;
return ret;

}

?

--
With Best Regards,
Andy Shevchenko