Re: [PATCH 1/3] serial: Rename vars in uart_get_rs485_config()

From: Andy Shevchenko
Date: Fri Aug 26 2022 - 11:40:41 EST


On Fri, Aug 26, 2022 at 5:50 PM Ilpo Järvinen
<ilpo.jarvinen@xxxxxxxxxxxxxxx> wrote:
>
> Make variable names to match uart_set_rs485_config() ones:
> - rs485 -> rs485_user
> - aux -> rs485

Reviewed-by: Andy Shevchenko <andy.shevchenko@xxxxxxxxx>
(see below)

> Signed-off-by: Ilpo Järvinen <ilpo.jarvinen@xxxxxxxxxxxxxxx>
> ---
> drivers/tty/serial/serial_core.c | 8 ++++----
> 1 file changed, 4 insertions(+), 4 deletions(-)
>
> diff --git a/drivers/tty/serial/serial_core.c b/drivers/tty/serial/serial_core.c
> index 12c87cd201a7..9c1bf36b7a93 100644
> --- a/drivers/tty/serial/serial_core.c
> +++ b/drivers/tty/serial/serial_core.c
> @@ -1408,16 +1408,16 @@ int uart_rs485_config(struct uart_port *port)
> EXPORT_SYMBOL_GPL(uart_rs485_config);
>
> static int uart_get_rs485_config(struct uart_port *port,
> - struct serial_rs485 __user *rs485)
> + struct serial_rs485 __user *rs485_user)
> {
> unsigned long flags;
> - struct serial_rs485 aux;
> + struct serial_rs485 rs485;

At the same time you may order it by "the longest line first".

> spin_lock_irqsave(&port->lock, flags);
> - aux = port->rs485;
> + rs485 = port->rs485;
> spin_unlock_irqrestore(&port->lock, flags);
>
> - if (copy_to_user(rs485, &aux, sizeof(aux)))
> + if (copy_to_user(rs485_user, &rs485, sizeof(rs485)))
> return -EFAULT;
>
> return 0;

--
With Best Regards,
Andy Shevchenko