[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <Y3PBuWL/3qihQJxj@alley>
Date: Tue, 15 Nov 2022 17:43:37 +0100
From: Petr Mladek <pmladek@...e.com>
To: John Ogness <john.ogness@...utronix.de>
Cc: Sergey Senozhatsky <senozhatsky@...omium.org>,
Steven Rostedt <rostedt@...dmis.org>,
Thomas Gleixner <tglx@...utronix.de>,
linux-kernel@...r.kernel.org,
Greg Kroah-Hartman <gregkh@...uxfoundation.org>,
Jiri Slaby <jirislaby@...nel.org>,
linux-serial@...r.kernel.org,
Linux-sh list <linux-sh@...r.kernel.org>,
Linux-Renesas <linux-renesas-soc@...r.kernel.org>,
Geert Uytterhoeven <geert+renesas@...der.be>
Subject: Re: [PATCH printk v4 39/39] tty: serial: sh-sci: use setup()
callback for early console
On Mon 2022-11-14 17:35:32, John Ogness wrote:
> When setting up the early console, the setup() callback of the
> regular console is used. It is called manually before registering
> the early console instead of providing a setup() callback for the
> early console. This is probably because the early setup needs a
> different @options during the early stage.
>
> The issue here is that the setup() callback is called without the
> console_list_lock held and functions such as uart_set_options()
> expect that.
>
> Rather than manually calling the setup() function before registering,
> provide an early console setup() callback that will use the different
> early options. This ensures that the error checking, ordering, and
> locking context when setting up the early console are correct.
>
> Since this early console can only be registered via the earlyprintk=
> parameter, the @options argument of the setup() callback will always
> be NULL. Rather than simply ignoring the argument, add a WARN_ON()
> to get our attention in case the setup() callback semantics should
> change in the future.
>
> Note that technically the current implementation works because it is
> only used in early boot. And since the early console setup is
> performed before registering, it cannot race with anything and thus
> does not need any locking. However, longterm maintenance is easier
> when drivers rely on the subsystem API rather than manually
> implementing steps that could cause breakage in the future.
>
> Signed-off-by: John Ogness <john.ogness@...utronix.de>
> Reviewed-by: Geert Uytterhoeven <geert+renesas@...der.be>
Reviewed-by: Petr Mladek <pmladek@...e.com>
Best Regards,
Petr
Powered by blists - more mailing lists