--- linux/drivers/net/eepro.c.old	Fri Nov  2 14:39:07 2001
+++ linux/drivers/net/eepro.c	Fri Nov  9 16:19:40 2001
@@ -23,6 +23,8 @@
 	This is a compatibility hardware problem.
 
 	Versions:
+	0.13	irq sharing, rewrote probe function, fixed a nasty bug in
+		hardware_send_packet and a major cleanup (aris, 11/08/2001)
 	0.12d	tottaly isolated old code to new code (blue cards).
 		(aris, 12/27/2000)
 	0.12c	fixed other multiple cards bug and other cleanups
@@ -105,7 +107,7 @@
 */
 
 static const char *version =
-	"eepro.c: v0.12d 12/27/2000 aris@conectiva.com.br\n";
+	"eepro.c: v0.13 11/08/2001 aris@cathedrallabs.org\n";
 
 #include <linux/module.h>
 
@@ -192,18 +194,22 @@
 	unsigned tx_end;	/* end of the transmit chain (plus 1) */
 	int eepro;		/* 1 for the EtherExpress Pro/10,
 				 * 2 for the EtherExpress Pro/10+,
-				 * 3 for the blue cards,
+				 * 3 for the EtherExpress 10 (blue cards),
 				 * 0 for other 82595-based lan cards. */
 	int version;		/* a flag to indicate if this is a TX or FX
 				 * version of the 82595 chip. */
 	int stepping;
 	spinlock_t lock;	/* Serializing lock  */ 
-	unsigned rcv_ram;
-	unsigned rcv_start;
-	unsigned xmt_bar;
-	unsigned xmt_lower_limit_reg;
-	unsigned xmt_upper_limit_reg;
-	unsigned eeprom_reg;
+	unsigned rcv_ram;	/* pre-calculated space for rx */
+	unsigned xmt_ram;	/* pre-calculated space for tx */
+	unsigned char xmt_bar;
+	unsigned char xmt_lower_limit_reg;
+	unsigned char xmt_upper_limit_reg;
+	short xmt_lower_limit;
+	short xmt_upper_limit;
+	short rcv_lower_limit;
+	short rcv_upper_limit;
+	unsigned char eeprom_reg;
 };
 
 /* The station (ethernet) address prefix, used for IDing the board. */
@@ -305,7 +311,7 @@
 static struct enet_statistics *eepro_get_stats(struct device *dev);
 static void     set_multicast_list(struct device *dev);
 
-static int read_eeprom(int ioaddr, int location, struct device *dev);
+static int	read_eeprom(int ioaddr, int location, struct device *dev);
 static int 	hardware_send_packet(struct device *dev, void *buf, short length);
 static int	eepro_grab_irq(struct device *dev);
 
@@ -339,35 +345,25 @@
 buffer (transmit-buffer = 32K - receive-buffer).
 
 */
-
-/* now this section could be used by both boards: the oldies and the ee10:
- * ee10 uses tx buffer before of rx buffer and the oldies the inverse.
- * (aris)
- */
 #define	RAM_SIZE	0x8000
 
 #define	RCV_HEADER	8
 #define RCV_DEFAULT_RAM	0x6000
-#define RCV_RAM 	lp->rcv_ram
 
 #define XMT_HEADER	8
-#define XMT_RAM		(RAM_SIZE - RCV_RAM)
-
-#define XMT_START	((lp->rcv_start + RCV_RAM) % RAM_SIZE)
-
-#define RCV_LOWER_LIMIT	(lp->rcv_start >> 8)
-#define RCV_UPPER_LIMIT	(((lp->rcv_start + RCV_RAM) - 2) >> 8)
-#define XMT_LOWER_LIMIT	(XMT_START >> 8)
-#define XMT_UPPER_LIMIT	(((XMT_START + XMT_RAM) - 2) >> 8)
+#define XMT_DEFAULT_RAM	(RAM_SIZE - RCV_DEFAULT_RAM)
 
-#define RCV_START_PRO	0x00
-#define RCV_START_10	XMT_RAM
+#define XMT_START_PRO	RCV_DEFAULT_RAM
+#define XMT_START_10	0x0000
+#define RCV_START_PRO	0x0000
+#define RCV_START_10	XMT_DEFAULT_RAM
 
 #define	RCV_DONE	0x0008
 #define	RX_OK		0x2000
 #define	RX_ERROR	0x0d81
 
 #define	TX_DONE_BIT	0x0080
+#define TX_OK		0x2000
 #define	CHAIN_BIT	0x8000
 #define	XMT_STATUS	0x02
 #define	XMT_CHAIN	0x04
@@ -458,7 +454,7 @@
 #define EEDO 0x08
 
 /* do a full reset */
-#define eepro_reset(ioaddr) outb(RESET_CMD, ioaddr); udelay(40);
+#define eepro_reset(ioaddr) outb(RESET_CMD, ioaddr)
 
 /* do a nice reset */
 #define eepro_sel_reset(ioaddr) 	{ \
@@ -515,16 +511,14 @@
 
 /* a complete sel reset */
 #define eepro_complete_selreset(ioaddr) { 	\
-						/* eepro_dis_int(ioaddr); */ \
 						lp->stats.tx_errors++;\
 						eepro_sel_reset(ioaddr);\
 						lp->tx_end = \
-							(XMT_LOWER_LIMIT << 8);\
+							lp->xmt_lower_limit;\
 						lp->tx_start = lp->tx_end;\
 						lp->tx_last = 0;\
 						dev->tbusy=0;\
 						dev->trans_start = jiffies;\
-						/*eepro_en_int(ioaddr); */ \
 						eepro_en_rx(ioaddr);\
 					}
 
@@ -541,7 +535,7 @@
 		return eepro_probe1(dev, base_addr);
 
 	else if (base_addr != 0)	/* Don't probe at all. */
-		return ENXIO;
+		return -ENXIO;
 
 	for (i = 0; eepro_portlist[i]; i++) {
 		int ioaddr = eepro_portlist[i];
@@ -552,7 +546,7 @@
 			return 0;
 	}
 	
-	return ENODEV;
+	return -ENODEV;
 }
 
 static void printEEPROMInfo(short ioaddr, struct device *dev)
@@ -562,7 +556,7 @@
 
 	for (i=0, j=ee_Checksum; i<ee_SIZE; i++)
 		j+=read_eeprom(ioaddr,i,dev);
-	printk("Checksum: %#x\n",j&0xffff);
+	printk(KERN_DEBUG "Checksum: %#x\n",j&0xffff);
 
 	Word=read_eeprom(ioaddr, 0, dev);
 	printk(KERN_DEBUG "Word0:\n");
@@ -588,10 +582,10 @@
 	printk(KERN_DEBUG " BNC: %d\n",GetBit(Word,ee_BNC_TPE));
 	printk(KERN_DEBUG " NumConnectors: %d\n",GetBit(Word,ee_NumConn));
 	printk(KERN_DEBUG " Has ");
-	if (GetBit(Word,ee_PortTPE)) printk("TPE ");
-	if (GetBit(Word,ee_PortBNC)) printk("BNC ");
-	if (GetBit(Word,ee_PortAUI)) printk("AUI ");
-	printk("port(s) \n");
+	if (GetBit(Word,ee_PortTPE)) printk(KERN_DEBUG "TPE ");
+	if (GetBit(Word,ee_PortBNC)) printk(KERN_DEBUG "BNC ");
+	if (GetBit(Word,ee_PortAUI)) printk(KERN_DEBUG "AUI ");
+	printk(KERN_DEBUG "port(s) \n");
 
 	Word=read_eeprom(ioaddr, 6, dev);
 	printk(KERN_DEBUG "Word6:\n");
@@ -602,209 +596,226 @@
 	printk(KERN_DEBUG "Word7:\n");
 	printk(KERN_DEBUG " INT to IRQ:\n");
 
-	printk(KERN_DEBUG);
-
 	for (i=0, j=0; i<15; i++)
-		if (GetBit(Word,i)) printk(" INT%d -> IRQ %d;",j++,i);
+		if (GetBit(Word,i)) printk(KERN_DEBUG " INT%d -> IRQ %d;",j++,i);
 
-	printk("\n");
+	printk(KERN_DEBUG "\n");
 }
 
-/* This is the real probe routine.  Linux has a history of friendly device
-   probes on the ISA bus.  A good device probe avoids doing writes, and
-   verifies that the correct device exists and functions.  */
-
-int eepro_probe1(struct device *dev, short ioaddr)
+/* function to recalculate the limits of buffer based on rcv_ram */
+static void eepro_recalc (struct device *dev)
 {
-	unsigned short station_addr[6], id, counter;
-	int i,j, irqMask;
-	int eepro = 0;
-	struct eepro_local *lp;
-	const char *ifmap[] = {"AUI", "10Base2", "10BaseT"};
-	enum iftype { AUI=0, BNC=1, TPE=2 };
+	struct eepro_local *	lp;
 
-	/* Now, we are going to check for the signature of the
-	   ID_REG (register 2 of bank 0) */
+	lp = dev->priv;
+	lp->xmt_ram = RAM_SIZE - lp->rcv_ram;
 
-	id=inb(ioaddr + ID_REG);
- 
-	if (((id) & ID_REG_MASK) == ID_REG_SIG) {
-
-		/* We seem to have the 82595 signature, let's
-		   play with its counter (last 2 bits of
-		   register 2 of bank 0) to be sure. */
-		counter = (id & R_ROBIN_BITS);	
-		if (((id=inb(ioaddr+ID_REG)) & R_ROBIN_BITS) == 
-			(counter + 0x40)) {
-
-			/* Yes, the 82595 has been found */
-			printk(KERN_DEBUG " id: %#x ",id);
-			printk(" io: %#x ",ioaddr);
-
-			/* Initialize the device structure */
-			dev->priv = kmalloc(sizeof(struct eepro_local), GFP_KERNEL);
-			if (dev->priv == NULL)
-				return -ENOMEM;
-			memset(dev->priv, 0, sizeof(struct eepro_local));
-
-			lp = (struct eepro_local *)dev->priv;
-
-			/* default values */
-			lp->rcv_start = RCV_START_PRO;
-			lp->xmt_bar = XMT_BAR_PRO;
-			lp->xmt_lower_limit_reg = XMT_LOWER_LIMIT_REG_PRO;
-			lp->xmt_upper_limit_reg = XMT_UPPER_LIMIT_REG_PRO;
-			lp->eeprom_reg = EEPROM_REG_PRO;
-			lp->rcv_ram = RCV_DEFAULT_RAM;
-
-		/* Now, get the ethernet hardware address from
-			   the EEPROM */
-
-			station_addr[0] = read_eeprom(ioaddr, 2, dev);
-
-			/* FIXME - find another way to know that we've found
-			 * a Etherexpress 10
-			 */
-			if (station_addr[0] == 0x0000 ||
-			    station_addr[0] == 0xffff) {
-				eepro = 3;
-				lp->eepro = LAN595FX_10ISA;
-				lp->eeprom_reg = EEPROM_REG_10;
-				lp->rcv_start = RCV_START_10;
-				lp->xmt_lower_limit_reg = XMT_LOWER_LIMIT_REG_10;
-				lp->xmt_upper_limit_reg = XMT_UPPER_LIMIT_REG_10;
-				lp->xmt_bar = XMT_BAR_10;
+	if (lp->eepro == LAN595FX_10ISA) {
+		lp->xmt_lower_limit = XMT_START_10;
+		lp->xmt_upper_limit = (lp->xmt_ram - 2);
+		lp->rcv_lower_limit = lp->xmt_ram;
+		lp->rcv_upper_limit = (RAM_SIZE - 2);
+	}
+	else {
+		lp->rcv_lower_limit = RCV_START_PRO;
+		lp->rcv_upper_limit = (lp->rcv_ram - 2);
+		lp->xmt_lower_limit = lp->rcv_ram;
+		lp->xmt_upper_limit = (RAM_SIZE - 2);
+	}
+}
 
-				station_addr[0] = read_eeprom(ioaddr, 2, dev);
-			}
+/* prints boot-time info */
+static void eepro_print_info (struct device *dev)
+{
+	struct eepro_local *	lp = dev->priv;
+	int			i;
+	const char *		ifmap[] = {"AUI", "10Base2", "10BaseT"};
+
+	i = inb(dev->base_addr + ID_REG);
+	printk(KERN_DEBUG " id: %#x ",i);
+	printk(KERN_DEBUG " io: %#x ", (unsigned)dev->base_addr);
+
+	switch (lp->eepro) {
+		case LAN595FX_10ISA:
+			printk(KERN_INFO "%s: Intel EtherExpress 10 ISA\n at %#x,",
+					dev->name, (unsigned)dev->base_addr);
+			break;
+		case LAN595FX:
+			printk(KERN_INFO "%s: Intel EtherExpress Pro/10+ ISA\n at %#x,", 
+					dev->name, (unsigned)dev->base_addr);
+			break;
+		case LAN595TX:
+			printk(KERN_INFO "%s: Intel EtherExpress Pro/10 ISA at %#x,",
+					dev->name, (unsigned)dev->base_addr);
+			break;
+		case LAN595:
+			printk(KERN_INFO "%s: Intel 82595-based lan card at %#x,", 
+					dev->name, (unsigned)dev->base_addr);
+	}
 
-			station_addr[1] = read_eeprom(ioaddr, 3, dev);
-			station_addr[2] = read_eeprom(ioaddr, 4, dev);
+	for (i=0; i < 6; i++)
+		printk(KERN_INFO "%c%02x", i ? ':' : ' ', dev->dev_addr[i]);
 
-			if (eepro) {
-				printk("%s: Intel EtherExpress 10 ISA\n at %#x,",
-					dev->name, ioaddr);
-			} else if (read_eeprom(ioaddr,7,dev)== ee_FX_INT2IRQ) {
-						 /* int to IRQ Mask */
-				eepro = 2;
-				printk("%s: Intel EtherExpress Pro/10+ ISA\n at %#x,", 
-					dev->name, ioaddr);
-			} else if (station_addr[2] == SA_ADDR1)  {
-				eepro = 1;
-				printk("%s: Intel EtherExpress Pro/10 ISA at %#x,",
-					dev->name, ioaddr);
-			}
-			else {
-				eepro = 0;
-				printk("%s: Intel 82595-based lan card at %#x,", 
-					dev->name, ioaddr);
-			}
+	if (net_debug > 3)
+		printk(KERN_DEBUG ", %dK RCV buffer",
+				(int)(lp->rcv_ram)/1024);
 
-			/* Fill in the 'dev' fields. */
-			dev->base_addr = ioaddr;
-			
-			for (i=0; i < 6; i++) {
-				dev->dev_addr[i] = ((unsigned char *) station_addr)[5-i];
-				printk("%c%02x", i ? ':' : ' ', dev->dev_addr[i]);
-			}
+	if (dev->irq > 2)
+		printk(KERN_INFO ", IRQ %d, %s.\n", dev->irq, ifmap[dev->if_port]);
+	else 
+		printk(KERN_INFO ", %s.\n", ifmap[dev->if_port]);
 
-			dev->mem_start = (RCV_LOWER_LIMIT << 8);
+	if (net_debug > 3) {
+		i = read_eeprom(dev->base_addr, 5, dev);
+		if (i & 0x2000) /* bit 13 of EEPROM word 5 */
+			printk(KERN_DEBUG "%s: Concurrent Processing is "
+				"enabled but not used!\n", dev->name);
+	}
 
-			/* received mem_end as argument */
-			if ((dev->mem_end & 0x3f) < 3 ||	/* RX buffer must be more than 3K */
-				(dev->mem_end & 0x3f) > 29)	/* and less than 29K */
-				dev->mem_end = (RCV_UPPER_LIMIT << 8);
-			else {
-				dev->mem_end = (dev->mem_end * 1024) +
-							(RCV_LOWER_LIMIT << 8);
-				lp->rcv_ram = dev->mem_end - (RCV_LOWER_LIMIT << 8);
-			}
+	/* Check the station address for the manufacturer's code */
+	if (net_debug>3)
+		printEEPROMInfo(dev->base_addr, dev);
+}
 
-			/* From now on, dev->mem_end - dev->mem_start contains 
-			 * the actual size of rx buffer 
-			 */
-			
-			if (net_debug > 3)
-				printk(", %dK RCV buffer",
-						(int)(dev->mem_end - dev->mem_start)/1024);
-								
-			/* ............... */
-
-			if (GetBit( read_eeprom(ioaddr, 5, dev),ee_BNC_TPE))
-				dev->if_port = BNC;
-			else dev->if_port = TPE;
-
-			/* ............... */
-
-
-			if ((dev->irq < 2) && (eepro!=0)) {
-				i = read_eeprom(ioaddr, 1, dev);
-				irqMask = read_eeprom(ioaddr, 7, dev);
-				i &= 0x07; /* Mask off INT number */
-				
-				for (j=0; ((j<16) && (i>=0)); j++) {
-					if ((irqMask & (1<<j))!=0) {
-						if (i==0) {
-							dev->irq = j;
-							break; /* found bit corresponding to irq */
-						}
-						i--; /* count bits set in irqMask */
-					}
-				}
-				if (dev->irq < 2) {
-					printk(" Duh! illegal interrupt vector stored in EEPROM.\n");
-						return ENODEV;
-				} else 
-				
-				if (dev->irq==2)
-					dev->irq = 9;
-			}
-			
-			if (dev->irq > 2) {
-				printk(", IRQ %d, %s.\n", dev->irq,
-						ifmap[dev->if_port]);
-			}
-			else printk(", %s.\n", ifmap[dev->if_port]);
-			
-			if (net_debug > 3) {
-				i = read_eeprom(ioaddr, 5, dev);
-				if (i & 0x2000) /* bit 13 of EEPROM word 5 */
-					printk(KERN_DEBUG "%s: Concurrent Processing is enabled but not used!\n",
-						dev->name);
-			}
+/* This is the real probe routine.  Linux has a history of friendly device
+   probes on the ISA bus.  A good device probe avoids doing writes, and
+   verifies that the correct device exists and functions.  */
 
-			if (net_debug) 
-				printk(version);
+int eepro_probe1(struct device *dev, short ioaddr)
+{
+	unsigned short 		station_addr[6],
+				id,
+				counter;
+	int 			i,
+				j,
+				irqMask,
+				retval = 0;
+	struct eepro_local *	lp;
+	enum 			iftype { AUI=0, BNC=1, TPE=2 };
 
-			/* Grab the region so we can find another board if autoIRQ fails. */
-			request_region(ioaddr, EEPRO_IO_EXTENT, dev->name);
+	/* Now, we are going to check for the signature of the
+	 * ID_REG (register 2 of bank 0) */
+	id = inb(ioaddr + ID_REG);
+	if (((id) & ID_REG_MASK) != ID_REG_SIG) {
+		if (net_debug > 3)
+			printk (KERN_DEBUG "EtherExpress Pro probed failed!\n");
+		retval = -ENODEV;
+		goto exit;
+	}
+
+	/* We seem to have the 82595 signature, let's
+	   play with its counter (last 2 bits of
+	   register 2 of bank 0) to be sure. */
+	counter = (id & R_ROBIN_BITS);	
+	if (((id = inb(ioaddr+ID_REG)) & R_ROBIN_BITS) != (counter + 0x40)) {
+		retval = -ENODEV;
+		goto exit;
+	}
+
+	/* Initialize the device structure */
+	dev->priv = kmalloc(sizeof(struct eepro_local), GFP_KERNEL);
+	if (dev->priv == NULL) {
+		retval = -ENOMEM;
+		goto exit;
+	}
+	memset(dev->priv, 0, sizeof(struct eepro_local));
+	lp = (struct eepro_local *)dev->priv;
+
+	/* default values */
+	lp->eepro = 0;
+	lp->xmt_bar = XMT_BAR_PRO;
+	lp->xmt_lower_limit_reg = XMT_LOWER_LIMIT_REG_PRO;
+	lp->xmt_upper_limit_reg = XMT_UPPER_LIMIT_REG_PRO;
+	lp->eeprom_reg = EEPROM_REG_PRO;
+
+	/* Now, get the ethernet hardware address from
+ 	 * the EEPROM */
+	station_addr[0] = read_eeprom(ioaddr, 2, dev);
+
+	/* FIXME - find another way to know that we've found
+	 * a Etherexpress 10 */
+	if (station_addr[0] == 0x0000 || station_addr[0] == 0xffff) {
+		lp->eepro = LAN595FX_10ISA;
+		lp->eeprom_reg = EEPROM_REG_10;
+		lp->xmt_lower_limit_reg = XMT_LOWER_LIMIT_REG_10;
+		lp->xmt_upper_limit_reg = XMT_UPPER_LIMIT_REG_10;
+		lp->xmt_bar = XMT_BAR_10;
+		station_addr[0] = read_eeprom(ioaddr, 2, dev);
+	}
+	station_addr[1] = read_eeprom(ioaddr, 3, dev);
+	station_addr[2] = read_eeprom(ioaddr, 4, dev);
+
+	if (!lp->eepro) {
+		if (read_eeprom(ioaddr,7,dev)== ee_FX_INT2IRQ)
+			lp->eepro = 2;
+		else if (station_addr[2] == SA_ADDR1)
+			lp->eepro = 1;
+	}
 
-			spin_lock_init(&(((struct eepro_local *)dev->priv)->lock));
-			dev->open               = eepro_open;
-			dev->stop               = eepro_close;
-			dev->hard_start_xmit    = eepro_send_packet;
-			dev->get_stats          = eepro_get_stats;
-			dev->set_multicast_list = &set_multicast_list;
-
-			/* Fill in the fields of the device structure with
-			   ethernet generic values */
-
-			ether_setup(dev);
-
-			/* Check the station address for the manufacturer's code */
-			if (net_debug>3)
-				printEEPROMInfo(ioaddr, dev);
+	/* Fill in the 'dev' fields. */
+	dev->base_addr = ioaddr;
+	for (i=0; i < 6; i++)
+		dev->dev_addr[i] = ((unsigned char *) station_addr)[5-i];
+
+	/* RX buffer must be more than 3K and less than 29K */
+	if (dev->mem_end < 3072 || dev->mem_end > 29696)
+		lp->rcv_ram = RCV_DEFAULT_RAM;
 
-			/* reset 82595 */
-			eepro_reset(ioaddr);
+	/* calculate {xmt,rcv}_{lower,upper}_limit */
+	eepro_recalc(dev);
+	
+	if (GetBit(read_eeprom(ioaddr, 5, dev), ee_BNC_TPE))
+		dev->if_port = BNC;
+	else 
+		dev->if_port = TPE;
 
-			return 0;
+	if ((dev->irq < 2) && (lp->eepro != 0)) {
+		i = read_eeprom(ioaddr, 1, dev);
+		irqMask = read_eeprom(ioaddr, 7, dev);
+		i &= 0x07; /* Mask off INT number */
+		
+		for (j=0; ((j<16) && (i>=0)); j++) {
+			if ((irqMask & (1<<j))!=0) {
+				if (i==0) {
+					dev->irq = j;
+					/* found bit corresponding to irq */
+					break;
+				}
+				i--; /* count bits set in irqMask */
 			}
-		else return ENODEV;
 		}
-	else if (net_debug > 3)
-		printk ("EtherExpress Pro probed failed!\n");
-	return ENODEV;
+		if (dev->irq < 2) {
+			printk(KERN_ERR " Duh! illegal interrupt vector stored in "
+				"EEPROM.\n");
+				retval = -ENODEV;
+				goto freeall;
+		} else 
+			if (dev->irq == 2) dev->irq = 9;
+	}
+	/* Grab the region so we can find another board if autoIRQ fails. */
+	request_region(ioaddr, EEPRO_IO_EXTENT, dev->name);
+	spin_lock_init(&(((struct eepro_local *)dev->priv)->lock));
+	dev->open               = eepro_open;
+	dev->stop               = eepro_close;
+	dev->hard_start_xmit    = eepro_send_packet;
+	dev->get_stats          = eepro_get_stats;
+	dev->set_multicast_list = &set_multicast_list;
+
+	/* Fill in the fields of the device structure with ethernet generic
+	 * values */
+	ether_setup(dev);
+
+	/* print boot time info */
+	eepro_print_info(dev);
+
+	/* reset 82595 */
+	eepro_reset(ioaddr);
+
+exit:
+	return retval;
+freeall:
+	kfree(dev->priv);
+	goto exit;
 }
 
 /* Open/initialize the board.  This is called (in the current kernel)
@@ -842,7 +853,7 @@
 
 		eepro_sw2bank0(ioaddr); /* Switch back to Bank 0 */
 
-		if (request_irq (*irqp, NULL, 0, "bogus", dev) != EBUSY) {
+		if (request_irq (*irqp, NULL, SA_SHIRQ, "bogus", dev) != -EBUSY) {
 			/* Twinkle the interrupt, and check if it's seen */
 			autoirq_setup(0);
 
@@ -877,7 +888,6 @@
 	unsigned short temp_reg, old8, old9;
 	int irqMask;
 	int i, ioaddr = dev->base_addr;
-
 	struct eepro_local *lp = (struct eepro_local *)dev->priv;
 
 	if (net_debug > 3)
@@ -906,12 +916,12 @@
 
 	/* Get the interrupt vector for the 82595 */	
 	if (dev->irq < 2 && eepro_grab_irq(dev) == 0) {
-		printk("%s: unable to get IRQ %d.\n", dev->name, dev->irq);
+		printk(KERN_ERR "%s: unable to get IRQ %d.\n", dev->name, dev->irq);
 		return -EAGAIN;
 	}
 		
 	if (request_irq(dev->irq , &eepro_interrupt, 0, dev->name, dev)) {
-		printk("%s: unable to get IRQ %d.\n", dev->name, dev->irq);
+		printk(KERN_ERR "%s: unable to get IRQ %d.\n", dev->name, dev->irq);
 		return -EAGAIN;
 	}
 	
@@ -920,6 +930,7 @@
 		|| (irq2dev_map[dev->irq] = dev) == 0) && 
 		(irq2dev_map[dev->irq]!=dev)) {
 		/* printk("%s: IRQ map wrong\n", dev->name); */
+		free_irq(dev->irq, dev);
 		return -EAGAIN;
 	}
 #endif
@@ -930,7 +941,6 @@
 	temp_reg = inb(ioaddr + lp->eeprom_reg);
 
 	lp->stepping = temp_reg >> 5;	/* Get the stepping number of the 595 */
-	/* Get the stepping number of the 595 */
 
 	if (net_debug > 3)
 		printk(KERN_DEBUG "The stepping of the 82595 is %d\n", lp->stepping);
@@ -955,12 +965,12 @@
 
 	/* Set the interrupt vector */	
 	temp_reg = inb(ioaddr + INT_NO_REG);
-	if (lp->eepro == 2 || lp->eepro == LAN595FX_10ISA)
+	if (lp->eepro == LAN595FX || lp->eepro == LAN595FX_10ISA)
 		outb((temp_reg & 0xf8) | irqrmap2[dev->irq], ioaddr + INT_NO_REG);
 	else outb((temp_reg & 0xf8) | irqrmap[dev->irq], ioaddr + INT_NO_REG); 
 
 	temp_reg = inb(ioaddr + INT_NO_REG);
-	if (lp->eepro == 2 || lp->eepro == LAN595FX_10ISA)
+	if (lp->eepro == LAN595FX || lp->eepro == LAN595FX_10ISA)
 		outb((temp_reg & 0xf0) | irqrmap2[dev->irq] | 0x08,ioaddr+INT_NO_REG);
 	else outb((temp_reg & 0xf8) | irqrmap[dev->irq], ioaddr + INT_NO_REG);
 
@@ -969,10 +979,10 @@
 
 
 	/* Initialize the RCV and XMT upper and lower limits */
-	outb(RCV_LOWER_LIMIT, ioaddr + RCV_LOWER_LIMIT_REG); 
-	outb(RCV_UPPER_LIMIT, ioaddr + RCV_UPPER_LIMIT_REG); 
-	outb(XMT_LOWER_LIMIT, ioaddr + lp->xmt_lower_limit_reg); 
-	outb(XMT_UPPER_LIMIT, ioaddr + lp->xmt_upper_limit_reg); 
+	outb(lp->rcv_lower_limit >> 8, ioaddr + RCV_LOWER_LIMIT_REG); 
+	outb(lp->rcv_upper_limit >> 8, ioaddr + RCV_UPPER_LIMIT_REG); 
+	outb(lp->xmt_lower_limit >> 8, ioaddr + lp->xmt_lower_limit_reg); 
+	outb(lp->xmt_upper_limit >> 8, ioaddr + lp->xmt_upper_limit_reg); 
 
 	/* Enable the interrupt line. */
 	eepro_en_intline(ioaddr);
@@ -986,12 +996,14 @@
 	eepro_clear_int(ioaddr);
 
 	/* Initialize RCV */
-	outw((RCV_LOWER_LIMIT << 8), ioaddr + RCV_BAR); 
-	lp->rx_start = (RCV_LOWER_LIMIT << 8);
-	outw(((RCV_UPPER_LIMIT << 8) | 0xfe), ioaddr + RCV_STOP); 
+	outw(lp->rcv_lower_limit, ioaddr + RCV_BAR); 
+	outw((lp->rcv_upper_limit | 0xfe), ioaddr + RCV_STOP); 
+	lp->rx_start = lp->rcv_lower_limit;
 
 	/* Initialize XMT */
-	outw((XMT_LOWER_LIMIT << 8), ioaddr + lp->xmt_bar); 
+	outw(lp->xmt_lower_limit, ioaddr + lp->xmt_bar); 
+	lp->tx_start = lp->tx_end = lp->xmt_lower_limit;
+	lp->tx_last = 0;
 
 	/* Check for the i82595TX and i82595FX */
 	old8 = inb(ioaddr + 8);
@@ -1034,11 +1046,6 @@
 	}
 	
 	eepro_sel_reset(ioaddr);
-	SLOW_DOWN;
-	SLOW_DOWN;
-
-	lp->tx_start = lp->tx_end = (XMT_LOWER_LIMIT << 8);
-	lp->tx_last = 0;
 	
 	dev->tbusy = 0;
 	dev->interrupt = 0;
@@ -1064,14 +1071,10 @@
 	if (net_debug > 5)
 		printk(KERN_DEBUG  "%s: entering eepro_send_packet routine.\n", dev->name);
 
-	if (dev->tbusy) {
-		/* If we get here, some higher level has decided we are broken.
-		   There should really be a "kick me" function call instead. */
-		int tickssofar = jiffies - dev->trans_start;
+	eepro_dis_int(ioaddr);
+	spin_lock_irqsave(&lp->lock, flags);
 
-		if (tickssofar < 40)
-			return 1;
-		
+	if (dev->tbusy) {
 		/* if (net_debug > 1) */
 		printk(KERN_ERR "%s: transmit timed out, %s?\n", dev->name, 
 			"network cable problem");
@@ -1083,33 +1086,29 @@
 		/* let's do a complete sel reset */
 		eepro_complete_selreset(ioaddr);
 	}
-	spin_lock_irqsave(&lp->lock, flags);
 
 	/* Block a timer-based transmit from overlapping. */
 	if (test_and_set_bit(0, (void*)&dev->tbusy) != 0) {
 		printk(KERN_WARNING "%s: Transmitter access conflict.\n", dev->name);
-
-		spin_unlock_irqrestore(&lp->lock, flags);
+		lp->stats.tx_aborted_errors++;
 	} else {
 		short length = ETH_ZLEN < skb->len ? skb->len : ETH_ZLEN;
-		unsigned char *buf = skb->data;
-
-		lp->stats.tx_bytes+=skb->len;
-		if (hardware_send_packet(dev, buf, length))
-			return 1;
-		
-		dev->trans_start = jiffies;
 
+		if (hardware_send_packet(dev, skb->data, length))
+			/* we won't unset tbusy because we're out of space. */
+			lp->stats.tx_dropped++;
+		else {
+			lp->stats.tx_bytes += skb->len;
+			dev->trans_start = jiffies;
+			dev->tbusy = 0;
+		}
 	}
-
 	dev_kfree_skb(skb);
 
-	/* You might need to clean up and record Tx statistics here. */
-	/* lp->stats.tx_aborted_errors++; */
-
 	if (net_debug > 5)
 		printk(KERN_DEBUG "%s: exiting eepro_send_packet routine.\n", dev->name);
 
+	eepro_en_int(ioaddr);
 	spin_unlock_irqrestore(&lp->lock, flags);
 	
 	return 0;
@@ -1122,17 +1121,20 @@
 static void
 eepro_interrupt(int irq, void *dev_id, struct pt_regs * regs)
 {
-	struct device *dev =  (struct device *)dev_id;
-	                      /* (struct device *)(irq2dev_map[irq]);*/
-	struct eepro_local *lp = (struct eepro_local *)dev->priv;
+	struct device *dev;
+	struct eepro_local *lp;
 	int ioaddr, status, boguscount = 20;
 
-	if (dev == NULL) {
+	if (dev_id == NULL) {
                 printk (KERN_ERR "eepro_interrupt(): irq %d for unknown device.\\n", irq);
                 return;
         }
 
-        spin_lock(&lp->lock);
+	dev = (struct device *)dev_id;
+
+	lp = (struct eepro_local *)dev->priv;
+
+	spin_lock(&lp->lock);
 
 	if (dev->interrupt) {
 		printk(KERN_ERR "%s: Re-entering the interrupt handler.\n", dev->name);
@@ -1150,39 +1152,37 @@
 	
 	ioaddr = dev->base_addr;
 
-	while (((status = inb(ioaddr + STATUS_REG)) & 0x06) && (boguscount--)) 
+	eepro_sw2bank0(ioaddr);
+
+	while (((status = inb(ioaddr + STATUS_REG)) & (RX_INT|TX_INT)) && boguscount--) 
 	{
-		switch (status & (RX_INT | TX_INT)) {
-#ifdef ANSWER_TX_AND_RX
-			case (RX_INT | TX_INT):
-				eepro_ack_rxtx(ioaddr);
-				break;
-#endif
-			case RX_INT:
-				eepro_ack_rx(ioaddr);
-				break;
-			case TX_INT:
-				eepro_ack_tx(ioaddr);
-		}
+
 		if (status & RX_INT) {
 			if (net_debug > 4)
 				printk(KERN_DEBUG "%s: packet received interrupt.\n", dev->name);
 
+			eepro_dis_int(ioaddr);
+
 			/* Get the received packets */
+			eepro_ack_rx(ioaddr);
 			eepro_rx(dev);
-#ifndef ANSWER_TX_AND_RX
-			continue;
-#endif
+
+			eepro_en_int(ioaddr);
 		}
 		if (status & TX_INT) {
 			if (net_debug > 4)
  				printk(KERN_DEBUG "%s: packet transmit interrupt.\n", dev->name);
 
+			eepro_dis_int(ioaddr);
+
 			/* Process the status of transmitted packets */
+			eepro_ack_tx(ioaddr);
 			eepro_transmit_interrupt(dev);
+
+			eepro_en_int(ioaddr);
 		}
 	}
-	
+
 	dev->interrupt = 0;
 
 	if (net_debug > 5)
@@ -1212,7 +1212,7 @@
 
 	/* Flush the Tx and disable Rx. */
 	outb(STOP_RCV_CMD, ioaddr); 
-	lp->tx_start = lp->tx_end = (XMT_LOWER_LIMIT << 8);
+	lp->tx_start = lp->tx_end = lp->xmt_lower_limit;
 	lp->tx_last = 0;
 
 	/* Mask all the interrupts. */
@@ -1273,7 +1273,7 @@
 		mode = inb(ioaddr + REG3);
 		outb(mode, ioaddr + REG3); /* writing reg. 3 to complete the update */
 		eepro_sw2bank0(ioaddr); /* Return to BANK 0 now */
-		printk("%s: promiscuous mode enabled.\n", dev->name);
+		printk(KERN_INFO "%s: promiscuous mode enabled.\n", dev->name);
 	}
 	
 	else if (dev->mc_count==0 ) 
@@ -1352,11 +1352,11 @@
 				outb(0x08, ioaddr + STATUS_REG);
 				
 				if (i & 0x20) { /* command ABORTed */
-					printk("%s: multicast setup failed.\n", 
+					printk(KERN_NOTICE "%s: multicast setup failed.\n", 
 						dev->name);
 					break;
 				} else if ((i & 0x0f) == 0x03)	{ /* MC-Done */
-					printk("%s: set Rx mode to %d address%s.\n",
+					printk(KERN_DEBUG "%s: set Rx mode to %d address%s.\n",
 						dev->name, dev->mc_count,
 						dev->mc_count > 1 ? "es":"");
 					break;
@@ -1392,14 +1392,10 @@
 	int read_cmd = location | EE_READ_CMD;
 	short ctrl_val = EECS ;
 	
-	/* XXXX - this is not the final version. We must test this on other
-	 *	  boards other than eepro10. I think that it won't let other
-	 *	  boards to fail. (aris)
-	 */
-	if (lp->eepro == LAN595FX_10ISA) {
-		eepro_sw2bank1(ioaddr);
-		outb(0x00, ioaddr + STATUS_REG);
-	}
+	/* XXXX - black magic */
+	eepro_sw2bank1(ioaddr);
+	outb(0x00, ioaddr + STATUS_REG);
+	/* XXXX - black magic */
 		
 	eepro_sw2bank2(ioaddr);
 	outb(ctrl_val, ee_addr);
@@ -1437,133 +1433,95 @@
 {
 	struct eepro_local *lp = (struct eepro_local *)dev->priv;
 	short ioaddr = dev->base_addr;
-
-	unsigned status, tx_available, last, end, boguscount = 100;
+	unsigned status, tx_available, last, end;
 
 	if (net_debug > 5)
 		printk(KERN_DEBUG "%s: entering hardware_send_packet routine.\n", dev->name);
 
+	/* determine how much of the transmit buffer space is
+	 * available */
+	if (lp->tx_end > lp->tx_start)
+		tx_available = lp->xmt_ram - (lp->tx_end - 
+							lp->tx_start);
+	else if (lp->tx_end < lp->tx_start)
+		tx_available = lp->tx_start - lp->tx_end;
+	else tx_available = lp->xmt_ram;
 
-	while (boguscount-- > 0) {
-		/* Disable RX and TX interrupts.  Necessary to avoid
-		corruption of the HOST_ADDRESS_REG by interrupt
-		service routines. */
-		eepro_dis_int(ioaddr);
-
-		if (dev->interrupt == 1) {
-			/* Enable RX and TX interrupts */
-			eepro_en_int(ioaddr);
-			continue;
-		}
-
-		/* determine how much of the transmit buffer space is available */
-		if (lp->tx_end > lp->tx_start)
-			tx_available = XMT_RAM - (lp->tx_end - lp->tx_start);
-		else if (lp->tx_end < lp->tx_start)
-			tx_available = lp->tx_start - lp->tx_end;
-		else tx_available = XMT_RAM;
-
-		if (((((length + 3) >> 1) << 1) + 2*XMT_HEADER) 
-			>= tx_available)   /* No space available ??? */
-			{
-			eepro_transmit_interrupt(dev); /* Clean up the transmiting queue */
-
-			/* Enable RX and TX interrupts */
-			eepro_en_int(ioaddr);
-			continue;
-		}
-
-		last = lp->tx_end;
-		end = last + (((length + 3) >> 1) << 1) + XMT_HEADER;
-
-		if (end >= (XMT_UPPER_LIMIT << 8)) { /* the transmit buffer is wrapped around */
-			if (((XMT_UPPER_LIMIT << 8) - last) <= XMT_HEADER) {
-				/* Arrrr!!!, must keep the xmt header together,
-				several days were lost to chase this one down. */
-				
-				last = (XMT_LOWER_LIMIT << 8);
-				end = last + (((length + 3) >> 1) << 1) + XMT_HEADER;
-			}
-			else end = (XMT_LOWER_LIMIT << 8) + (end - 
-						(XMT_UPPER_LIMIT << 8));
-		}
-
-		outw(last, ioaddr + HOST_ADDRESS_REG);
-		outw(XMT_CMD, ioaddr + IO_PORT);
-		outw(0, ioaddr + IO_PORT);
-		outw(end, ioaddr + IO_PORT);
-		outw(length, ioaddr + IO_PORT);
-
-		if (lp->version == LAN595)
-			outsw(ioaddr + IO_PORT, buf, (length + 3) >> 1);
-		else {	/* LAN595TX or LAN595FX, capable of 32-bit I/O processing */
-			unsigned short temp = inb(ioaddr + INT_MASK_REG);
-			outb(temp | IO_32_BIT, ioaddr + INT_MASK_REG);
-			outsl(ioaddr + IO_PORT_32_BIT, buf, (length + 3) >> 2);
-			outb(temp & ~(IO_32_BIT), ioaddr + INT_MASK_REG);
-		}
+	if (((((length + 3) >> 1) << 1) + 2*XMT_HEADER) >= tx_available) {
+		/* No space available ??? */
+		return 1;
+	}
 
-		/* A dummy read to flush the DRAM write pipeline */
-		status = inw(ioaddr + IO_PORT); 
+	last = lp->tx_end;
+	end = last + (((length + 3) >> 1) << 1) + XMT_HEADER;
 
-		if (lp->tx_start == lp->tx_end) {
-			outw(last, ioaddr + lp->xmt_bar);
-			outb(XMT_CMD, ioaddr);			
-			lp->tx_start = last;   /* I don't like to change tx_start here */
-		}
-		else {
-			/* update the next address and the chain bit in the 
-			last packet */
-			if (lp->tx_end != last) {
-				outw(lp->tx_last + XMT_CHAIN, ioaddr + HOST_ADDRESS_REG);
-				outw(last, ioaddr + IO_PORT); 
-			}
+	if (end >= lp->xmt_upper_limit + 2) { 
+	/* the transmit buffer is wrapped around */
+		if ((lp->xmt_upper_limit + 2 - last) <= XMT_HEADER) {
+			/* Arrrr!!!, must keep the xmt header together,
+			several days were lost to chase this one down. */
 			
-			outw(lp->tx_last + XMT_COUNT, ioaddr + HOST_ADDRESS_REG);
-			status = inw(ioaddr + IO_PORT); 
-			outw(status | CHAIN_BIT, ioaddr + IO_PORT);
-			/* Continue the transmit command */
-			outb(RESUME_XMT_CMD, ioaddr);
-		}
-
-		lp->tx_last = last;
-		lp->tx_end = end;
-
-		if (dev->tbusy) {
-			dev->tbusy = 0;
+			last = lp->xmt_lower_limit;
+			end = last + (((length + 3) >> 1) << 1) +
+							XMT_HEADER;
+		}
+		else end = lp->xmt_lower_limit + (end - 
+					lp->xmt_upper_limit + 2);
+	}
+
+	outw(last, ioaddr + HOST_ADDRESS_REG);
+	outw(XMT_CMD, ioaddr + IO_PORT);
+	outw(0, ioaddr + IO_PORT);
+	outw(end, ioaddr + IO_PORT);
+	outw(length, ioaddr + IO_PORT);
+
+	if (lp->version == LAN595)
+		outsw(ioaddr + IO_PORT, buf, (length + 3) >> 1);
+	else {	/* LAN595TX or LAN595FX, capable of 32-bit I/O processing */
+		unsigned short temp = inb(ioaddr + INT_MASK_REG);
+		outb(temp | IO_32_BIT, ioaddr + INT_MASK_REG);
+		outsl(ioaddr + IO_PORT_32_BIT, buf, (length + 3) >> 2);
+		outb(temp & ~(IO_32_BIT), ioaddr + INT_MASK_REG);
+	}
+
+	/* A dummy read to flush the DRAM write pipeline */
+	status = inw(ioaddr + IO_PORT); 
+	if (lp->tx_start == lp->tx_end) {
+		outw(last, ioaddr + lp->xmt_bar);
+		outb(XMT_CMD, ioaddr);
+		lp->tx_start = last;   /* I don't like to change tx_start here */
+	}
+	else {
+		/* update the next address and the chain bit in the 
+		last packet */
+		if (lp->tx_end != last) {
+			outw(lp->tx_last + XMT_CHAIN, ioaddr + HOST_ADDRESS_REG);
+			outw(last, ioaddr + IO_PORT); 
 		}
-		
-		/* now we are serializing tx. tbusy won't come back until
-		 * the tx interrupt
-		 */
-		if (lp->eepro == LAN595FX_10ISA)
-			dev->tbusy = 1;
-		
-		/* Enable RX and TX interrupts */
-		eepro_en_int(ioaddr);
-
-		if (net_debug > 5)
-			printk(KERN_DEBUG "%s: exiting hardware_send_packet routine.\n", dev->name);
 
-		return 0;
+		outw(lp->tx_last + XMT_COUNT, ioaddr + HOST_ADDRESS_REG);
+		status = inw(ioaddr + IO_PORT); 
+		outw(status | CHAIN_BIT, ioaddr + IO_PORT);
+		/* Continue the transmit command */
+		outb(RESUME_XMT_CMD, ioaddr);
 	}
-	if (lp->eepro == LAN595FX_10ISA)
-		dev->tbusy = 1;
+
+	lp->tx_last = last;
+	lp->tx_end = end;
 
 	if (net_debug > 5)
 		printk(KERN_DEBUG "%s: exiting hardware_send_packet routine.\n", dev->name);
 
-	return 1;
+	return 0;
 }
 
 static void
 eepro_rx(struct device *dev)
 {
 	struct eepro_local *lp = (struct eepro_local *)dev->priv;
-	short ioaddr = dev->base_addr;
-		
-	short boguscount = 20;
-	unsigned rcv_car = lp->rx_start;
+	short 	ioaddr = dev->base_addr,
+	 	boguscount = 25,
+		rcv_car = lp->rx_start;
 	unsigned rcv_event, rcv_status, rcv_next_frame, rcv_size;
 
 	if (net_debug > 5)
@@ -1575,7 +1533,6 @@
 	rcv_event = inw(ioaddr + IO_PORT);
 
 	while (rcv_event == RCV_DONE) {
-	
 		rcv_status = inw(ioaddr + IO_PORT); 
 		rcv_next_frame = inw(ioaddr + IO_PORT);
 		rcv_size = inw(ioaddr + IO_PORT); 
@@ -1624,24 +1581,26 @@
 			else if (rcv_status & 0x0800)
 				lp->stats.rx_crc_errors++;
 			
-			printk("%s: event = %#x, status = %#x, next = %#x, size = %#x\n", 
+			printk(KERN_DEBUG "%s: event = %#x, status = %#x, next = %#x, size = %#x\n", 
 				dev->name, rcv_event, rcv_status, rcv_next_frame, rcv_size);
 		}
 
 		if (rcv_status & 0x1000)
 			lp->stats.rx_length_errors++;
 
-		if (--boguscount == 0)
-			break;
 
 		rcv_car = lp->rx_start + RCV_HEADER + rcv_size;
 		lp->rx_start = rcv_next_frame;
+
+		if (--boguscount == 0)
+			break;
+
 		outw(rcv_next_frame, ioaddr + HOST_ADDRESS_REG);
 		rcv_event = inw(ioaddr + IO_PORT);
 
 	} 
 	if (rcv_car == 0)
-		rcv_car = ((RCV_UPPER_LIMIT << 8) | 0xff);
+		rcv_car = lp->rcv_upper_limit | 0xff;
 		
 	outw(rcv_car - 1, ioaddr + RCV_STOP);
 
@@ -1653,59 +1612,25 @@
 eepro_transmit_interrupt(struct device *dev)
 {
 	struct eepro_local *lp = (struct eepro_local *)dev->priv;
-	short ioaddr = dev->base_addr;
-	short boguscount = 20; 
-	unsigned xmt_status;
-
-	/*
-	if (dev->tbusy == 0) {
-		printk("%s: transmit_interrupt called with tbusy = 0 ??\n",
-			dev->name);
-		printk(KERN_DEBUG "%s: transmit_interrupt called with tbusy = 0 ??\n",
-			dev->name);
-	}
-	*/
-	while (lp->tx_start != lp->tx_end && boguscount) {
+	short 	ioaddr = dev->base_addr,
+		boguscount = 25,
+		xmt_status;
 
+	while ((lp->tx_start != lp->tx_end) && boguscount--) {
 		outw(lp->tx_start, ioaddr + HOST_ADDRESS_REG);
 		xmt_status = inw(ioaddr+IO_PORT);
 
-		if ((xmt_status & TX_DONE_BIT) == 0) {
-			if (lp->eepro == LAN595FX_10ISA) {
-				udelay(40);
-				boguscount--;
-				continue;
-			}
-			else
-				break;
-		}
-
-
-		xmt_status = inw(ioaddr+IO_PORT); 
-		lp->tx_start = inw(ioaddr+IO_PORT);
-
-		if (lp->eepro == LAN595FX_10ISA) {
-			lp->tx_start = (XMT_LOWER_LIMIT << 8);
-			lp->tx_end = lp->tx_start;
-	
-			/* yeah, black magic :( */
-			eepro_sw2bank0(ioaddr);
-			eepro_en_int(ioaddr);
+		/* are we trying to get a packet not ready? */
+		if ((xmt_status & TX_DONE_BIT) == 0)
+			break;
 
-			/* disabling rx */
-			eepro_dis_rx(ioaddr);
-			
-			/* enabling rx */
-			eepro_en_rx(ioaddr);
-		}
+		xmt_status = inw(ioaddr+IO_PORT);
+		lp->tx_start = inw(ioaddr + IO_PORT);
 
-		/* here the tbusy comes to 0 for normal and ee10 cards
-		 */
 		dev->tbusy = 0;
-		
 		mark_bh(NET_BH);
-		
-		if (xmt_status & 0x2000) {
+
+		if (xmt_status & TX_OK) {
 			lp->stats.tx_packets++; 
 		}
 		else {
@@ -1714,45 +1639,17 @@
 				lp->stats.tx_carrier_errors++;
 				printk(KERN_DEBUG "%s: carrier error\n",
 					dev->name);
-				printk(KERN_DEBUG "%s: XMT status = %#x\n",
-					dev->name, xmt_status);
 			}
-			else {
-				printk(KERN_DEBUG "%s: XMT status = %#x\n",
-					dev->name, xmt_status);
-				printk(KERN_DEBUG "%s: XMT status = %#x\n",
+			printk(KERN_DEBUG "%s: XMT status = %#x\n",
 					dev->name, xmt_status);
-			}
-
-			if (lp->eepro == LAN595FX_10ISA) {			
-				/* Try to restart the adaptor. */
-				/* We are supposed to wait for 2 us after a SEL_RESET */
-				eepro_sel_reset(ioaddr);
-
-				/* first enable interrupts */
-				eepro_sw2bank0(ioaddr);
-				outb(ALL_MASK & ~(RX_INT | TX_INT), ioaddr + STATUS_REG);
-			
-				/* enabling rx */
-				eepro_en_rx(ioaddr);
-			}
 		}
 		
-		if (xmt_status & 0x000f) {
+		if (xmt_status & 0x000f)
 			lp->stats.collisions += (xmt_status & 0x000f);
-		}
 		
-		if ((xmt_status & 0x0040) == 0x0) {
+		if (!(xmt_status & 0x0040))
 			lp->stats.tx_heartbeat_errors++;
-		}
-		boguscount--;
 	}
-	/* if it reached here then it's probable that the adapter won't
-	 * interrupt again for tx. in other words: tx timeout what will take
-	 * a lot of time to happen, so we'll do a complete selreset.
-	 */
-	if (!boguscount && lp->eepro == LAN595FX_10ISA)
-		eepro_complete_selreset(ioaddr);
 }
 
 #ifdef MODULE
@@ -1781,23 +1678,23 @@
 {
 	int i;
 	if (io[0] == 0 && autodetect == 0) {
-		printk("eepro_init_module: Probe is very dangerous in ISA boards!\n");
-		printk("eepro_init_module: Please add \"autodetect=1\" to force probe\n");
+		printk(KERN_WARNING "eepro_init_module: Probe is very dangerous in ISA boards!\n");
+		printk(KERN_WARNING "eepro_init_module: Please add \"autodetect=1\" to force probe\n");
 		return 1;
 	}
 	else if (autodetect) {
 		/* if autodetect is set then we must force detection */
 		io[0] = 0;
 		
-		printk("eepro_init_module: Auto-detecting boards (May God protect us...)\n");
+		printk(KERN_INFO "eepro_init_module: Auto-detecting boards (May God protect us...)\n");
 	}	
 	
 	for (i = 0; i < MAX_EEPRO; i++) {
 		struct device *d = &dev_eepro[n_eepro];
 		d->name		= devicename[n_eepro]; /* inserted by drivers/net/net_init.c */
-		d->mem_end	= mem[n_eepro];		
-		d->base_addr	= io[0];
-		d->irq		= irq[n_eepro];
+		d->mem_end	= mem[i];		
+		d->base_addr	= io[i];
+		d->irq		= irq[i];
 		d->init		= eepro_probe;
 
 		if (register_netdev(d) == 0)
@@ -1805,7 +1702,10 @@
 		else
 			break;
 	}
-	
+
+	if (n_eepro)
+		printk(KERN_INFO "%s", version);
+
 	return n_eepro ? 0 : -ENODEV;
 }
 
