lkml.org 
[lkml]   [2001]   [May]   [25]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
Patch in this message
/
Date
Subject[PATCH] lp486e.c: check region removal
From
Hi all,

patch for lp486e.c network driver attached.
Changes: check_region() call removed, added missing __init and __exit.

Best regards.

--
Andrey Panin | Embedded systems software engineer
pazke@orbita1.ru | PGP key: http://www.orbita1.ru/~pazke/AndreyPanin.asc
diff -ur -X /usr/dontdiff linux.vanilla/drivers/net/lp486e.c /linux/drivers/net/lp486e.c
--- linux.vanilla/drivers/net/lp486e.c Mon May 21 23:49:44 2001
+++ /linux/drivers/net/lp486e.c Fri May 25 22:23:22 2001
@@ -971,16 +971,17 @@
volatile struct i596_private *lp;
unsigned char eth_addr[6] = { 0, 0xaa, 0, 0, 0, 0 };
unsigned char *bios;
- int i,j;
- static int probed = 0;
+ int i, j;
+ int ret = -ENOMEM;
+ static int probed;

if (probed)
return -ENODEV;
probed++;

- if (check_region(IOADDR, LP486E_TOTAL_SIZE)) {
- printk("lp486e: IO address 0x%x in use\n", IOADDR);
- return -ENODEV;
+ if (!request_region(IOADDR, LP486E_TOTAL_SIZE, dev->name)) {
+ printk(KERN_ERR "lp486e: IO address 0x%x in use\n", IOADDR);
+ return -EBUSY;
}

/*
@@ -989,7 +990,7 @@
dev->mem_start = (unsigned long)
kmalloc(sizeof(struct i596_private) + 0x0f, GFP_KERNEL);
if (!dev->mem_start)
- return -ENOMEM;
+ goto err_out;
dev->priv = (void *)((dev->mem_start + 0xf) & 0xfffffff0);
lp = (struct i596_private *) dev->priv;
memset((void *)lp, 0, sizeof(struct i596_private));
@@ -998,12 +999,10 @@
* Do we really have this thing?
*/
if (i596_scp_setup(dev)) {
- kfree ((void *) dev->mem_start);
- return -ENODEV;
+ ret = -ENODEV;
+ goto err_out_kfree;
}

- request_region(IOADDR, LP486E_TOTAL_SIZE, "lp486e");
-
dev->base_addr = IOADDR;
dev->irq = IRQ;

@@ -1053,6 +1052,12 @@
i596_port_do(dev, PORT_DUMP, "dump");
#endif
return 0;
+
+err_out_kfree:
+ kfree ((void *) dev->mem_start);
+err_out:
+ release_region(IOADDR, LP486E_TOTAL_SIZE);
+ return ret;
}

static void inline
@@ -1330,7 +1335,7 @@
static int io = IOADDR;
static int irq = IRQ;

-static int lp486e_init_module(void) {
+static int __init lp486e_init_module(void) {
struct net_device *dev = &dev_lp486e;
dev->irq = irq;
dev->base_addr = io;
@@ -1342,7 +1347,7 @@
return 0;
}

-static void lp486e_cleanup_module(void) {
+static void __exit lp486e_cleanup_module(void) {
unregister_netdev(&dev_lp486e);
kfree((void *)dev_lp486e.mem_start);
dev_lp486e.priv = NULL;[unhandled content-type:application/pgp-signature]
\
 
 \ /
  Last update: 2005-03-22 12:53    [W:0.026 / U:1.260 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site