Skip to contentSkip to conversation

serial: Add an modem status change abstraction

PATCH In review Corey Minyard 1 participant 1 message Apr 26, 2007 TTY layer and serial drivers

lore
Share & tools
lore
#0 lore raw

PATCH 3/8 serial: Add an modem status change abstraction

Subject: serial: Add an modem status change abstraction

Add a uart_msr_change function for reporting when modem status line change, instead of driectly waking up the wait queue.

This is needed for a direct serial interface to be used by IPMI and a common serial console driver (and probably other things like kgdb). In that case, they may need to know about modem status, but since they may be on a polled interface at panic time, a wait queue will not be helpful. This allows the handling of modem status for a direct serial interface to be done in the serial core code.

 drivers/serial/8250.c       |    2 +-
 include/linux/serial_core.h |    6 ++++++
 2 files changed, 7 insertions(+), 1 deletion(-)
drivers/serial/8250.c +1 -1
Index: linux-2.6.21/drivers/serial/8250.c
===================================================================
@@ -1356,7 +1356,7 @@ serial8250_handle_port(struct uart_8250_
 		uart_push(&up->port);
 
 	if (msr_ready)
-		wake_up_interruptible(&up->port.info->delta_msr_wait);
+		uart_msr_change(&up->port);
 
 	if (xmit_ready)
 		uart_write_wakeup(&up->port);
include/linux/serial_core.h +6 -0
Index: linux-2.6.21/include/linux/serial_core.h
===================================================================
@@ -529,6 +529,12 @@ uart_push(struct uart_port *port)
 	tty_flip_buffer_push(port->info->tty);
 }
 
+static inline void
+uart_msr_change(struct uart_port *port)
+{
+	wake_up_interruptible(&port->info->delta_msr_wait);
+}
+
 /*
  *	UART_ENABLE_MS - determine if port should enable modem status irqs
  */