mirror of https://github.com/ericonr/sndio.git
Move code to disconnect all clients to its own routine.
This commit is contained in:
parent
9f85e83893
commit
7933511f57
27
sndiod/dev.c
27
sndiod/dev.c
|
@ -1108,6 +1108,23 @@ dev_open(struct dev *d)
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Force all slots to exit
|
||||||
|
*/
|
||||||
|
void
|
||||||
|
dev_exitall(struct dev *d)
|
||||||
|
{
|
||||||
|
int i;
|
||||||
|
struct slot *s;
|
||||||
|
|
||||||
|
for (s = d->slot, i = DEV_NSLOT; i > 0; i--, s++) {
|
||||||
|
if (s->ops)
|
||||||
|
s->ops->exit(s->arg);
|
||||||
|
s->ops = NULL;
|
||||||
|
}
|
||||||
|
d->slot_list = NULL;
|
||||||
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* force the device to go in DEV_CFG state, the caller is supposed to
|
* force the device to go in DEV_CFG state, the caller is supposed to
|
||||||
* ensure buffers are drained
|
* ensure buffers are drained
|
||||||
|
@ -1115,9 +1132,6 @@ dev_open(struct dev *d)
|
||||||
void
|
void
|
||||||
dev_close(struct dev *d)
|
dev_close(struct dev *d)
|
||||||
{
|
{
|
||||||
int i;
|
|
||||||
struct slot *s;
|
|
||||||
|
|
||||||
#ifdef DEBUG
|
#ifdef DEBUG
|
||||||
if (log_level >= 3) {
|
if (log_level >= 3) {
|
||||||
dev_log(d);
|
dev_log(d);
|
||||||
|
@ -1125,12 +1139,7 @@ dev_close(struct dev *d)
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
d->pstate = DEV_CFG;
|
d->pstate = DEV_CFG;
|
||||||
for (s = d->slot, i = DEV_NSLOT; i > 0; i--, s++) {
|
dev_exitall(d);
|
||||||
if (s->ops)
|
|
||||||
s->ops->exit(s->arg);
|
|
||||||
s->ops = NULL;
|
|
||||||
}
|
|
||||||
d->slot_list = NULL;
|
|
||||||
dev_sio_close(d);
|
dev_sio_close(d);
|
||||||
if (d->mode & MODE_PLAY) {
|
if (d->mode & MODE_PLAY) {
|
||||||
if (d->encbuf != NULL)
|
if (d->encbuf != NULL)
|
||||||
|
|
Loading…
Reference in New Issue