patch-2.4.7 linux/drivers/char/lp.c

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

diff -u --recursive --new-file v2.4.6/linux/drivers/char/lp.c linux/drivers/char/lp.c
@@ -609,8 +609,6 @@
 
 /* --- initialisation code ------------------------------------- */
 
-#ifdef MODULE
-
 static int parport_nr[LP_NO] = { [0 ... LP_NO-1] = LP_PARPORT_UNSPEC };
 static char *parport[LP_NO] = { NULL,  };
 static int reset = 0;
@@ -618,21 +616,19 @@
 MODULE_PARM(parport, "1-" __MODULE_STRING(LP_NO) "s");
 MODULE_PARM(reset, "i");
 
-#else
-
-static int parport_nr[LP_NO] = { [0 ... LP_NO-1] = LP_PARPORT_UNSPEC };
-static int reset = 0;
-
-static int parport_ptr = 0;
-
-void __init lp_setup(char *str, int *ints)
+#ifndef MODULE
+static int __init lp_setup (char *str)
 {
-	if (!str) {
-		if (ints[0] == 0 || ints[1] == 0) {
+	static int parport_ptr; // initially zero
+	int x;
+
+	if (get_option (&str, &x)) {
+		if (x == 0) {
 			/* disable driver on "lp=" or "lp=0" */
 			parport_nr[0] = LP_PARPORT_OFF;
 		} else {
-			printk(KERN_WARNING "warning: 'lp=0x%x' is deprecated, ignored\n", ints[1]);
+			printk(KERN_WARNING "warning: 'lp=0x%x' is deprecated, ignored\n", x);
+			return 0;
 		}
 	} else if (!strncmp(str, "parport", 7)) {
 		int n = simple_strtoul(str+7, NULL, 10);
@@ -648,8 +644,8 @@
 	} else if (!strcmp(str, "reset")) {
 		reset = 1;
 	}
+	return 1;
 }
-
 #endif
 
 static int lp_register(int nr, struct parport *port)
@@ -782,8 +778,7 @@
 	return 0;
 }
 
-#ifdef MODULE
-int init_module(void)
+static int __init lp_init_module (void)
 {
 	if (parport[0]) {
 		/* The user gave some parameters.  Let's see what they were.  */
@@ -811,7 +806,7 @@
 	return lp_init();
 }
 
-void cleanup_module(void)
+static void lp_cleanup_module (void)
 {
 	unsigned int offset;
 
@@ -829,4 +824,7 @@
 		parport_unregister_device(lp_table[offset].dev);
 	}
 }
-#endif
+
+__setup("lp=", lp_setup);
+module_init(lp_init_module);
+module_exit(lp_cleanup_module);

FUNET's LINUX-ADM group, linux-adm@nic.funet.fi
TCL-scripts by Sam Shen (who was at: slshen@lbl.gov)