patch-2.1.67 linux/drivers/net/ibmtr.c

Next file: linux/drivers/net/ibmtr.h
Previous file: linux/drivers/net/hydra.c
Back to the patch index
Back to the overall index

diff -u --recursive --new-file v2.1.66/linux/drivers/net/ibmtr.c linux/drivers/net/ibmtr.c
@@ -267,6 +267,7 @@
 	struct tok_info *ti=0;
 	__u32 cd_chanid;
 	unsigned char *tchanid, ctemp;
+	unsigned long timeout;
 
 #ifndef MODULE
 	dev = init_trdev(dev,0);
@@ -406,10 +407,14 @@
 				irq=10;
 			if (intr==3)
 				irq=11;
-			/*
-			 *	FIXME: this wait should have a timeout
-			 */
-			while(!readb(ti->mmio + ACA_OFFSET + ACA_RW + RRR_EVEN));
+
+			timeout = jiffies + TR_SPIN_INTERVAL;
+			while(!readb(ti->mmio + ACA_OFFSET + ACA_RW + RRR_EVEN))
+				if (jiffies > timeout) {
+					DPRINTK("Hardware timeout during initialization.\n");
+					kfree_s(ti, sizeof(struct tok_info));
+					return -ENODEV;
+			        }
 			ti->sram=((__u32)readb(ti->mmio + ACA_OFFSET + ACA_RW + RRR_EVEN)<<12);
 			ti->global_int_enable=PIOaddr+ADAPTINTREL;
 			ti->adapter_int_enable=PIOaddr+ADAPTINTREL;
@@ -1474,12 +1479,6 @@
 		DPRINTK("Arrg. Transmitter busy.\n");
 		dev->trans_start+=5; /* we fake the transmission start time... */
 		return 1;
-	}
-
-	/* Donald does this, so we do too. */
-	if (skb==NULL) {
-		dev_tint(dev);
-		return 0;
 	}
 
 	if (test_and_set_bit(0,(void *)&dev->tbusy)!=0)

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