mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* [PATCH] lp486e.c: check region removal
@ 2001-05-25  7:13 pazke
  0 siblings, 0 replies; only message in thread
From: pazke @ 2001-05-25  7:13 UTC (permalink / raw)
  To: linux-kernel


[-- Attachment #1.1: Type: text/plain, Size: 296 bytes --]

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

[-- Attachment #1.2: patch-lp486e-2 --]
[-- Type: text/plain, Size: 2173 bytes --]

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;

[-- Attachment #2: Type: application/pgp-signature, Size: 232 bytes --]

^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2001-05-25  7:13 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2001-05-25  7:13 [PATCH] lp486e.c: check region removal pazke

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®