usb: fix potential uninterruptable calls

front
cinap_lenrek 2011-08-19 05:19:10 +02:00
parent 0c1284f602
commit 79a044e38e
3 changed files with 21 additions and 21 deletions

View File

@ -1474,7 +1474,7 @@ epio(Ep *ep, Qio *io, void *a, long count, int mustlock)
print("\t%s\n", buf);
}
if(mustlock){
qlock(io);
eqlock(io);
if(waserror()){
qunlock(io);
nexterror();
@ -1614,7 +1614,7 @@ epread(Ep *ep, void *a, long count)
switch(ep->ttype){
case Tctl:
cio = ep->aux;
qlock(cio);
eqlock(cio);
if(waserror()){
qunlock(cio);
nexterror();
@ -1687,7 +1687,7 @@ epctlio(Ep *ep, Ctlio *cio, void *a, long count)
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 @@ episowrite(Ep *ep, void *a, long count)
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 @@ portreset(Hci *hp, int port, int on)
return 0;
ctlr = hp->aux;
qlock(&ctlr->resetl);
eqlock(&ctlr->resetl);
if(waserror()){
qunlock(&ctlr->resetl);
nexterror();
@ -2218,7 +2218,7 @@ portenable(Hci *hp, int port, int on)
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();

View File

@ -1031,7 +1031,7 @@ episowrite(Ep *ep, Isoio *iso, void *a, long count)
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 @@ episoread(Ep *ep, Isoio *iso, void *a, int count)
b = a;
ctlr = ep->hp->aux;
qlock(iso);
eqlock(iso);
if(waserror()){
qunlock(iso);
nexterror();
@ -1303,7 +1303,7 @@ epio(Ep *ep, Qio *io, void *a, long count, int mustlock)
print("uchi epio: user data: %s\n", buf);
}
if(mustlock){
qlock(io);
eqlock(io);
if(waserror()){
qunlock(io);
nexterror();
@ -1442,7 +1442,7 @@ epread(Ep *ep, void *a, long count)
switch(ep->ttype){
case Tctl:
cio = ep->aux;
qlock(cio);
eqlock(cio);
if(waserror()){
qunlock(cio);
nexterror();
@ -1515,7 +1515,7 @@ epctlio(Ep *ep, Ctlio *cio, void *a, long count)
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 @@ portenable(Hci *hp, int port, int on)
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 @@ portstatus(Hci *hp, int port)
ctlr = hp->aux;
ioport = PORT(port-1);
qlock(&ctlr->portlck);
eqlock(&ctlr->portlck);
if(waserror()){
iunlock(ctlr);
qunlock(&ctlr->portlck);

View File

@ -1611,7 +1611,7 @@ portenable(Hci *hp, int port, int on)
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 @@ portreset(Hci *hp, int port, int on)
ctlr = hp->aux;
opio = ctlr->opio;
qlock(&ctlr->portlck);
eqlock(&ctlr->portlck);
if(waserror()){
iunlock(ctlr);
qunlock(&ctlr->portlck);
@ -1717,7 +1717,7 @@ portstatus(Hci *hp, int port)
ctlr = hp->aux;
opio = ctlr->opio;
qlock(&ctlr->portlck);
eqlock(&ctlr->portlck);
if(waserror()){
iunlock(ctlr);
qunlock(&ctlr->portlck);
@ -1936,7 +1936,7 @@ episoread(Ep *ep, Isoio *iso, void *a, long count)
b = a;
ctlr = ep->hp->aux;
qlock(iso);
eqlock(iso);
if(waserror()){
qunlock(iso);
nexterror();
@ -2039,7 +2039,7 @@ episowrite(Ep *ep, Isoio *iso, void *a, long count)
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 @@ epio(Ep *ep, Qio *io, void *a, long count, int mustlock)
print("echi epio: user data: %s\n", buf);
}
if(mustlock){
qlock(io);
eqlock(io);
if(waserror()){
qunlock(io);
nexterror();
@ -2459,7 +2459,7 @@ epread(Ep *ep, void *a, long count)
switch(ep->ttype){
case Tctl:
cio = ep->aux;
qlock(cio);
eqlock(cio);
if(waserror()){
qunlock(cio);
nexterror();
@ -2530,7 +2530,7 @@ epctlio(Ep *ep, Ctlio *cio, void *a, long count)
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;