patch-2.3.7 linux/drivers/acorn/net/etherh.c

Next file: linux/drivers/acorn/scsi/Config.in
Previous file: linux/drivers/acorn/net/ether3.h
Back to the patch index
Back to the overall index

diff -u --recursive --new-file v2.3.6/linux/drivers/acorn/net/etherh.c linux/drivers/acorn/net/etherh.c
@@ -37,6 +37,7 @@
 #include <linux/etherdevice.h>
 #include <linux/skbuff.h>
 #include <linux/delay.h>
+#include <linux/init.h>
 
 #include <asm/system.h>
 #include <asm/bitops.h>
@@ -50,13 +51,16 @@
 #define DEBUG_INIT 2
 
 static unsigned int net_debug = NET_DEBUG;
-static const card_ids etherh_cids[] = {
+static const card_ids __init etherh_cids[] = {
 	{ MANU_I3, PROD_I3_ETHERLAN500 },
 	{ MANU_I3, PROD_I3_ETHERLAN600 },
 	{ MANU_I3, PROD_I3_ETHERLAN600A },
 	{ 0xffff, 0xffff }
 };
 
+MODULE_AUTHOR("Russell King");
+MODULE_DESCRIPTION("i3 EtherH driver");
+
 static char *version = "etherh [500/600/600A] ethernet driver (c) 1998 R.M.King v1.05\n";
 
 #define ETHERH500_DATAPORT	0x200	/* MEMC */
@@ -80,8 +84,8 @@
  * Read the ethernet address string from the on board rom.
  * This is an ascii string...
  */
-static int
-etherh_addr(char *addr, struct expansion_card *ec)
+__initfunc(static int
+etherh_addr(char *addr, struct expansion_card *ec))
 {
 	struct in_chunk_dir cd;
 	char *s;
@@ -216,10 +220,8 @@
 
 	if (ei_status.word16)
 		outsw (dma_addr, buf, count >> 1);
-#ifdef BIT8
 	else
 		outsb (dma_addr, buf, count);
-#endif
 
 	dma_start = jiffies;
 
@@ -268,11 +270,8 @@
 		insw (dma_addr, buf, count >> 1);
 		if (count & 1)
 			buf[count - 1] = inb (dma_addr);
-	}
-#ifdef BIT8
-	else
+	} else
 		insb (dma_addr, buf, count);
-#endif
 
 	outb (ENISR_RDC, addr + EN0_ISR);
 	ei_status.dmaing &= ~1;
@@ -307,10 +306,8 @@
 
 	if (ei_status.word16)
 		insw (dma_addr, hdr, sizeof (*hdr) >> 1);
-#ifdef BIT8
 	else
 		insb (dma_addr, hdr, sizeof (*hdr));
-#endif
 
 	outb (ENISR_RDC, addr + EN0_ISR);
 	ei_status.dmaing &= ~1;
@@ -355,8 +352,8 @@
 /*
  * This is the real probe routine.
  */
-static int
-etherh_probe1(struct device *dev)
+__initfunc(static int
+etherh_probe1(struct device *dev))
 {
 	static int version_printed;
 	unsigned int addr, i, reg0, tmp;
@@ -461,10 +458,13 @@
 	etherh_irq_enable,
 	etherh_irq_disable,
 	NULL,
+	NULL,
+	NULL,
 	NULL
 };
 
-static void etherh_initdev (ecard_t *ec, struct device *dev)
+__initfunc(static void
+etherh_initdev(ecard_t *ec, struct device *dev))
 {
 	ecard_claim (ec);
 	
@@ -492,27 +492,27 @@
 	}
 	ec->ops = &etherh_ops;
 
-	etherh_addr (dev->dev_addr, ec);
+	etherh_addr(dev->dev_addr, ec);
 }
 
 #ifndef MODULE
-int
-etherh_probe(struct device *dev)
+__initfunc(int
+etherh_probe(struct device *dev))
 {
 	if (!dev)
 		return ENODEV;
 
-	ecard_startfind ();
-
-	if (!dev->base_addr) {
+	if (!dev->base_addr || dev->base_addr == 0xffe0) {
 		struct expansion_card *ec;
 
+		ecard_startfind();
+
 		if ((ec = ecard_find (0, etherh_cids)) == NULL)
 			return ENODEV;
 
-		etherh_initdev (ec, dev);
+		etherh_initdev(ec, dev);
 	}
-	return etherh_probe1 (dev);
+	return etherh_probe1(dev);
 }
 #endif
 
@@ -529,12 +529,10 @@
 init_all_cards(void)
 {
 	struct device *dev = NULL;
-	struct expansion_card *boguscards[MAX_ETHERH_CARDS];
 	int i, found = 0;
 
 	for (i = 0; i < MAX_ETHERH_CARDS; i++) {
 		my_ethers[i] = NULL;
-		boguscards[i] = NULL;
 		ec[i] = NULL;
 		strcpy (ethernames[i], "        ");
 	}
@@ -571,7 +569,7 @@
 		if (register_netdev(dev) != 0) {
 			printk (KERN_WARNING "No etherh card found at %08lX\n", dev->base_addr);
 			if (ec[i]) {
-				boguscards[i] = ec[i];
+				ecard_release(ec[i]);
 				ec[i] = NULL;
 			}
 			continue;
@@ -582,12 +580,6 @@
 
 	if (dev)
 		kfree (dev);
-
-	for (i = 0; i < MAX_ETHERH_CARDS; i++)
-		if (boguscards[i]) {
-			boguscards[i]->ops = NULL;
-			ecard_release (boguscards[i]);
-		}
 
 	return found ? 0 : -ENODEV;
 }

FUNET's LINUX-ADM group, linux-adm@nic.funet.fi
TCL-scripts by Sam Shen (who was at: slshen@lbl.gov)