Re: [PATCH 01/36] serial: Add uart_rs485_config()
From: Lukas Wunner
Date: Sat Jun 25 2022 - 16:19:18 EST
On Mon, Jun 06, 2022 at 01:03:58PM +0300, Ilpo Järvinen wrote:
> A few serial drivers make a call to rs485_config() themselves (all
> these seem to relate to init). Convert them all to use a common helper
> which makes it easy to make adjustments on tasks related to it as
> serial_rs485 struct sanitization is going to be added.
[...]
--- a/drivers/tty/serial/serial_core.c
> +++ b/drivers/tty/serial/serial_core.c
> @@ -1276,6 +1276,12 @@ static int uart_get_icount(struct tty_struct *tty,
> return 0;
> }
>
> +int uart_rs485_config(struct uart_port *port)
> +{
> + return port->rs485_config(port, &port->rs485);
> +}
> +EXPORT_SYMBOL_GPL(uart_rs485_config);
Why doesn't this helper acquire the port spinlock, unlike
uart_set_rs485_config()? Is this safe? Do all callers hold the lock?
Do we need an assertion to verify the lock is held?
Thanks,
Lukas