patch-2.1.90 linux/drivers/char/tty_io.c

Next file: linux/drivers/char/tty_ioctl.c
Previous file: linux/drivers/char/serial.c
Back to the patch index
Back to the overall index

diff -u --recursive --new-file v2.1.89/linux/drivers/char/tty_io.c linux/drivers/char/tty_io.c
@@ -87,8 +87,8 @@
 #include <linux/vt_kern.h>
 #include <linux/selection.h>
 
-#ifdef CONFIG_KERNELD
-#include <linux/kerneld.h>
+#ifdef CONFIG_KMOD
+#include <linux/kmod.h>
 #endif
 
 #define CONSOLE_DEV MKDEV(TTY_MAJOR,0)
@@ -127,11 +127,9 @@
 #endif
 
 /*
- * These two routines return the name of tty.  tty_name() should NOT
- * be used in interrupt drivers, since it's not re-entrant.  Use
- * _tty_name() instead.
+ * This routine returns the name of tty.
  */
-char *_tty_name(struct tty_struct *tty, char *buf)
+char *tty_name(struct tty_struct *tty, char *buf)
 {
 	if (tty)
 		sprintf(buf, "%s%d", tty->driver.name,
@@ -142,13 +140,6 @@
 	return buf;
 }
 
-char *tty_name(struct tty_struct *tty)
-{
-	static char buf[64];
-
-	return(_tty_name(tty, buf));
-}
-
 inline int tty_paranoia_check(struct tty_struct *tty, kdev_t device,
 			      const char *routine)
 {
@@ -213,11 +204,13 @@
 {
 	int	retval = 0;
 	struct	tty_ldisc o_ldisc;
+	char buf[64];
 
 	if ((ldisc < N_TTY) || (ldisc >= NR_LDISCS))
 		return -EINVAL;
-#ifdef CONFIG_KERNELD
+#ifdef CONFIG_KMOD
 	/* Eduardo Blanco <ejbs@cs.cs.com.uy> */
+	/* Cyrus Durgin <cider@speakeasy.org> */
 	if (!(ldiscs[ldisc].flags & LDISC_FLAG_DEFINED)) {
 		char modname [20];
 		sprintf(modname, "tty-ldisc-%d", ldisc);
@@ -254,7 +247,7 @@
 				if (r < 0)
 					panic("Couldn't open N_TTY ldisc for "
 					      "%s --- error %d.",
-					      tty_name(tty), r);
+					      tty_name(tty, buf), r);
 			}
 		}
 	}
@@ -455,7 +448,9 @@
 void tty_hangup(struct tty_struct * tty)
 {
 #ifdef TTY_DEBUG_HANGUP
-	printk("%s hangup...\n", tty_name(tty));
+	char	buf[64];
+	
+	printk("%s hangup...\n", tty_name(tty, buf));
 #endif
 	queue_task(&tty->tq_hangup, &tq_timer);
 }
@@ -463,7 +458,9 @@
 void tty_vhangup(struct tty_struct * tty)
 {
 #ifdef TTY_DEBUG_HANGUP
-	printk("%s vhangup...\n", tty_name(tty));
+	char	buf[64];
+
+	printk("%s vhangup...\n", tty_name(tty, buf));
 #endif
 	do_tty_hangup((void *) tty);
 }
@@ -950,6 +947,7 @@
 	struct tty_struct *tty, *o_tty;
 	int	pty_master, tty_closing, o_tty_closing, do_sleep;
 	int	idx;
+	char	buf[64];
 	
 	tty = (struct tty_struct *)filp->private_data;
 	if (tty_paranoia_check(tty, filp->f_dentry->d_inode->i_rdev, "release_dev"))
@@ -990,7 +988,7 @@
 #endif
 
 #ifdef TTY_DEBUG_HANGUP
-	printk("release_dev of %s (tty count=%d)...", tty_name(tty),
+	printk("release_dev of %s (tty count=%d)...", tty_name(tty, buf),
 	       tty->count);
 #endif
 
@@ -1068,7 +1066,7 @@
 			break;
 
 		printk("release_dev: %s: read/write wait queue active!\n",
-		       tty_name(tty));
+		       tty_name(tty, buf));
 		schedule();
 	}	
 
@@ -1084,13 +1082,13 @@
 	if (pty_master) {
 		if (--o_tty->count < 0) {
 			printk("release_dev: bad pty slave count (%d) for %s\n",
-			       o_tty->count, tty_name(o_tty));
+			       o_tty->count, tty_name(o_tty, buf));
 			o_tty->count = 0;
 		}
 	}
 	if (--tty->count < 0) {
 		printk("release_dev: bad tty->count (%d) for %s\n",
-		       tty->count, tty_name(tty));
+		       tty->count, tty_name(tty, buf));
 		tty->count = 0;
 	}
 
@@ -1178,6 +1176,7 @@
 	int noctty, retval;
 	kdev_t device;
 	unsigned short saved_flags;
+	char	buf[64];
 
 	saved_flags = filp->f_flags;
 retry_open:
@@ -1245,7 +1244,7 @@
 	    tty->driver.subtype == PTY_TYPE_MASTER)
 		noctty = 1;
 #ifdef TTY_DEBUG_HANGUP
-	printk("opening %s...", tty_name(tty));
+	printk("opening %s...", tty_name(tty, buf));
 #endif
 	if (tty->driver.open)
 		retval = tty->driver.open(tty, filp);
@@ -1258,7 +1257,8 @@
 
 	if (retval) {
 #ifdef TTY_DEBUG_HANGUP
-		printk("error %d in opening %s...", retval, tty_name(tty));
+		printk("error %d in opening %s...", retval,
+		       tty_name(tty, buf));
 #endif
 
 		release_dev(filp);
@@ -1281,6 +1281,11 @@
 		current->tty_old_pgrp = 0;
 		tty->session = current->session;
 		tty->pgrp = current->pgrp;
+	}
+	if ((tty->driver.type == TTY_DRIVER_TYPE_SERIAL) &&
+	    (tty->driver.subtype == SERIAL_TYPE_CALLOUT)) {
+		printk("Warning, %s opened, is a deprecated tty "
+		       "callout device\n", tty_name(tty, buf));
 	}
 	return 0;
 }

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