git: 9front

Download patch

ref: 6cf1143a3c4db68007abd4f40fcbd0778a277ceb
parent: a2fea3ad5c4960a4ad5542d403f6ef029b98f593
author: cinap_lenrek <cinap_lenrek@gmx.de>
date: Thu Jan 31 18:43:04 EST 2013

usbehci: remove panic() calls from interrupts if stuff isnt ready (spurious interrupts?)

--- a/sys/src/9/port/usbehci.c
+++ b/sys/src/9/port/usbehci.c
@@ -1338,8 +1338,7 @@
 	Itd *tdi;
 
 	tdi = iso->tdi;
-	assert(tdi != nil);
-	if(itdactive(tdi))			/* not all tds are done */
+	if(tdi == nil || itdactive(tdi))			/* not all tds are done */
 		return 0;
 	ctlr->nisointr++;
 	ddiprint("isohsintr: iso %#p: tdi %#p tdu %#p\n", iso, tdi, iso->tdu);
@@ -1409,8 +1408,7 @@
 	Sitd *stdi;
 
 	stdi = iso->stdi;
-	assert(stdi != nil);
-	if((stdi->csw & Stdactive) != 0)		/* nothing new done */
+	if(stdi == nil || (stdi->csw & Stdactive) != 0)		/* nothing new done */
 		return 0;
 	ctlr->nisointr++;
 	ddiprint("isofsintr: iso %#p: tdi %#p tdu %#p\n", iso, stdi, iso->stdu);
@@ -1479,7 +1477,7 @@
 		panic("qhinterrupt: qh state");
 	td = qh->tds;
 	if(td == nil)
-		panic("qhinterrupt: no tds");
+		return 0;
 	if((td->csw & Tdactive) == 0)
 		ddqprint("qhinterrupt port %#p qh %#p\n", ctlr->capio, qh);
 	for(; td != nil; td = td->next){
@@ -1583,8 +1581,8 @@
 		qh = ctlr->qhs;
 		i = 0;
 		do{
-			if (qh == nil)
-				panic("ehciintr: nil qh");
+			if(qh == nil)
+				break;
 			if(qh->state == Qrun)
 				some += qhinterrupt(ctlr, qh);
 			qh = qh->next;
@@ -1592,8 +1590,6 @@
 		if(i > 100)
 			print("echi: interrupt: qh loop?\n");
 	}
-//	if (some == 0)
-//		panic("ehciintr: no work");
 	iunlock(ctlr);
 	return some;
 }
--