]> www.infradead.org Git - users/dwmw2/linux.git/commit
serial: core: Acquire nbcon context in port->lock wrapper
authorJohn Ogness <john.ogness@linutronix.de>
Tue, 20 Aug 2024 06:29:40 +0000 (08:35 +0206)
committerPetr Mladek <pmladek@suse.com>
Wed, 21 Aug 2024 12:56:23 +0000 (14:56 +0200)
commit4126f149c48b2ae757d11ea24675f7071ab22ebf
treecc1232bf7cc1b3629c35d3326924c89f93cf6207
parentadf6f37d142e14896115929f3892bbc0a86e25bf
serial: core: Acquire nbcon context in port->lock wrapper

Currently the port->lock wrappers uart_port_lock(),
uart_port_unlock() (and their variants) only lock/unlock
the spin_lock.

If the port is an nbcon console that has implemented the
write_atomic() callback, the wrappers must also acquire/release
the console context and mark the region as unsafe. This allows
general port->lock synchronization to be synchronized against
the nbcon write_atomic() callback.

Note that __uart_port_using_nbcon() relies on the port->lock
being held while a console is added and removed from the
console list (i.e. all uart nbcon drivers *must* take the
port->lock in their device_lock() callbacks).

Signed-off-by: John Ogness <john.ogness@linutronix.de>
Acked-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Reviewed-by: Petr Mladek <pmladek@suse.com>
Link: https://lore.kernel.org/r/20240820063001.36405-15-john.ogness@linutronix.de
Signed-off-by: Petr Mladek <pmladek@suse.com>
include/linux/serial_core.h