patch-2.1.96 linux/drivers/misc/parport_init.c

Next file: linux/drivers/misc/parport_pc.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.95/linux/drivers/misc/parport_init.c linux/drivers/misc/parport_init.c
@@ -20,7 +20,7 @@
 
 #ifndef MODULE
 static int io[PARPORT_MAX+1] __initdata = { [0 ... PARPORT_MAX] = 0 };
-static int irq[PARPORT_MAX] __initdata = { [0 ... PARPORT_MAX-1] = PARPORT_IRQ_NONE };
+static int irq[PARPORT_MAX] __initdata = { [0 ... PARPORT_MAX-1] = PARPORT_IRQ_PROBEONLY };
 static int dma[PARPORT_MAX] __initdata = { [0 ... PARPORT_MAX-1] = PARPORT_DMA_NONE };
 
 extern int parport_pc_init(int *io, int *irq, int *dma);
@@ -30,26 +30,68 @@
 
 __initfunc(void parport_setup(char *str, int *ints))
 {
-	if (ints[0] == 0 || ints[1] == 0) {
-		/* Disable parport if "parport=" or "parport=0" in cmdline */
+	if (ints[0] == 0) {
+		if (str && !strncmp(str, "auto", 4)) {
+			irq[0] = PARPORT_IRQ_AUTO;
+			dma[0] = PARPORT_DMA_AUTO;
+		}
+		else if (str)
+			printk (KERN_ERR "parport: `%s': huh?\n", str);
+		else
+			printk (KERN_ERR "parport: parport=.. what?\n");
+		
+		return;
+	}
+	else if (ints[1] == 0) {
+		/* Disable parport if "parport=0" in cmdline */
 		io[0] = PARPORT_DISABLE; 
 		return;
 	}
+
 	if (parport_setup_ptr < PARPORT_MAX) {
+		char *sep;
 		io[parport_setup_ptr] = ints[1];
-		if (ints[0]>1) {
+		irq[parport_setup_ptr] = PARPORT_IRQ_NONE;
+		dma[parport_setup_ptr] = PARPORT_DMA_NONE;
+		if (ints[0] > 1) {
 			irq[parport_setup_ptr] = ints[2];
-			if (ints[0]>2) dma[parport_setup_ptr] = ints[3];
+			if (ints[0] > 2) {
+				dma[parport_setup_ptr] = ints[3];
+				goto done;
+			}
+
+			if (str == NULL)
+				goto done;
+
+			goto dma_from_str;
 		}
-		parport_setup_ptr++;
-	} else {
-		printk(KERN_ERR "parport=0x%x", ints[1]);
-		if (ints[0]>1) {
-			printk(",%d", ints[2]);
-			if (ints[0]>2) printk(",%d", ints[3]);
+		else if (str == NULL)
+			goto done;
+		else if (!strncmp(str, "auto", 4))
+			irq[parport_setup_ptr] = PARPORT_IRQ_AUTO;
+		else if (strncmp(str, "none", 4) != 0) {
+			printk(KERN_ERR "parport: bad irq `%s'\n", str);
+			return;
 		}
-		printk(" ignored, too many ports.\n");
-	}
+
+		if ((sep = strchr(str, ',')) == NULL) goto done;
+		str = sep+1;
+	dma_from_str:
+		if (!strncmp(str, "auto", 4))
+			dma[parport_setup_ptr] = PARPORT_DMA_AUTO;
+		else if (strncmp(str, "none", 4) != 0) {
+			char *ep;
+			dma[parport_setup_ptr] = simple_strtoul(str, &ep, 0);
+			if (ep == str) {
+				printk(KERN_ERR "parport: bad dma `%s'\n",
+				       str);
+				return;
+			}
+		}
+	done:
+		parport_setup_ptr++;
+	} else
+		printk(KERN_ERR "parport=%s ignored, too many ports\n", str);
 }
 #endif
 
@@ -100,6 +142,7 @@
 EXPORT_SYMBOL(parport_proc_register);
 EXPORT_SYMBOL(parport_proc_unregister);
 EXPORT_SYMBOL(parport_probe_hook);
+EXPORT_SYMBOL(parport_parse_irqs);
 
 void inc_parport_count(void)
 {

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