diff options
author | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-05-18 18:50:31 +0000 |
---|---|---|
committer | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-05-18 18:50:31 +0000 |
commit | f7bf6055eb1e7ff603f0907b18ece35c72b05302 (patch) | |
tree | 13ac5b481056384a3ccc7979b86a42d208fcacdc /debian/patches-rt/0017-serial-pch-Remove-eg20t_port-lock.patch | |
parent | Merging upstream version 6.8.9. (diff) | |
download | linux-f7bf6055eb1e7ff603f0907b18ece35c72b05302.tar.xz linux-f7bf6055eb1e7ff603f0907b18ece35c72b05302.zip |
Adding debian version 6.8.9-1.debian/6.8.9-1
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'debian/patches-rt/0017-serial-pch-Remove-eg20t_port-lock.patch')
-rw-r--r-- | debian/patches-rt/0017-serial-pch-Remove-eg20t_port-lock.patch | 128 |
1 files changed, 128 insertions, 0 deletions
diff --git a/debian/patches-rt/0017-serial-pch-Remove-eg20t_port-lock.patch b/debian/patches-rt/0017-serial-pch-Remove-eg20t_port-lock.patch new file mode 100644 index 0000000000..9ca34a1034 --- /dev/null +++ b/debian/patches-rt/0017-serial-pch-Remove-eg20t_port-lock.patch @@ -0,0 +1,128 @@ +From: Sebastian Andrzej Siewior <bigeasy@linutronix.de> +Date: Fri, 1 Mar 2024 22:45:30 +0100 +Subject: [PATCH 17/18] serial: pch: Remove eg20t_port::lock. +Origin: https://www.kernel.org/pub/linux/kernel/projects/rt/6.8/older/patches-6.8.2-rt11.tar.xz + +The struct eg20t_port has a spinlock_t which is used for locking while +access I/O of the device. Then there is the uart_portlock which is +sometimes and nests within eg20t_port's lock. + +The uart_port lock is not used while using the struct in +pch_uart_hal_read() which might be okay. Then both locks are used in +pch_console_write() which looks odd especially the double try_lock part. + +All in all it looks like the uart_port's lock could replace eg20t_port's +lock and simplify the code. + +Remove eg20t_port::lock and use uart_port's lock for the lock scope. + +Link: https://lore.kernel.org/r/20240301215246.891055-18-bigeasy@linutronix.de +Signed-off-by: Sebastian Andrzej Siewior <bigeasy@linutronix.de> +--- + drivers/tty/serial/pch_uart.c | 26 ++++++-------------------- + 1 file changed, 6 insertions(+), 20 deletions(-) + +--- a/drivers/tty/serial/pch_uart.c ++++ b/drivers/tty/serial/pch_uart.c +@@ -237,9 +237,6 @@ struct eg20t_port { + + #define IRQ_NAME_SIZE 17 + char irq_name[IRQ_NAME_SIZE]; +- +- /* protect the eg20t_port private structure and io access to membase */ +- spinlock_t lock; + }; + + /** +@@ -1013,7 +1010,7 @@ static irqreturn_t pch_uart_interrupt(in + int next = 1; + u8 msr; + +- spin_lock(&priv->lock); ++ uart_port_lock(&priv->port); + handled = 0; + while (next) { + iid = pch_uart_hal_get_iid(priv); +@@ -1073,7 +1070,7 @@ static irqreturn_t pch_uart_interrupt(in + handled |= (unsigned int)ret; + } + +- spin_unlock(&priv->lock); ++ uart_port_unlock(&priv->port); + return IRQ_RETVAL(handled); + } + +@@ -1184,9 +1181,9 @@ static void pch_uart_break_ctl(struct ua + unsigned long flags; + + priv = container_of(port, struct eg20t_port, port); +- spin_lock_irqsave(&priv->lock, flags); ++ uart_port_lock_irqsave(&priv->port, &flags); + pch_uart_hal_set_break(priv, ctl); +- spin_unlock_irqrestore(&priv->lock, flags); ++ uart_port_unlock_irqrestore(&priv->port, flags); + } + + /* Grab any interrupt resources and initialise any low level driver state. */ +@@ -1336,8 +1333,7 @@ static void pch_uart_set_termios(struct + + baud = uart_get_baud_rate(port, termios, old, 0, port->uartclk / 16); + +- spin_lock_irqsave(&priv->lock, flags); +- uart_port_lock(port); ++ uart_port_lock_irqsave(port, &flags); + + uart_update_timeout(port, termios->c_cflag, baud); + rtn = pch_uart_hal_set_line(priv, baud, parity, bits, stb); +@@ -1350,8 +1346,7 @@ static void pch_uart_set_termios(struct + tty_termios_encode_baud_rate(termios, baud, baud); + + out: +- uart_port_unlock(port); +- spin_unlock_irqrestore(&priv->lock, flags); ++ uart_port_unlock_irqrestore(port, flags); + } + + static const char *pch_uart_type(struct uart_port *port) +@@ -1555,7 +1550,6 @@ pch_console_write(struct console *co, co + { + struct eg20t_port *priv; + unsigned long flags; +- int priv_locked = 1; + int port_locked = 1; + u8 ier; + +@@ -1565,15 +1559,11 @@ pch_console_write(struct console *co, co + + local_irq_save(flags); + if (priv->port.sysrq) { +- /* call to uart_handle_sysrq_char already took the priv lock */ +- priv_locked = 0; + /* serial8250_handle_port() already took the port lock */ + port_locked = 0; + } else if (oops_in_progress) { +- priv_locked = spin_trylock(&priv->lock); + port_locked = uart_port_trylock(&priv->port); + } else { +- spin_lock(&priv->lock); + uart_port_lock(&priv->port); + } + +@@ -1595,8 +1585,6 @@ pch_console_write(struct console *co, co + + if (port_locked) + uart_port_unlock(&priv->port); +- if (priv_locked) +- spin_unlock(&priv->lock); + local_irq_restore(flags); + } + +@@ -1694,8 +1682,6 @@ static struct eg20t_port *pch_uart_init_ + pci_enable_msi(pdev); + pci_set_master(pdev); + +- spin_lock_init(&priv->lock); +- + iobase = pci_resource_start(pdev, 0); + mapbase = pci_resource_start(pdev, 1); + priv->mapbase = mapbase; |