[PATCH] module load updates in ne2k-pci

From: Manfred Spraul (manfreds@colorfullife.com)
Date: Sun Feb 13 2000 - 05:45:52 EST


IIRC I read somewhere that you must call MOD_INC_USE_COUNT after loading
a module, but before sleeping.

I checked the ne2k-pci/8390 driver, and it seems that the following
patch is required:

* during module initialization, request_region() could sleep, thus 8390
must be locked before probing for the card.
* during _open(): request_irq() can sleep, MOD_INC_USE_COUNT must be
called before sleeping.

I've attached a patch.

--
	Manfred

--- 2.3/drivers/net/ne2k-pci.c Thu Feb 10 22:38:59 2000 +++ build-2.3/drivers/net/ne2k-pci.c Sun Feb 13 11:31:48 2000 @@ -135,11 +135,16 @@ if (debug) printk(KERN_INFO "%s", version); + if (load_8390_module("ne2k-pci.c")) + return -EINVAL; + + lock_8390_module(); + if (ne2k_pci_probe()) { printk(KERN_NOTICE "ne2k-pci.c: No useable cards found, driver NOT installed.\n"); + unlock_8390_module(); return -ENODEV; } - lock_8390_module(); return 0; } @@ -304,10 +309,6 @@ outb(0xff, ioaddr + EN0_ISR); /* Ack all intr. */ } - if (load_8390_module("ne2k-pci.c")) { - return 0; - } - /* Read the 16 bytes of station address PROM. We must first initialize registers, similar to NS8390_init(eifdev, 0). We can't reliably read the SAPROM address without this. @@ -393,10 +394,12 @@ static int ne2k_pci_open(struct net_device *dev) { - if (request_irq(dev->irq, ei_interrupt, SA_SHIRQ, dev->name, dev)) + MOD_INC_USE_COUNT; + if (request_irq(dev->irq, ei_interrupt, SA_SHIRQ, dev->name, dev)) { + MOD_DEC_USE_COUNT; return -EAGAIN; + } ei_open(dev); - MOD_INC_USE_COUNT; return 0; }

- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.rutgers.edu Please read the FAQ at http://www.tux.org/lkml/



This archive was generated by hypermail 2b29 : Tue Feb 15 2000 - 21:00:24 EST