lkml.org 
[lkml]   [2000]   [Feb]   [13]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
Patch in this message
/
Date
From
Subject[PATCH] module load updates in ne2k-pci
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;
}
\
 
 \ /
  Last update: 2005-03-22 13:56    [W:0.230 / U:0.056 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site