public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* [RFC] check_region removal from 3c509.c
@ 2003-07-10 13:54 Domen Puncer
  0 siblings, 0 replies; only message in thread
From: Domen Puncer @ 2003-07-10 13:54 UTC (permalink / raw)
  To: linux-kernel

[-- Attachment #1: Type: text/plain, Size: 174 bytes --]

Hi.

Replaced check_region() with request_region(), removed 2 #ifdefs.

This is first time i'm posting a patch, so please comment if something could 
be done better.


	Domen

[-- Attachment #2: 3c509.c-check_region-2.patch --]
[-- Type: text/x-diff, Size: 1433 bytes --]

--- linux-2.5.74/drivers/net/3c509.c-orig	2003-07-10 12:55:08.000000000 +0200
+++ linux-2.5.74/drivers/net/3c509.c	2003-07-10 15:01:41.000000000 +0200
@@ -370,9 +370,7 @@
 #if defined(__ISAPNP__) && !defined(CONFIG_X86_PC9800)
 	static int pnp_cards;
 	struct pnp_dev *idev = NULL;
-#endif /* __ISAPNP__ */
 
-#if defined(__ISAPNP__) && !defined(CONFIG_X86_PC9800)
 	if (nopnp == 1)
 		goto no_pnp;
 
@@ -428,12 +426,15 @@
 #else
 	/* Select an open I/O location at 0x1*0 to do contention select. */
 	for ( ; id_port < 0x200; id_port += 0x10) {
-		if (check_region(id_port, 1))
+		if (!request_region(id_port, 1, "3c509"))
 			continue;
 		outb(0x00, id_port);
 		outb(0xff, id_port);
-		if (inb(id_port) & 0x01)
+		if (inb(id_port) & 0x01){
+			release_region(id_port, 1);
 			break;
+		} else
+			release_region(id_port, 1);
 	}
 	if (id_port >= 0x200) {
 		/* Rare -- do we really need a warning? */
@@ -496,19 +497,17 @@
 	{
 		unsigned int iobase = id_read_eeprom(8);
 		if_port = iobase >> 14;
+		irq = id_read_eeprom(9) >> 12;
 #ifdef CONFIG_X86_PC9800
 		ioaddr = 0x40d0 + ((iobase & 0x1f) << 8);
+		if (irq == 7)
+			irq = 6;
+		else if (irq == 15)
+			irq = 13;
 #else
 		ioaddr = 0x200 + ((iobase & 0x1f) << 4);
 #endif
 	}
-	irq = id_read_eeprom(9) >> 12;
-#ifdef CONFIG_X86_PC9800
-	if (irq == 7)
-		irq = 6;
-	else if (irq == 15)
-		irq = 13;
-#endif
 
 	dev = alloc_etherdev(sizeof (struct el3_private));
 	if (!dev)

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

only message in thread, other threads:[~2003-07-10 13:40 UTC | newest]

Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2003-07-10 13:54 [RFC] check_region removal from 3c509.c Domen Puncer

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