Skip to contentSkip to conversation

2.5.45 serial updates

PATCH New Russell King 1 participant 1 message Nov 2, 2002 TTY layer and serial drivers

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 2.5.45 serial updates

Here's some serial updates that're heading in Linus direction shortly. Everything should work as before; this is mostly just cleanups and a couple of bug fixes.

When people report problems with the 8250 autoconfiguration stuff, please enable the autoconfig debug in 8250.c and send the resulting messages for that port - I'm not expecting problems, but this information will be crucial to finding any problem in this area.

<[email protected]> (02/11/02 1.881)
[SERIAL] Set port->type to unknown only when using autoconfig

<[email protected]> (02/11/02 1.880)
[SERIAL] Fix build errors and warnings
- Remove last usage of EVT_WRITE_WAKEUP
- Remove unused label + kfree()
- scratch3 now known as id3

<[email protected]> (02/11/02 1.879)
[SERIAL] Tidy up 8250 port type detection
The original port detection code was one large function with many tests without any clear structure.

This cset cleans this up, splitting out the tests for 8250/16450 vs 16550 vs 16550A vs later ports, and adds comments about why we test what we're testing.

<[email protected]> (02/11/02 1.878)
[SERIAL] Make ALPHA_KLUDGE_MCR more generic for bluetooth modems, etc In addition to the Alpha OUT1/OUT2 kludge, devices like Bluetooth modems connected to serial ports make use of the modem control lines in non-standard ways. Therefore, we implement a more flexible way to allow the modem control outputs to be forced to particular values irrespective of the normal usage of these signals.

<[email protected]> (02/11/02 1.877)
[SERIAL] Fix up formatting of serial names
The tty layer's tty_name requires formatting codes in driver->name for the devfs and non-devfs cases.

<[email protected]> (02/11/02 1.876)
[SERIAL] Fix up 8250 IRQ chain handling
- Unlink port from chain if request_irq fails
- Allow port to define whether we use shared IRQs (this is required for PCMCIA serial cards where the serial card shares the same IRQ as the socket status IRQ.)
- Convert remaining ASYNC_ flags to UPF_ flags

<[email protected]> (02/11/02 1.875)
[SERIAL] Fix two incorrect uses of __FUNCTION__

<[email protected]> (02/11/02 1.874)
[SERIAL] Remove struct pci_board from init_fn
Traditionally, we allocated the private array of port parameters based on the detected board->num_ports, and then called the init_fn with the board pointer (which points into the global table.) Some init_fn implementations modify num_ports, which therefore affects the global table. Unfortunately, this means that if the init_fn increases num_ports (because we have two almost identical cards, the first with a smaller number of ports than the second), we will overwrite memory which hasn't been allocated to us.

This cset no longer passes the board pointer into the init_fn, but instead allows the init_fn to return the number of ports found, or zero to use the default value in board->num_ports, or negative error number.

<[email protected]> (02/11/02 1.873)
[SERIAL] Rename uart_event() to uart_write_wakeup() uart_event() only has one purpose, which is to wake up any pending writers via the line discipline. Rename it to reflect its real functionality, and drop EVT_WRITE_WAKEUP.

drivers/serial/21285.c +1 -5
diff -Nru a/drivers/serial/21285.c b/drivers/serial/21285.c
@@ -171,7 +171,7 @@
 	} while (--count > 0 && !(*CSR_UARTFLG & 0x20));
 
 	if (uart_circ_chars_pending(xmit) < WAKEUP_CHARS)
-		uart_event(port, EVT_WRITE_WAKEUP);
+		uart_write_wakeup(port);
 
 	if (uart_circ_empty(xmit))
 		serial21285_stop_tx(port, 0);
@@ -485,11 +485,7 @@
 static struct uart_driver serial21285_reg = {
 	.owner			= THIS_MODULE,
 	.driver_name		= "ttyFB",
-#ifdef CONFIG_DEVFS_FS
 	.dev_name		= "ttyFB%d",
-#else
-	.dev_name		= "ttyFB",
-#endif
 	.major			= SERIAL_21285_MAJOR,
 	.minor			= SERIAL_21285_MINOR,
 	.nr			= 1,
drivers/serial/8250.c +220 -149

586 lines not on this page · raw message

drivers/serial/8250_cs.c +2 -1
diff -Nru a/drivers/serial/8250_cs.c b/drivers/serial/8250_cs.c
@@ -41,6 +41,7 @@
 #include <linux/timer.h>
 #include <linux/tty.h>
 #include <linux/serial.h>
+#include <linux/serial_core.h>
 #include <linux/major.h>
 #include <linux/workqueue.h>
 #include <asm/io.h>
@@ -306,7 +307,7 @@
 	memset(&serial, 0, sizeof (serial));
 	serial.port = port;
 	serial.irq = irq;
-	serial.flags = ASYNC_SKIP_TEST | ASYNC_SHARE_IRQ;
+	serial.flags = UPF_SKIP_TEST | UPF_SHARE_IRQ;
 	line = register_serial(&serial);
 	if (line < 0) {
 		printk(KERN_NOTICE "serial_cs: register_serial() at 0x%04lx,"
drivers/serial/8250_pci.c +123 -77

366 lines not on this page · raw message

drivers/serial/amba.c +1 -5
diff -Nru a/drivers/serial/amba.c b/drivers/serial/amba.c
@@ -245,7 +245,7 @@
 	} while (--count > 0);
 
 	if (uart_circ_chars_pending(xmit) < WAKEUP_CHARS)
-		uart_event(port, EVT_WRITE_WAKEUP);
+		uart_write_wakeup(port);
 
 	if (uart_circ_empty(xmit))
 		ambauart_stop_tx(port);
@@ -706,11 +706,7 @@
 static struct uart_driver amba_reg = {
 	.owner			= THIS_MODULE,
 	.driver_name		= "ttyAM",
-#ifdef CONFIG_DEVFS_FS
 	.dev_name		= "ttyAM%d",
-#else
-	.dev_name		= "ttyAM",
-#endif
 	.major			= SERIAL_AMBA_MAJOR,
 	.minor			= SERIAL_AMBA_MINOR,
 	.nr			= UART_NR,
drivers/serial/anakin.c +1 -1
diff -Nru a/drivers/serial/anakin.c b/drivers/serial/anakin.c
@@ -161,7 +161,7 @@
 	anakin_transmit_buffer(port);
 
 	if (uart_circ_chars_pending(xmit) < WAKEUP_CHARS)
-		uart_event(port, EVT_WRITE_WAKEUP);
+		uart_write_wakeup(port);
 }
 
 static void
drivers/serial/clps711x.c +3 -10
diff -Nru a/drivers/serial/clps711x.c b/drivers/serial/clps711x.c
@@ -50,14 +50,12 @@
 #define UART_NR		2
 
 #ifndef CONFIG_SERIAL_CLPS711X_OLD_NAME
-#define SERIAL_CLPS711X_NAME	"ttyCL"
 #define SERIAL_CLPS711X_MAJOR	204
 #define SERIAL_CLPS711X_MINOR	40
 #define SERIAL_CLPS711X_NR	UART_NR
 
 #else
 #warning The old names/device number for this driver if compatabity is needed
-#define SERIAL_CLPS711X_NAME    "ttyAM"
 #define SERIAL_CLPS711X_MAJOR   204
 #define SERIAL_CLPS711X_MINOR   16
 #define SERIAL_CLPS711X_NR      UART_NR
@@ -209,7 +207,7 @@
 	} while (--count > 0);
 
 	if (uart_circ_chars_pending(xmit) < WAKEUP_CHARS)
-		uart_event(port, EVT_WRITE_WAKEUP);
+		uart_write_wakeup(port);
 
 	if (uart_circ_empty(xmit))
 		clps711xuart_stop_tx(port);
@@ -545,7 +543,7 @@
 }
 
 static struct console clps711x_console = {
-	.name		= SERIAL_CLPS711X_NAME,
+	.name		= "ttyCL",
 	.write		= clps711xuart_console_write,
 	.device		= clps711xuart_console_device,
 	.setup		= clps711xuart_console_setup,
@@ -565,12 +563,7 @@
 
 static struct uart_driver clps711x_reg = {
 	.driver_name		= "ttyCL",
-#ifdef CONFIG_DEVFS_FS
-	.dev_name		= SERIAL_CLPS711X_NAME,
-#else
-	.dev_name		= SERIAL_CLPS711X_NAME,
-#endif
-
+	.dev_name		= "ttyCL%d",
 	.major			= SERIAL_CLPS711X_MAJOR,
 	.minor			= SERIAL_CLPS711X_MINOR,
 	.nr			= UART_NR,
drivers/serial/core.c +16 -16
diff -Nru a/drivers/serial/core.c b/drivers/serial/core.c
@@ -65,11 +65,9 @@
  * This routine is used by the interrupt handler to schedule processing in
  * the software interrupt portion of the driver.
  */
-void uart_event(struct uart_port *port, int event)
+void uart_write_wakeup(struct uart_port *port)
 {
 	struct uart_info *info = port->info;
-
-	set_bit(0, &info->event);
 	tasklet_schedule(&info->tlet);
 }
 
@@ -112,13 +110,12 @@
 	struct tty_struct *tty;
 
 	tty = info->tty;
-	if (!tty || !test_and_clear_bit(EVT_WRITE_WAKEUP, &info->event))
-		return;
-
-	if ((tty->flags & (1 << TTY_DO_WRITE_WAKEUP)) &&
-	    tty->ldisc.write_wakeup)
-		(tty->ldisc.write_wakeup)(tty);
-	wake_up_interruptible(&tty->write_wait);
+	if (tty) {
+		if ((tty->flags & (1 << TTY_DO_WRITE_WAKEUP)) &&
+		    tty->ldisc.write_wakeup)
+			tty->ldisc.write_wakeup(tty);
+		wake_up_interruptible(&tty->write_wait);
+	}
 }
 
 static inline void
@@ -1981,7 +1978,8 @@
 static inline void
 uart_report_port(struct uart_driver *drv, struct uart_port *port)
 {
-	printk("%s%d at ", drv->dev_name, port->line);
+	printk(drv->dev_name, port->line);
+	printk(" at ");
 	switch (port->iotype) {
 	case UPIO_PORT:
 		printk("I/O 0x%x", port->iobase);
@@ -2005,7 +2003,6 @@
 	state->port = port;
 
 	spin_lock_init(&port->lock);
-	port->type = PORT_UNKNOWN;
 	port->cons = drv->cons;
 	port->info = state->info;
 
@@ -2022,8 +2019,10 @@
 	flags = UART_CONFIG_TYPE;
 	if (port->flags & UPF_AUTO_IRQ)
 		flags |= UART_CONFIG_IRQ;
-	if (port->flags & UPF_BOOT_AUTOCONF)
+	if (port->flags & UPF_BOOT_AUTOCONF) {
+		port->type = PORT_UNKNOWN;
 		port->ops->config_port(port, flags);
+	}
 
 	/*
 	 * Register the port whether it's detected or not.  This allows
@@ -2439,8 +2438,9 @@
 	struct uart_state *state;
 
 	if (line < 0 || line >= drv->nr) {
-		printk(KERN_ERR "Attempt to unregister %s%d\n",
-			drv->dev_name, line);
+		printk(KERN_ERR "Attempt to unregister ");
+		printk(drv->dev_name, line);
+		printk("\n");
 		return;
 	}
 
@@ -2453,7 +2453,7 @@
 	up(&port_sem);
 }
 
-EXPORT_SYMBOL(uart_event);
+EXPORT_SYMBOL(uart_write_wakeup);
 EXPORT_SYMBOL(uart_register_driver);
 EXPORT_SYMBOL(uart_unregister_driver);
 EXPORT_SYMBOL(uart_register_port);
drivers/serial/sa1100.c +3 -7
diff -Nru a/drivers/serial/sa1100.c b/drivers/serial/sa1100.c
@@ -305,7 +305,7 @@
 	}
 
 	if (uart_circ_chars_pending(xmit) < WAKEUP_CHARS)
-		uart_event(&sport->port, EVT_WRITE_WAKEUP);
+		uart_write_wakeup(&sport->port);
 
 	if (uart_circ_empty(xmit))
 		sa1100_stop_tx(&sport->port, 0);
@@ -661,7 +661,7 @@
 void __init sa1100_register_uart(int idx, int port)
 {
 	if (idx >= NR_PORTS) {
-		printk(KERN_ERR __FUNCTION__ ": bad index number %d\n", idx);
+		printk(KERN_ERR "%s: bad index number %d\n", __FUNCTION__, idx);
 		return;
 	}
 
@@ -688,7 +688,7 @@
 		break;
 
 	default:
-		printk(KERN_ERR __FUNCTION__ ": bad port number %d\n", port);
+		printk(KERN_ERR "%s: bad port number %d\n", __FUNCTION__, port);
 	}
 }
 
@@ -827,11 +827,7 @@
 static struct uart_driver sa1100_reg = {
 	.owner			= THIS_MODULE,
 	.driver_name		= "ttySA",
-#ifdef CONFIG_DEVFS_FS
 	.dev_name		= "ttySA%d",
-#else
-	.dev_name		= "ttySA",
-#endif
 	.major			= SERIAL_SA1100_MAJOR,
 	.minor			= MINOR_START,
 	.nr			= NR_PORTS,
drivers/serial/sunsab.c +2 -2
diff -Nru a/drivers/serial/sunsab.c b/drivers/serial/sunsab.c
@@ -266,7 +266,7 @@
 	writeb(SAB82532_CMDR_XF, &up->regs->w.cmdr);
 
 	if (uart_circ_chars_pending(xmit) < WAKEUP_CHARS)
-		uart_event(&up->port, EVT_WRITE_WAKEUP);
+		uart_write_wakeup(&up->port);
 
 	if (uart_circ_empty(xmit))
 		sunsab_stop_tx(&up->port, 0);
@@ -843,7 +843,7 @@
 #ifdef CONFIG_DEVFS_FS
 	.dev_name		= "tts/%d",
 #else
-	.dev_name		= "ttyS",
+	.dev_name		= "ttyS%d",
 #endif
 	.major			= TTY_MAJOR,
 };
drivers/serial/sunsu.c +2 -2
diff -Nru a/drivers/serial/sunsu.c b/drivers/serial/sunsu.c
@@ -431,7 +431,7 @@
 	} while (--count > 0);
 
 	if (uart_circ_chars_pending(xmit) < WAKEUP_CHARS)
-		uart_event(&up->port, EVT_WRITE_WAKEUP);
+		uart_write_wakeup(&up->port);
 
 	if (uart_circ_empty(xmit))
 		sunsu_stop_tx(&up->port, 0);
@@ -1262,7 +1262,7 @@
 #ifdef CONFIG_DEVFS_FS
 	.dev_name		= "tts/%d",
 #else
-	.dev_name		= "ttyS",
+	.dev_name		= "ttyS%d",
 #endif
 	.major			= TTY_MAJOR,
 };
drivers/serial/sunzilog.c +2 -2
diff -Nru a/drivers/serial/sunzilog.c b/drivers/serial/sunzilog.c
@@ -523,7 +523,7 @@
 	up->port.icount.tx++;
 
 	if (uart_circ_chars_pending(xmit) < WAKEUP_CHARS)
-		uart_event(&up->port, EVT_WRITE_WAKEUP);
+		uart_write_wakeup(&up->port);
 
 	if (!uart_circ_empty(xmit))
 		return;
@@ -1003,7 +1003,7 @@
 #ifdef CONFIG_DEVFS_FS
 	.dev_name	=	"ttyS%d",
 #else
-	.dev_name	=	"ttyS",
+	.dev_name	=	"ttyS%d",
 #endif
 	.major		=	TTY_MAJOR,
 };
drivers/serial/uart00.c +1 -1
diff -Nru a/drivers/serial/uart00.c b/drivers/serial/uart00.c
@@ -215,7 +215,7 @@
 	} while (--count > 0);
 
 	if (uart_circ_chars_pending(xmit) < WAKEUP_CHARS)
-		uart_event(port, EVT_WRITE_WAKEUP);
+		uart_write_wakeup(port);
 
 	if (uart_circ_empty(xmit))
 		uart00_stop_tx(port, 0);
include/linux/serial_core.h +6 -4
diff -Nru a/include/linux/serial_core.h b/include/linux/serial_core.h
@@ -154,6 +154,7 @@
 	unsigned int		flags;
 
 #define UPF_HUP_NOTIFY		(1 << 0)
+#define UPF_FOURPORT		(1 << 1)
 #define UPF_SAK			(1 << 2)
 #define UPF_SPD_MASK		(0x1030)
 #define UPF_SPD_HI		(0x0010)
@@ -167,6 +168,9 @@
 #define UPF_LOW_LATENCY		(1 << 13)
 #define UPF_BUGGY_UART		(1 << 14)
 #define UPF_AUTOPROBE		(1 << 15)
+#define UPF_BOOT_ONLYMCA	(1 << 22)
+#define UPF_CONS_FLOW		(1 << 23)
+#define UPF_SHARE_IRQ		(1 << 24)
 #define UPF_BOOT_AUTOCONF	(1 << 28)
 #define UPF_RESOURCES		(1 << 30)
 #define UPF_IOREMAP		(1 << 31)
@@ -247,8 +251,6 @@
 /* number of characters left in xmit buffer before we ask for more */
 #define WAKEUP_CHARS		256
 
-#define EVT_WRITE_WAKEUP	0
-
 struct module;
 struct tty_driver;
 
@@ -269,7 +271,7 @@
 	struct tty_driver	*tty_driver;
 };
 
-void uart_event(struct uart_port *port, int event);
+void uart_write_wakeup(struct uart_port *port);
 struct uart_port *uart_get_console(struct uart_port *ports, int nr,
 				   struct console *c);
 void uart_parse_options(char *options, int *baud, int *parity, int *bits,
@@ -380,7 +382,7 @@
 			if (status) {
 				tty->hw_stopped = 0;
 				port->ops->start_tx(port, 0);
-				uart_event(port, EVT_WRITE_WAKEUP);
+				uart_write_wakeup(port);
 			}
 		} else {
 			if (!status) {
Signature · 2 lines
Russell King ([email protected])                The developer of ARM Linux
             http://www.arm.linux.org.uk/personal/aboutme.html