devaudio: serialize calls in devaudio, sb16: remove qlock
This commit is contained in:
parent
5a333eb240
commit
15cdb69f61
2 changed files with 11 additions and 26 deletions
|
@ -63,7 +63,6 @@ struct Blaster
|
|||
|
||||
struct Ctlr
|
||||
{
|
||||
QLock;
|
||||
Rendez vous;
|
||||
int active; /* boolean dma running */
|
||||
int major; /* SB16 major version number (sb 4) */
|
||||
|
@ -535,11 +534,6 @@ audiowrite(Audio *adev, void *vp, long n, vlong)
|
|||
p = vp;
|
||||
e = p + n;
|
||||
ctlr = adev->ctlr;
|
||||
qlock(ctlr);
|
||||
if(waserror()){
|
||||
qunlock(ctlr);
|
||||
nexterror();
|
||||
}
|
||||
ring = &ctlr->ring;
|
||||
while(p < e) {
|
||||
if((n = writering(ring, p, e - p)) <= 0){
|
||||
|
@ -552,9 +546,6 @@ audiowrite(Audio *adev, void *vp, long n, vlong)
|
|||
}
|
||||
p += n;
|
||||
}
|
||||
poperror();
|
||||
qunlock(ctlr);
|
||||
|
||||
return p - (uchar*)vp;
|
||||
}
|
||||
|
||||
|
@ -564,15 +555,8 @@ audioclose(Audio *adev)
|
|||
Ctlr *ctlr;
|
||||
|
||||
ctlr = adev->ctlr;
|
||||
qlock(ctlr);
|
||||
if(waserror()){
|
||||
qunlock(ctlr);
|
||||
nexterror();
|
||||
}
|
||||
sleep(&ctlr->vous, inactive, ctlr);
|
||||
setempty(ctlr);
|
||||
poperror();
|
||||
qunlock(ctlr);
|
||||
}
|
||||
|
||||
static long
|
||||
|
|
|
@ -269,6 +269,11 @@ audiowrite(Chan *c, void *a, long n, vlong off)
|
|||
if(fn == nil)
|
||||
error(Egreg);
|
||||
|
||||
qlock(ac);
|
||||
if(waserror()){
|
||||
qunlock(ac);
|
||||
nexterror();
|
||||
}
|
||||
switch((ulong)c->qid.path){
|
||||
case Qaudioctl:
|
||||
case Qvolume:
|
||||
|
@ -276,20 +281,16 @@ audiowrite(Chan *c, void *a, long n, vlong off)
|
|||
error(Etoobig);
|
||||
|
||||
/* copy data to audiochan buffer so it can be modified */
|
||||
qlock(ac);
|
||||
if(waserror()){
|
||||
qunlock(ac);
|
||||
nexterror();
|
||||
}
|
||||
ac->data = nil;
|
||||
memmove(ac->buf, a, n);
|
||||
ac->buf[n] = 0;
|
||||
n = fn(adev, ac->buf, n, 0);
|
||||
qunlock(ac);
|
||||
poperror();
|
||||
return n;
|
||||
a = ac->buf;
|
||||
off = 0;
|
||||
}
|
||||
return fn(adev, a, n, off);
|
||||
n = fn(adev, a, n, off);
|
||||
qunlock(ac);
|
||||
poperror();
|
||||
return n;
|
||||
}
|
||||
|
||||
static void
|
||||
|
|
Loading…
Reference in a new issue