ref: b38f538653510b92aebe6414a8125bf53d01d2b1
parent: 99bb321278367a6017f67763c7cabecc75ab4b43
author: cinap_lenrek <cinap_lenrek@localhost>
date: Fri Aug 19 01:19:10 EDT 2011
usb: fix potential uninterruptable calls
--- a/sys/src/9/pc/usbohci.c
+++ b/sys/src/9/pc/usbohci.c
@@ -1474,7 +1474,7 @@
print("\t%s\n", buf);}
if(mustlock){- qlock(io);
+ eqlock(io);
if(waserror()){qunlock(io);
nexterror();
@@ -1614,7 +1614,7 @@
switch(ep->ttype){case Tctl:
cio = ep->aux;
- qlock(cio);
+ eqlock(cio);
if(waserror()){qunlock(cio);
nexterror();
@@ -1687,7 +1687,7 @@
cio, ep->dev->nb, ep->nb, count);
if(count < Rsetuplen)
error("short usb command");- qlock(cio);
+ eqlock(cio);
free(cio->data);
cio->data = nil;
cio->ndata = 0;
@@ -1795,7 +1795,7 @@
iso->delay = (ep->sampledelay*ep->samplesz + ep->maxpkt-1) / ep->maxpkt;
iso->debug = ep->debug;
- qlock(iso);
+ eqlock(iso);
if(waserror()){qunlock(iso);
nexterror();
@@ -2186,7 +2186,7 @@
return 0;
ctlr = hp->aux;
- qlock(&ctlr->resetl);
+ eqlock(&ctlr->resetl);
if(waserror()){qunlock(&ctlr->resetl);
nexterror();
@@ -2218,7 +2218,7 @@
ctlr = hp->aux;
dprint("ohci: %#p port %d enable=%d\n", ctlr->ohci, port, on);- qlock(&ctlr->resetl);
+ eqlock(&ctlr->resetl);
if(waserror()){qunlock(&ctlr->resetl);
nexterror();
--- a/sys/src/9/pc/usbuhci.c
+++ b/sys/src/9/pc/usbuhci.c
@@ -1031,7 +1031,7 @@
diprint("uhci: episowrite: %#p ep%d.%d\n", iso, ep->dev->nb, ep->nb);ctlr = ep->hp->aux;
- qlock(iso);
+ eqlock(iso);
if(waserror()){qunlock(iso);
nexterror();
@@ -1104,7 +1104,7 @@
b = a;
ctlr = ep->hp->aux;
- qlock(iso);
+ eqlock(iso);
if(waserror()){qunlock(iso);
nexterror();
@@ -1303,7 +1303,7 @@
print("uchi epio: user data: %s\n", buf);}
if(mustlock){- qlock(io);
+ eqlock(io);
if(waserror()){qunlock(io);
nexterror();
@@ -1442,7 +1442,7 @@
switch(ep->ttype){case Tctl:
cio = ep->aux;
- qlock(cio);
+ eqlock(cio);
if(waserror()){qunlock(cio);
nexterror();
@@ -1515,7 +1515,7 @@
cio, ep->dev->nb, ep->nb, count);
if(count < Rsetuplen)
error("short usb comand");- qlock(cio);
+ eqlock(cio);
free(cio->data);
cio->data = nil;
cio->ndata = 0;
@@ -2001,7 +2001,7 @@
ctlr = hp->aux;
dprint("uhci: %#x port %d enable=%d\n", ctlr->port, port, on);ioport = PORT(port-1);
- qlock(&ctlr->portlck);
+ eqlock(&ctlr->portlck);
if(waserror()){qunlock(&ctlr->portlck);
nexterror();
@@ -2058,7 +2058,7 @@
ctlr = hp->aux;
ioport = PORT(port-1);
- qlock(&ctlr->portlck);
+ eqlock(&ctlr->portlck);
if(waserror()){iunlock(ctlr);
qunlock(&ctlr->portlck);
--- a/sys/src/9/port/usbehci.c
+++ b/sys/src/9/port/usbehci.c
@@ -1611,7 +1611,7 @@
ctlr = hp->aux;
opio = ctlr->opio;
s = opio->portsc[port-1];
- qlock(&ctlr->portlck);
+ eqlock(&ctlr->portlck);
if(waserror()){qunlock(&ctlr->portlck);
nexterror();
@@ -1672,7 +1672,7 @@
ctlr = hp->aux;
opio = ctlr->opio;
- qlock(&ctlr->portlck);
+ eqlock(&ctlr->portlck);
if(waserror()){iunlock(ctlr);
qunlock(&ctlr->portlck);
@@ -1717,7 +1717,7 @@
ctlr = hp->aux;
opio = ctlr->opio;
- qlock(&ctlr->portlck);
+ eqlock(&ctlr->portlck);
if(waserror()){iunlock(ctlr);
qunlock(&ctlr->portlck);
@@ -1936,7 +1936,7 @@
b = a;
ctlr = ep->hp->aux;
- qlock(iso);
+ eqlock(iso);
if(waserror()){qunlock(iso);
nexterror();
@@ -2039,7 +2039,7 @@
diprint("ehci: episowrite: %#p ep%d.%d\n", iso, ep->dev->nb, ep->nb);ctlr = ep->hp->aux;
- qlock(iso);
+ eqlock(iso);
if(waserror()){qunlock(iso);
nexterror();
@@ -2333,7 +2333,7 @@
print("echi epio: user data: %s\n", buf);}
if(mustlock){- qlock(io);
+ eqlock(io);
if(waserror()){qunlock(io);
nexterror();
@@ -2459,7 +2459,7 @@
switch(ep->ttype){case Tctl:
cio = ep->aux;
- qlock(cio);
+ eqlock(cio);
if(waserror()){qunlock(cio);
nexterror();
@@ -2530,7 +2530,7 @@
cio, ep->dev->nb, ep->nb, count);
if(count < Rsetuplen)
error("short usb comand");- qlock(cio);
+ eqlock(cio);
free(cio->data);
cio->data = nil;
cio->ndata = 0;
--
⑨