patch-2.1.36 linux/drivers/net/a2065.c

Next file: linux/drivers/net/ac3200.c
Previous file: linux/drivers/net/Space.c
Back to the patch index
Back to the overall index

diff -u --recursive --new-file v2.1.35/linux/drivers/net/a2065.c linux/drivers/net/a2065.c
@@ -47,6 +47,7 @@
 #include <linux/malloc.h>
 #include <linux/string.h>
 #include <linux/config.h>
+#include <linux/init.h>
 
 #include <asm/bitops.h>
 #include <asm/io.h>
@@ -55,7 +56,7 @@
 
 #include <asm/amigaints.h>
 #include <asm/amigahw.h>
-#include <asm/zorro.h>
+#include <linux/zorro.h>
 
 #include <linux/netdevice.h>
 #include <linux/etherdevice.h>
@@ -302,14 +303,16 @@
 			lp->stats.rx_errors++;
 			continue;
 		} else if (bits & LE_R1_ERR) {
-			/* Count only the end frame as a tx error, not the beginning */
+			/* Count only the end frame as a rx error,
+			 * not the beginning
+			 */
 			if (bits & LE_R1_BUF) lp->stats.rx_fifo_errors++;
 			if (bits & LE_R1_CRC) lp->stats.rx_crc_errors++;
 			if (bits & LE_R1_OFL) lp->stats.rx_over_errors++;
 			if (bits & LE_R1_FRA) lp->stats.rx_frame_errors++;
 			if (bits & LE_R1_EOP) lp->stats.rx_errors++;
 		} else {
-			len = rd->mblength;
+			len = (rd->mblength & 0xfff) - 4;
 			skb = dev_alloc_skb (len+2);
 
 			if (skb == 0) {
@@ -582,6 +585,16 @@
 		return status;
 	}
 
+	if (skb == NULL) {
+		dev_tint (dev);
+		printk ("skb is NULL\n");
+		return 0;
+	}
+
+	if (skb->len <= 0) {
+		printk ("skb len is %d\n", skb->len);
+		return 0;
+	}
 	/* Block a timer-based transmit from overlapping. */
 #ifdef OLD_METHOD
 	dev->tbusy = 1;
@@ -698,18 +711,13 @@
 	struct lance_private *lp = (struct lance_private *) dev->priv;
 	volatile struct lance_init_block *ib = lp->init_block;
 	volatile struct lance_regs *ll = lp->ll;
-	char shown;
 
-	shown = 0;
 	while (dev->tbusy)
-		if (!shown++)
-			printk ("Waiting for tbusy to go down\n");
+		schedule();
 	set_bit (0, (void *) &dev->tbusy);
 
-	shown = 0;
 	while (lp->tx_old != lp->tx_new)
-		if (!shown)
-			printk ("Waiting for buffer to empty\n");
+		schedule();
 
 	ll->rap = LE_CSR0;
 	ll->rdp = LE_C0_STOP;
@@ -727,7 +735,7 @@
 }
 
 
-int a2065_probe(struct device *dev)
+__initfunc(int a2065_probe(struct device *dev))
 {
 	int key1, key2 = 0;
 	struct ConfigDev *cd;

FUNET's LINUX-ADM group, linux-adm@nic.funet.fi
TCL-scripts by Sam Shen, slshen@lbl.gov