=================================================================== RCS file: /cvsrepo/anoncvs/cvs/src/usr.bin/sndiod/dev.c,v retrieving revision 1.54 retrieving revision 1.55 diff -c -r1.54 -r1.55 *** src/usr.bin/sndiod/dev.c 2019/07/12 06:30:55 1.54 --- src/usr.bin/sndiod/dev.c 2019/08/29 07:07:33 1.55 *************** *** 1,4 **** ! /* $OpenBSD: dev.c,v 1.54 2019/07/12 06:30:55 ratchov Exp $ */ /* * Copyright (c) 2008-2012 Alexandre Ratchov * --- 1,4 ---- ! /* $OpenBSD: dev.c,v 1.55 2019/08/29 07:07:33 ratchov Exp $ */ /* * Copyright (c) 2008-2012 Alexandre Ratchov * *************** *** 1108,1122 **** } /* ! * force the device to go in DEV_CFG state, the caller is supposed to ! * ensure buffers are drained */ void ! dev_close(struct dev *d) { int i; struct slot *s; #ifdef DEBUG if (log_level >= 3) { dev_log(d); --- 1108,1136 ---- } /* ! * 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 + * ensure buffers are drained + */ + void + dev_close(struct dev *d) + { #ifdef DEBUG if (log_level >= 3) { dev_log(d); *************** *** 1124,1135 **** } #endif d->pstate = DEV_CFG; ! 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; dev_sio_close(d); if (d->mode & MODE_PLAY) { if (d->encbuf != NULL) --- 1138,1144 ---- } #endif d->pstate = DEV_CFG; ! dev_exitall(d); dev_sio_close(d); if (d->mode & MODE_PLAY) { if (d->encbuf != NULL)