patch-2.4.0-test2 linux/drivers/pnp/isapnp.c

Next file: linux/drivers/s390/block/dasd.c
Previous file: linux/drivers/pcmcia/yenta.c
Back to the patch index
Back to the overall index

diff -u --recursive --new-file v2.4.0-test1/linux/drivers/pnp/isapnp.c linux/drivers/pnp/isapnp.c
@@ -500,6 +500,7 @@
                                                int dependent, int size)
 {
 	unsigned char tmp[3];
+	int i;
 	struct isapnp_irq *irq, *ptr;
 
 	isapnp_peek(tmp, size);
@@ -526,6 +527,9 @@
 		ptr->next = irq;
 	else
 		(*res)->irq = irq;
+	for (i=0; i<16; i++)
+		if (irq->map & i)
+			pcibios_penalize_isa_irq(i);
 }
 
 /*
@@ -1603,6 +1607,14 @@
 				return 1;
 		}
 	}
+#ifdef CONFIG_PCI
+	if (!isapnp_skip_pci_scan) {
+		pci_for_each_dev(dev) {
+			if (dev->irq == irq)
+				return 1;
+		}
+	}
+#endif
 	if (request_irq(irq, isapnp_test_handler, SA_INTERRUPT, "isapnp", NULL))
 		return 1;
 	free_irq(irq, NULL);
@@ -2059,56 +2071,17 @@
 	if (isapnp_rdp >= 0x203 && isapnp_rdp <= 0x3ff)
 		release_resource(isapnp_rdp_res);
 #ifdef MODULE
+#ifdef CONFIG_PROC_FS
+	isapnp_proc_done();
+#endif
 	while (!list_empty(&isapnp_cards)) {
 		struct list_head *list = isapnp_cards.next;
 		list_del(list);
 		isapnp_free_card(pci_bus_b(list));
 	}
-#ifdef CONFIG_PROC_FS
-	isapnp_proc_done();
-#endif
-#endif
-}
-
-static int __init isapnp_do_reserve_irq(int irq)
-{
-	int i;
-	
-	if (irq < 0 || irq > 15)
-		return -EINVAL;
-	for (i = 0; i < 16; i++) {
-		if (isapnp_reserve_irq[i] == irq)
-			return 0;
-	}
-	for (i = 0; i < 16; i++) {
-		if (isapnp_reserve_irq[i] < 0) {
-			isapnp_reserve_irq[i] = irq;
-#ifdef ISAPNP_DEBUG
-			printk("isapnp: IRQ %i is reserved now.\n", irq);
-#endif
-			return 0;
-		}
-	}
-	return -ENOMEM;
-}
-
-#ifdef CONFIG_PCI
-
-static void __init isapnp_pci_init(void)
-{
-	struct pci_dev *dev;
-
-	pci_for_each_dev(dev) {
-#ifdef ISAPNP_DEBUG
-		printk("isapnp: PCI: reserved IRQ: %i\n", dev->irq);
 #endif
-		if (dev->irq > 0)
-			isapnp_do_reserve_irq(dev->irq);
-	}
 }
 
-#endif /* CONFIG_PCI */
-
 EXPORT_SYMBOL(isapnp_cards);
 EXPORT_SYMBOL(isapnp_devices);
 EXPORT_SYMBOL(isapnp_present);
@@ -2200,10 +2173,6 @@
 	} else {
 		printk("isapnp: No Plug & Play card found\n");
 	}
-#ifdef CONFIG_PCI
-	if (!isapnp_skip_pci_scan)
-		isapnp_pci_init();
-#endif
 #ifdef CONFIG_PROC_FS
 	isapnp_proc_init();
 #endif

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