patch-2.2.0-pre6 linux/drivers/char/tty_io.c

Next file: linux/drivers/isdn/icn/icn.h
Previous file: linux/drivers/char/radio-zoltrix.c
Back to the patch index
Back to the overall index

diff -u --recursive --new-file v2.2.0-pre5/linux/drivers/char/tty_io.c linux/drivers/char/tty_io.c
@@ -866,12 +866,7 @@
 	 * Failures after this point use release_mem to clean up, so 
 	 * there's no need to null out the local pointers.
 	 */
-	driver->table[idx] = tty;	/* FIXME: this is broken and
-	probably causes ^D bug. tty->private_date does not (yet) point
-	to a console, if keypress comes now, await armagedon. 
-
-	also, driver->table is accessed from interrupt for vt case,
-	and this does not look like atomic access at all. */
+	driver->table[idx] = tty;
 	
 	if (!*tp_loc)
 		*tp_loc = tp;
@@ -1846,6 +1841,10 @@
 	int		count;
 	unsigned long flags;
 
+	if (test_bit(TTY_DONT_FLIP, &tty->flags)) {
+		queue_task(&tty->flip.tqueue, &tq_timer);
+		return;
+	}
 	if (tty->flip.buf_num) {
 		cp = tty->flip.char_buf + TTY_FLIPBUF_SIZE;
 		fp = tty->flip.flag_buf + TTY_FLIPBUF_SIZE;
@@ -1872,14 +1871,22 @@
 
 /*
  * Routine which returns the baud rate of the tty
- */
-
-/*
- * This is used to figure out the divisor speeds and the timeouts
+ *
+ * Note that the baud_table needs to be kept in sync with the
+ * include/asm/termbits.h file.
  */
 static int baud_table[] = {
 	0, 50, 75, 110, 134, 150, 200, 300, 600, 1200, 1800, 2400, 4800,
-	9600, 19200, 38400, 57600, 115200, 230400, 460800, 0 };
+	9600, 19200, 38400, 57600, 115200, 230400, 460800,
+#ifdef __sparc__
+	76800, 153600, 307200, 614400, 921600
+#else
+	500000, 576000, 921600, 1000000, 1152000, 1500000, 2000000,
+	2500000, 3000000, 3500000, 4000000
+#endif
+};
+
+static int n_baud_table = sizeof(baud_table)/sizeof(int);
 
 int tty_get_baud_rate(struct tty_struct *tty)
 {
@@ -1890,7 +1897,7 @@
 	i = cflag & CBAUD;
 	if (i & CBAUDEX) {
 		i &= ~CBAUDEX;
-		if (i < 1 || i > 4) 
+		if (i < 1 || i+15 >= n_baud_table) 
 			tty->termios->c_cflag &= ~CBAUDEX;
 		else
 			i += 15;
@@ -1930,6 +1937,7 @@
 	tty->flip.pty_sem = MUTEX;
 	tty->tq_hangup.routine = do_tty_hangup;
 	tty->tq_hangup.data = tty;
+	sema_init(&tty->atomic_read, 1);
 }
 
 /*

FUNET's LINUX-ADM group, linux-adm@nic.funet.fi
TCL-scripts by Sam Shen, slshen@lbl.gov