]> www.infradead.org Git - users/jedix/linux-maple.git/commit
serial: rename local uart_port_lock() -> uart_port_ref_lock()
authorJiri Slaby (SUSE) <jirislaby@kernel.org>
Fri, 25 Apr 2025 11:13:13 +0000 (13:13 +0200)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Fri, 25 Apr 2025 11:46:31 +0000 (13:46 +0200)
commit31e0b7863c9bf97bc3a6d735cb4956c929134a80
treed527e05a2393f30ff2ad24915efd405623c49c86
parent1404d3509c768732be51d0acf8330689936a692a
serial: rename local uart_port_lock() -> uart_port_ref_lock()

uart_port_lock() and uart_port_unlock() are (at the same time) defined
as:
* functions in include/linux/serial_core.h
* macros in drivers/tty/serial/serial_core.c

The former are sane uart port lock wrappers.

The latter _lock() does something completely different: it inspects
a uart_state, obtains a uart_port from it, and increases its reference
count. And if that all succeeded, the port is locked too.

Similarly, the _unlock() counterpart first unlocks and then decrements
the refcount too.

This state is REALLY CONFUSING.

So rename the latter (local .c macros):
* uart_port_lock() -> uart_port_ref_lock(), and
* uart_port_unlock() -> uart_port_unlock_deref().

Now, the forbidden while-at-it part: convert from a macro to an inline
-- do it here as the passed 'flags' have to be pointer to ulong now. So
we avoid doubled changes on identical LOCs.

Signed-off-by: Jiri Slaby (SUSE) <jirislaby@kernel.org>
Link: https://lore.kernel.org/r/20250425111315.1036184-5-jirislaby@kernel.org
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
drivers/tty/serial/serial_core.c