[PATCH 2/8] serial: Add a function to abstract the tty code from the drivers

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Subject: serial: Add a function to abstract the tty code from the drivers

Remove the requirement for a serial driver to know about the
tty layer by pulling the tty push into a function in the serial_core.h
file.  Also make the corresponding changes to the 8250 driver.

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).
Since in those cases there is no tty layer, it is best to pull this up
into the serial core and handle not having a tty layer there.  Also,
it seems better if the individual serial drivers didn't need to know
about the tty layer.

Signed-off-by: Corey Minyard <minyard@xxxxxxx>

 drivers/serial/8250.c       |    4 +---
 include/linux/serial_core.h |    7 +++++++
 2 files changed, 8 insertions(+), 3 deletions(-)

Index: linux-2.6.21/drivers/serial/8250.c
===================================================================
--- linux-2.6.21.orig/drivers/serial/8250.c
+++ linux-2.6.21/drivers/serial/8250.c
@@ -32,8 +32,6 @@
 #include <linux/sysrq.h>
 #include <linux/delay.h>
 #include <linux/platform_device.h>
-#include <linux/tty.h>
-#include <linux/tty_flip.h>
 #include <linux/serial_reg.h>
 #include <linux/serial_core.h>
 #include <linux/serial.h>
@@ -1355,7 +1353,7 @@ serial8250_handle_port(struct uart_8250_
 	spin_unlock_irqrestore(&up->port.lock, flags);
 
 	if (recv_ready)
-		tty_flip_buffer_push(up->port.info->tty);
+		uart_push(&up->port);
 
 	if (msr_ready)
 		wake_up_interruptible(&up->port.info->delta_msr_wait);
Index: linux-2.6.21/include/linux/serial_core.h
===================================================================
--- linux-2.6.21.orig/include/linux/serial_core.h
+++ linux-2.6.21/include/linux/serial_core.h
@@ -143,6 +143,7 @@
 #include <linux/spinlock.h>
 #include <linux/sched.h>
 #include <linux/tty.h>
+#include <linux/tty_flip.h>
 #include <linux/mutex.h>
 
 struct uart_port;
@@ -522,6 +523,12 @@ uart_insert_char(struct uart_port *port,
 		tty_insert_flip_char(tty, 0, TTY_OVERRUN);
 }
 
+static inline void
+uart_push(struct uart_port *port)
+{
+	tty_flip_buffer_push(port->info->tty);
+}
+
 /*
  *	UART_ENABLE_MS - determine if port should enable modem status irqs
  */
-
To unsubscribe from this list: send the line "unsubscribe linux-serial" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html

[Index of Archives]     [Kernel Newbies]     [Security]     [Netfilter]     [Bugtraq]     [Linux PPP]     [Linux FS]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Samba]     [Video 4 Linux]     [Linmodem]     [Device Mapper]     [Linux Kernel for ARM]

  Powered by Linux