patch-2.4.9 linux/drivers/char/lp.c
Next file: linux/drivers/char/n_r3964.c
Previous file: linux/drivers/char/dz.c
Back to the patch index
Back to the overall index
-  Lines: 34
-  Date:
Sun Aug 12 12:31:28 2001
-  Orig file: 
v2.4.8/linux/drivers/char/lp.c
-  Orig date: 
Wed Jul 25 17:10:19 2001
diff -u --recursive --new-file v2.4.8/linux/drivers/char/lp.c linux/drivers/char/lp.c
@@ -147,6 +147,10 @@
 
 static unsigned int lp_count = 0;
 
+#ifdef CONFIG_LP_CONSOLE
+static struct parport *console_registered; // initially NULL
+#endif /* CONFIG_LP_CONSOLE */
+
 #undef LP_DEBUG
 
 /* --- low-level port access ----------------------------------- */
@@ -674,8 +678,8 @@
 #ifdef CONFIG_LP_CONSOLE
 	if (!nr) {
 		if (port->modes & PARPORT_MODE_SAFEININT) {
-			MOD_INC_USE_COUNT;
 			register_console (&lpcons);
+			console_registered = port;
 			printk (KERN_INFO "lp%d: console ready\n", CONSOLE_LP);
 		} else
 			printk (KERN_ERR "lp%d: cannot run console on %s\n",
@@ -720,6 +724,12 @@
 static void lp_detach (struct parport *port)
 {
 	/* Write this some day. */
+#ifdef CONFIG_LP_CONSOLE
+	if (console_registered == port) {
+		unregister_console (&lpcons);
+		console_registered = NULL;
+	}
+#endif /* CONFIG_LP_CONSOLE */
 }
 
 static struct parport_driver lp_driver = {
FUNET's LINUX-ADM group, linux-adm@nic.funet.fi
TCL-scripts by Sam Shen (who was at: slshen@lbl.gov)