Re: [PATCH v6 5/6] serial: core: Handle serial console options

From: Andy Shevchenko
Date: Tue Feb 13 2024 - 10:57:11 EST


On Tue, Feb 13, 2024 at 10:45:12AM +0200, Tony Lindgren wrote:
> In order to start moving the serial console quirks out of console_setup(),
> let's add parsing for the quirks to the serial core layer. We can use
> serial_base_add_one_prefcon() to handle the quirks.
>
> 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 handle the
> sparc quirk directly.

..

> +static int serial_base_add_sparc_console(const char *dev_name, int idx)
> +{
> + const char *name = NULL;

Seems like redundant assignment.

> + switch (idx) {
> + case 0:
> + name = "ttya";
> + break;
> + case 1:
> + name = "ttyb";
> + break;
> + default:
> + return 0;
> + }
> +
> + return serial_base_add_one_prefcon(name, dev_name, idx);
> +}

..

> + /* Handle ttyS specific options */
> + if (str_has_prefix(name, "ttyS")) {

Recently I have learnt that we have strstarts() which returns boolean and suits
in cases like this. If you send a new version, you could switch to it.

> + }

--
With Best Regards,
Andy Shevchenko