Skip to contentSkip to conversation

check_region removal from 3c509.c

RFC New Domen Puncer 1 participant 1 message Jul 10, 2003 Network drivers

lore
Share & tools
lore
#0 lore raw

RFC 1/1 check_region removal from 3c509.c

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

drivers/net/3c509.c renamed from drivers/net/3c509.c-orig +10 -11
@@ -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)