summaryrefslogtreecommitdiff
path: root/drivers/tty
diff options
context:
space:
mode:
authorJiri Slaby <jslaby@suse.cz>2022-09-27 13:18:19 +0200
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2022-09-30 14:58:46 +0200
commit12f3a5eba3c4eb0031d7db36773579e517459a41 (patch)
treef1d8bafa2e129938bb337684d69d6a94c91bac8a /drivers/tty
parent523f54ed3be7e23340b1c43921e39fddfe149c09 (diff)
downloadlinux-rpi-12f3a5eba3c4eb0031d7db36773579e517459a41.tar.gz
linux-rpi-12f3a5eba3c4eb0031d7db36773579e517459a41.tar.bz2
linux-rpi-12f3a5eba3c4eb0031d7db36773579e517459a41.zip
tty: serial: do unlock on a common path in altera_jtaguart_console_putc()
port->lock is unlocked in each branch in altera_jtaguart_console_putc(), so do it before the "if". "status" needs not be under the lock, as the register was already read. Cc: Tobias Klauser <tklauser@distanz.ch> Signed-off-by: Jiri Slaby <jslaby@suse.cz> Reviewed-by: Ilpo Järvinen <ilpo.jarvinen@linux.intel.com> Acked-by: Tobias Klauser <tklauser@distanz.ch> Link: https://lore.kernel.org/r/20220927111819.18516-4-jslaby@suse.cz Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Diffstat (limited to 'drivers/tty')
-rw-r--r--drivers/tty/serial/altera_jtaguart.c5
1 files changed, 3 insertions, 2 deletions
diff --git a/drivers/tty/serial/altera_jtaguart.c b/drivers/tty/serial/altera_jtaguart.c
index ac8ce418de36..c2d154d78e54 100644
--- a/drivers/tty/serial/altera_jtaguart.c
+++ b/drivers/tty/serial/altera_jtaguart.c
@@ -310,11 +310,12 @@ static void altera_jtaguart_console_putc(struct uart_port *port, unsigned char c
spin_lock_irqsave(&port->lock, flags);
while (!altera_jtaguart_tx_space(port, &status)) {
+ spin_unlock_irqrestore(&port->lock, flags);
+
if ((status & ALTERA_JTAGUART_CONTROL_AC_MSK) == 0) {
- spin_unlock_irqrestore(&port->lock, flags);
return; /* no connection activity */
}
- spin_unlock_irqrestore(&port->lock, flags);
+
cpu_relax();
spin_lock_irqsave(&port->lock, flags);
}