lkml.org 
[lkml]   [2000]   [Aug]   [27]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
Patch in this message
/
Date
From
Subject[patch] MOD_INC_USE 1st in dev->open for 8390 drvrs.
The following patch makes sure MOD_INC_USE_COUNT is done 1st up in the
dev->open in the 8390 based network drivers, with MOD_DEC_USE_COUNT put
in any failure paths.

BTW, I like the idea of mkdir drivers/net/8390/ but see no reason why
it can't wait until 2.5.x

Paul.

diff -u drivers/net-old/3c503.c drivers/net/3c503.c
--- drivers/net-old/3c503.c Wed Jun 28 11:38:14 2000
+++ drivers/net/3c503.c Sat Aug 26 16:18:32 2000
@@ -333,6 +333,7 @@
el2_open(struct net_device *dev)
{

+ MOD_INC_USE_COUNT;
if (dev->irq < 2) {
int irqlist[] = {5, 9, 3, 4, 0};
int *irqp = irqlist;
@@ -351,17 +352,18 @@
} while (*++irqp);
if (*irqp == 0) {
outb(EGACFR_IRQOFF, E33G_GACFR); /* disable interrupts. */
+ MOD_DEC_USE_COUNT;
return -EAGAIN;
}
} else {
if (request_irq(dev->irq, ei_interrupt, 0, ei_status.name, dev)) {
+ MOD_DEC_USE_COUNT;
return -EAGAIN;
}
}

el2_init_card(dev);
ei_open(dev);
- MOD_INC_USE_COUNT;
return 0;
}

diff -u drivers/net-old/ac3200.c drivers/net/ac3200.c
--- drivers/net-old/ac3200.c Wed Jun 28 11:38:16 2000
+++ drivers/net/ac3200.c Sat Aug 26 16:29:53 2000
@@ -256,17 +256,19 @@

static int ac_open(struct net_device *dev)
{
+ MOD_INC_USE_COUNT;
+
#ifdef notyet
/* Someday we may enable the IRQ and shared memory here. */
int ioaddr = dev->base_addr;

- if (request_irq(dev->irq, ei_interrupt, 0, "ac3200", dev))
+ if (request_irq(dev->irq, ei_interrupt, 0, "ac3200", dev)) {
+ MOD_DEC_USE_COUNT;
return -EAGAIN;
+ }
#endif

ei_open(dev);
-
- MOD_INC_USE_COUNT;

return 0;
}
diff -u drivers/net-old/apne.c drivers/net/apne.c
--- drivers/net-old/apne.c Wed Jun 28 11:38:16 2000
+++ drivers/net/apne.c Sat Aug 26 16:25:56 2000
@@ -337,8 +337,8 @@
static int
apne_open(struct net_device *dev)
{
- ei_open(dev);
MOD_INC_USE_COUNT;
+ ei_open(dev);
return 0;
}

diff -u drivers/net-old/ariadne2.c drivers/net/ariadne2.c
--- drivers/net-old/ariadne2.c Wed Jun 28 11:38:17 2000
+++ drivers/net/ariadne2.c Sat Aug 26 16:26:29 2000
@@ -219,8 +219,8 @@

static int ariadne2_open(struct net_device *dev)
{
- ei_open(dev);
MOD_INC_USE_COUNT;
+ ei_open(dev);
return 0;
}

diff -u drivers/net-old/e2100.c drivers/net/e2100.c
--- drivers/net-old/e2100.c Wed Jun 28 11:38:20 2000
+++ drivers/net/e2100.c Sat Aug 26 16:23:53 2000
@@ -255,8 +255,10 @@
{
short ioaddr = dev->base_addr;

+ MOD_INC_USE_COUNT;
if (request_irq(dev->irq, ei_interrupt, 0, "e2100", dev)) {
- return -EBUSY;
+ MOD_DEC_USE_COUNT;
+ return -EAGAIN;
}

/* Set the interrupt line and memory base on the hardware. */
@@ -269,7 +271,6 @@
outb(0, ioaddr + E21_ASIC + ((dev->mem_start >> 17) & 7));

ei_open(dev);
- MOD_INC_USE_COUNT;
return 0;
}

diff -u drivers/net-old/es3210.c drivers/net/es3210.c
--- drivers/net-old/es3210.c Wed Jun 28 11:38:21 2000
+++ drivers/net/es3210.c Sat Aug 26 16:20:58 2000
@@ -356,9 +356,9 @@

static int es_open(struct net_device *dev)
{
- ei_open(dev);
-
MOD_INC_USE_COUNT;
+
+ ei_open(dev);

return 0;
}
diff -u drivers/net-old/hp-plus.c drivers/net/hp-plus.c
--- drivers/net-old/hp-plus.c Wed Jun 28 11:38:23 2000
+++ drivers/net/hp-plus.c Sat Aug 26 16:24:35 2000
@@ -260,7 +260,9 @@
int ioaddr = dev->base_addr - NIC_OFFSET;
int option_reg;

+ MOD_INC_USE_COUNT;
if (request_irq(dev->irq, ei_interrupt, 0, "hp-plus", dev)) {
+ MOD_DEC_USE_COUNT;
return -EAGAIN;
}

@@ -279,7 +281,6 @@
outw(Perf_Page, ioaddr + HP_PAGING);

ei_open(dev);
- MOD_INC_USE_COUNT;
return 0;
}

diff -u drivers/net-old/hp.c drivers/net/hp.c
--- drivers/net-old/hp.c Wed Jun 28 11:38:23 2000
+++ drivers/net/hp.c Sat Aug 26 16:24:05 2000
@@ -214,8 +214,8 @@
static int
hp_open(struct net_device *dev)
{
- ei_open(dev);
MOD_INC_USE_COUNT;
+ ei_open(dev);
return 0;
}

diff -u drivers/net-old/lne390.c drivers/net/lne390.c
--- drivers/net-old/lne390.c Wed Jun 28 11:38:23 2000
+++ drivers/net/lne390.c Sat Aug 26 16:20:32 2000
@@ -351,8 +351,8 @@

static int lne390_open(struct net_device *dev)
{
- ei_open(dev);
MOD_INC_USE_COUNT;
+ ei_open(dev);
return 0;
}

diff -u drivers/net-old/ne.c drivers/net/ne.c
--- drivers/net-old/ne.c Tue Jul 11 02:29:10 2000
+++ drivers/net/ne.c Sat Aug 26 16:21:47 2000
@@ -553,8 +553,8 @@

static int ne_open(struct net_device *dev)
{
- ei_open(dev);
MOD_INC_USE_COUNT;
+ ei_open(dev);
return 0;
}

diff -u drivers/net-old/ne2.c drivers/net/ne2.c
--- drivers/net-old/ne2.c Wed Jun 28 11:38:25 2000
+++ drivers/net/ne2.c Sat Aug 26 16:21:38 2000
@@ -372,8 +372,8 @@

static int ne_open(struct net_device *dev)
{
- ei_open(dev);
MOD_INC_USE_COUNT;
+ ei_open(dev);
return 0;
}

diff -u drivers/net-old/ne3210.c drivers/net/ne3210.c
--- drivers/net-old/ne3210.c Wed Jun 28 11:38:25 2000
+++ drivers/net/ne3210.c Sat Aug 26 16:21:12 2000
@@ -342,8 +342,8 @@

static int ne3210_open(struct net_device *dev)
{
- ei_open(dev);
MOD_INC_USE_COUNT;
+ ei_open(dev);
return 0;
}

diff -u drivers/net-old/oaknet.c drivers/net/oaknet.c
--- drivers/net-old/oaknet.c Wed Jun 28 11:38:25 2000
+++ drivers/net/oaknet.c Sat Aug 26 16:27:41 2000
@@ -237,8 +237,9 @@
static int
oaknet_open(struct net_device *dev)
{
- int status = ei_open(dev);
+ int status;
MOD_INC_USE_COUNT;
+ status = ei_open(dev);
return (status);
}

diff -u drivers/net-old/smc-mca.c drivers/net/smc-mca.c
--- drivers/net-old/smc-mca.c Wed Jun 28 11:38:27 2000
+++ drivers/net/smc-mca.c Sat Aug 26 16:22:51 2000
@@ -323,8 +323,11 @@
{
int ioaddr = dev->base_addr - ULTRA_NIC_OFFSET; /* ASIC addr */

- if (request_irq(dev->irq, ei_interrupt, 0, ei_status.name, dev))
+ MOD_INC_USE_COUNT;
+ if (request_irq(dev->irq, ei_interrupt, 0, ei_status.name, dev)) {
+ MOD_DEC_USE_COUNT;
return -EAGAIN;
+ }

outb(ULTRA_MEMENB, ioaddr); /* Enable memory */
outb(0x80, ioaddr + 5); /* ??? */
@@ -340,7 +343,6 @@
*/

ei_open(dev);
- MOD_INC_USE_COUNT;
return 0;
}

diff -u drivers/net-old/smc-ultra.c drivers/net/smc-ultra.c
--- drivers/net-old/smc-ultra.c Wed Jun 28 11:38:27 2000
+++ drivers/net/smc-ultra.c Sat Aug 26 16:15:36 2000
@@ -253,8 +253,11 @@
unsigned char irq2reg[] = {0, 0, 0x04, 0x08, 0, 0x0C, 0, 0x40,
0, 0x04, 0x44, 0x48, 0, 0, 0, 0x4C, };

- if (request_irq(dev->irq, ei_interrupt, 0, ei_status.name, dev))
+ MOD_INC_USE_COUNT;
+ if (request_irq(dev->irq, ei_interrupt, 0, ei_status.name, dev)) {
+ MOD_DEC_USE_COUNT;
return -EAGAIN;
+ }

outb(0x00, ioaddr); /* Disable shared memory for safety. */
outb(0x80, ioaddr + 5);
@@ -273,7 +276,6 @@
outb_p(E8390_NODMA+E8390_PAGE0, dev->base_addr);
outb(0xff, dev->base_addr + EN0_ERWCNT);
ei_open(dev);
- MOD_INC_USE_COUNT;
return 0;
}

diff -u drivers/net-old/smc-ultra32.c drivers/net/smc-ultra32.c
--- drivers/net-old/smc-ultra32.c Wed Jun 28 11:38:27 2000
+++ drivers/net/smc-ultra32.c Sat Aug 26 16:16:43 2000
@@ -242,8 +242,11 @@
int ioaddr = dev->base_addr - ULTRA32_NIC_OFFSET; /* ASIC addr */
int irq_flags = (inb(ioaddr + ULTRA32_CFG5) & 0x08) ? 0 : SA_SHIRQ;

- if (request_irq(dev->irq, ei_interrupt, irq_flags, ei_status.name, dev))
+ MOD_INC_USE_COUNT;
+ if (request_irq(dev->irq, ei_interrupt, irq_flags, ei_status.name, dev)){
+ MOD_DEC_USE_COUNT;
return -EAGAIN;
+ }

outb(ULTRA32_MEMENB, ioaddr); /* Enable Shared Memory. */
outb(0x80, ioaddr + ULTRA32_CFG6); /* Enable Interrupts. */
@@ -254,7 +257,6 @@
outb_p(E8390_NODMA+E8390_PAGE0, dev->base_addr);
outb(0xff, dev->base_addr + EN0_ERWCNT);
ei_open(dev);
- MOD_INC_USE_COUNT;
return 0;
}

diff -u drivers/net-old/stnic.c drivers/net/stnic.c
--- drivers/net-old/stnic.c Thu Jul 20 03:45:44 2000
+++ drivers/net/stnic.c Sat Aug 26 16:28:04 2000
@@ -153,11 +153,11 @@
static int
stnic_open (struct net_device *dev)
{
+ MOD_INC_USE_COUNT;
#if 0
printk ("stnic open\n");
#endif
ei_open (dev);
- MOD_INC_USE_COUNT;
return 0;
}

diff -u drivers/net-old/wd.c drivers/net/wd.c
--- drivers/net-old/wd.c Wed Jun 28 11:38:32 2000
+++ drivers/net/wd.c Sat Aug 26 16:17:00 2000
@@ -313,6 +313,7 @@
{
int ioaddr = dev->base_addr - WD_NIC_OFFSET; /* WD_CMDREG */

+ MOD_INC_USE_COUNT;
/* Map in the shared memory. Always set register 0 last to remain
compatible with very old boards. */
ei_status.reg0 = ((dev->mem_start>>13) & 0x3f) | WD_MEMENB;
@@ -323,7 +324,6 @@
outb(ei_status.reg0, ioaddr); /* WD_CMDREG */

ei_open(dev);
- MOD_INC_USE_COUNT;
return 0;
}


_________________________________________________________
Do You Yahoo!?
Get your free @yahoo.com address at http://mail.yahoo.com
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
Please read the FAQ at http://www.tux.org/lkml/

\
 
 \ /
  Last update: 2005-03-22 12:38    [W:0.024 / U:3.572 seconds]
©2003-2018 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site