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

Next file: linux/drivers/char/vt.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.96/linux/drivers/char/tty_io.c linux/drivers/char/tty_io.c
@@ -131,12 +131,13 @@
 /*
  * This routine returns the name of tty.
  */
+#define TTY_NUMBER(tty) (MINOR((tty)->device) - (tty)->driver.minor_start + \
+			 (tty)->driver.name_base)
+	
 char *tty_name(struct tty_struct *tty, char *buf)
 {
 	if (tty)
-		sprintf(buf, "%s%d", tty->driver.name,
-			MINOR(tty->device) - tty->driver.minor_start +
-			tty->driver.name_base);
+		sprintf(buf, "%s%d", tty->driver.name, TTY_NUMBER(tty));
 	else
 		strcpy(buf, "NULL tty");
 	return buf;
@@ -1287,9 +1288,17 @@
 		tty->pgrp = current->pgrp;
 	}
 	if ((tty->driver.type == TTY_DRIVER_TYPE_SERIAL) &&
-	    (tty->driver.subtype == SERIAL_TYPE_CALLOUT)) {
-		printk(KERN_INFO "Warning, %s opened, is a deprecated tty "
-		       "callout device\n", tty_name(tty, buf));
+	    (tty->driver.subtype == SERIAL_TYPE_CALLOUT) &&
+	    (tty->count == 1)) {
+		static int nr_warns = 0;
+		if (nr_warns < 5) {
+			printk(KERN_WARNING "tty_io.c: "
+				"process %d (%s) used obsolete /dev/%s - " 
+				"update software to use /dev/ttyS%d\n",
+				current->pid, current->comm, 
+				tty_name(tty, buf), TTY_NUMBER(tty));
+			nr_warns++;
+		}
 	}
 	return 0;
 }

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