lkml.org 
[lkml]   [2021]   [Oct]   [16]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: [PATCH 2/3] serial: 8250: rename unlock labels
On Fri, Oct 15, 2021 at 01:14:21PM +0200, Johan Hovold wrote:
> Rename a couple of oddly named labels that are used to unlock before
> returning after what they do (rather than after the context they are
> used in) to improve readability.

Initially I had the same thought in mind when was adding the update
clock method because normally I add the GOTO-target-related suffix for
the cleanup path. But in this case I decided to stick with the locally
selected naming scheme, since it also made sense in the meaning: "goto
Out_of_the_Lock". So in case of the autoconfig() method leaving the
"out_lock" label name was reasonable because the code program counter
jumps out of the locked section of the function while the "goto out"
jumps to out of the method itself.

-Serge

>
> Signed-off-by: Johan Hovold <johan@kernel.org>
> ---
> drivers/tty/serial/8250/8250_port.c | 10 +++++-----
> 1 file changed, 5 insertions(+), 5 deletions(-)
>
> diff --git a/drivers/tty/serial/8250/8250_port.c b/drivers/tty/serial/8250/8250_port.c
> index e4dd82fd7c2a..5775cbff8f6e 100644
> --- a/drivers/tty/serial/8250/8250_port.c
> +++ b/drivers/tty/serial/8250/8250_port.c
> @@ -1338,7 +1338,7 @@ static void autoconfig(struct uart_8250_port *up)
> up->tx_loadsz = uart_config[port->type].tx_loadsz;
>
> if (port->type == PORT_UNKNOWN)
> - goto out_lock;
> + goto out_unlock;
>
> /*
> * Reset the UART.
> @@ -1355,7 +1355,7 @@ static void autoconfig(struct uart_8250_port *up)
> else
> serial_out(up, UART_IER, 0);
>
> -out_lock:
> +out_unlock:
> spin_unlock_irqrestore(&port->lock, flags);
>
> /*
> @@ -2714,12 +2714,12 @@ void serial8250_update_uartclk(struct uart_port *port, unsigned int uartclk)
> mutex_lock(&tport->mutex);
>
> if (port->uartclk == uartclk)
> - goto out_lock;
> + goto out_unlock;
>
> port->uartclk = uartclk;
>
> if (!tty_port_initialized(tport))
> - goto out_lock;
> + goto out_unlock;
>
> termios = &tty->termios;
>
> @@ -2737,7 +2737,7 @@ void serial8250_update_uartclk(struct uart_port *port, unsigned int uartclk)
> spin_unlock_irqrestore(&port->lock, flags);
> serial8250_rpm_put(up);
>
> -out_lock:
> +out_unlock:
> mutex_unlock(&tport->mutex);
> up_write(&tty->termios_rwsem);
> tty_kref_put(tty);
> --
> 2.32.0
>

\
 
 \ /
  Last update: 2021-10-16 17:41    [W:0.282 / U:0.044 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site