mirror of
https://github.com/OpenVoiceOS/OpenVoiceOS
synced 2025-06-05 22:19:21 +02:00
[All] {WIP} The big bump to buildroot 2024.02.x
This commit is contained in:
@ -0,0 +1,124 @@
|
||||
From ad6ee8430287f4d453bdbe0870c897f3568cb50f Mon Sep 17 00:00:00 2001
|
||||
From: Thomas Gleixner <tglx@linutronix.de>
|
||||
Date: Thu, 14 Sep 2023 20:43:38 +0206
|
||||
Subject: [PATCH 047/196] serial: atmel: Use port lock wrappers
|
||||
|
||||
When a serial port is used for kernel console output, then all
|
||||
modifications to the UART registers which are done from other contexts,
|
||||
e.g. getty, termios, are interference points for the kernel console.
|
||||
|
||||
So far this has been ignored and the printk output is based on the
|
||||
principle of hope. The rework of the console infrastructure which aims to
|
||||
support threaded and atomic consoles, requires to mark sections which
|
||||
modify the UART registers as unsafe. This allows the atomic write function
|
||||
to make informed decisions and eventually to restore operational state. It
|
||||
also allows to prevent the regular UART code from modifying UART registers
|
||||
while printk output is in progress.
|
||||
|
||||
All modifications of UART registers are guarded by the UART port lock,
|
||||
which provides an obvious synchronization point with the console
|
||||
infrastructure.
|
||||
|
||||
To avoid adding this functionality to all UART drivers, wrap the
|
||||
spin_[un]lock*() invocations for uart_port::lock into helper functions
|
||||
which just contain the spin_[un]lock*() invocations for now. In a
|
||||
subsequent step these helpers will gain the console synchronization
|
||||
mechanisms.
|
||||
|
||||
Converted with coccinelle. No functional change.
|
||||
|
||||
Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
|
||||
Signed-off-by: John Ogness <john.ogness@linutronix.de>
|
||||
Link: https://lore.kernel.org/r/20230914183831.587273-22-john.ogness@linutronix.de
|
||||
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
|
||||
Signed-off-by: Sebastian Andrzej Siewior <bigeasy@linutronix.de>
|
||||
---
|
||||
drivers/tty/serial/atmel_serial.c | 24 ++++++++++++------------
|
||||
1 file changed, 12 insertions(+), 12 deletions(-)
|
||||
|
||||
diff --git a/drivers/tty/serial/atmel_serial.c b/drivers/tty/serial/atmel_serial.c
|
||||
index 88cdafa5ac54..1946fafc3f3e 100644
|
||||
--- a/drivers/tty/serial/atmel_serial.c
|
||||
+++ b/drivers/tty/serial/atmel_serial.c
|
||||
@@ -861,7 +861,7 @@ static void atmel_complete_tx_dma(void *arg)
|
||||
struct dma_chan *chan = atmel_port->chan_tx;
|
||||
unsigned long flags;
|
||||
|
||||
- spin_lock_irqsave(&port->lock, flags);
|
||||
+ uart_port_lock_irqsave(port, &flags);
|
||||
|
||||
if (chan)
|
||||
dmaengine_terminate_all(chan);
|
||||
@@ -893,7 +893,7 @@ static void atmel_complete_tx_dma(void *arg)
|
||||
atmel_port->tx_done_mask);
|
||||
}
|
||||
|
||||
- spin_unlock_irqrestore(&port->lock, flags);
|
||||
+ uart_port_unlock_irqrestore(port, flags);
|
||||
}
|
||||
|
||||
static void atmel_release_tx_dma(struct uart_port *port)
|
||||
@@ -1711,9 +1711,9 @@ static void atmel_tasklet_rx_func(struct tasklet_struct *t)
|
||||
struct uart_port *port = &atmel_port->uart;
|
||||
|
||||
/* The interrupt handler does not take the lock */
|
||||
- spin_lock(&port->lock);
|
||||
+ uart_port_lock(port);
|
||||
atmel_port->schedule_rx(port);
|
||||
- spin_unlock(&port->lock);
|
||||
+ uart_port_unlock(port);
|
||||
}
|
||||
|
||||
static void atmel_tasklet_tx_func(struct tasklet_struct *t)
|
||||
@@ -1723,9 +1723,9 @@ static void atmel_tasklet_tx_func(struct tasklet_struct *t)
|
||||
struct uart_port *port = &atmel_port->uart;
|
||||
|
||||
/* The interrupt handler does not take the lock */
|
||||
- spin_lock(&port->lock);
|
||||
+ uart_port_lock(port);
|
||||
atmel_port->schedule_tx(port);
|
||||
- spin_unlock(&port->lock);
|
||||
+ uart_port_unlock(port);
|
||||
}
|
||||
|
||||
static void atmel_init_property(struct atmel_uart_port *atmel_port,
|
||||
@@ -2175,7 +2175,7 @@ static void atmel_set_termios(struct uart_port *port,
|
||||
} else
|
||||
mode |= ATMEL_US_PAR_NONE;
|
||||
|
||||
- spin_lock_irqsave(&port->lock, flags);
|
||||
+ uart_port_lock_irqsave(port, &flags);
|
||||
|
||||
port->read_status_mask = ATMEL_US_OVRE;
|
||||
if (termios->c_iflag & INPCK)
|
||||
@@ -2377,22 +2377,22 @@ static void atmel_set_termios(struct uart_port *port,
|
||||
else
|
||||
atmel_disable_ms(port);
|
||||
|
||||
- spin_unlock_irqrestore(&port->lock, flags);
|
||||
+ uart_port_unlock_irqrestore(port, flags);
|
||||
}
|
||||
|
||||
static void atmel_set_ldisc(struct uart_port *port, struct ktermios *termios)
|
||||
{
|
||||
if (termios->c_line == N_PPS) {
|
||||
port->flags |= UPF_HARDPPS_CD;
|
||||
- spin_lock_irq(&port->lock);
|
||||
+ uart_port_lock_irq(port);
|
||||
atmel_enable_ms(port);
|
||||
- spin_unlock_irq(&port->lock);
|
||||
+ uart_port_unlock_irq(port);
|
||||
} else {
|
||||
port->flags &= ~UPF_HARDPPS_CD;
|
||||
if (!UART_ENABLE_MS(port, termios->c_cflag)) {
|
||||
- spin_lock_irq(&port->lock);
|
||||
+ uart_port_lock_irq(port);
|
||||
atmel_disable_ms(port);
|
||||
- spin_unlock_irq(&port->lock);
|
||||
+ uart_port_unlock_irq(port);
|
||||
}
|
||||
}
|
||||
}
|
||||
--
|
||||
2.43.2
|
||||
|
Reference in New Issue
Block a user