diff options
author | Alexandre Ratchov <ratchov@cvs.openbsd.org> | 2024-06-01 09:44:11 +0000 |
---|---|---|
committer | Alexandre Ratchov <ratchov@cvs.openbsd.org> | 2024-06-01 09:44:11 +0000 |
commit | 3609ddfefd6ad27c8ef38f597034d052a01230d1 (patch) | |
tree | 631336f96d14adde31ac0a36f26f043aa4427d7d /usr.bin/sndiod | |
parent | e61c8bbdcacb26dc6c6c72b083d399058c28d993 (diff) |
sndiod: Don't add/remove server.device entries in dev_{open,close}()
Fixes server.device entries disappearing when usb devices are unplugged
while in use. Found, analysed and tested by Laurie Tratt, thanks!
Diffstat (limited to 'usr.bin/sndiod')
-rw-r--r-- | usr.bin/sndiod/dev.c | 24 |
1 files changed, 1 insertions, 23 deletions
diff --git a/usr.bin/sndiod/dev.c b/usr.bin/sndiod/dev.c index bd2489354f7..47d13152e2f 100644 --- a/usr.bin/sndiod/dev.c +++ b/usr.bin/sndiod/dev.c @@ -1,4 +1,4 @@ -/* $OpenBSD: dev.c,v 1.116 2024/05/24 15:21:35 ratchov Exp $ */ +/* $OpenBSD: dev.c,v 1.117 2024/06/01 09:44:10 ratchov Exp $ */ /* * Copyright (c) 2008-2012 Alexandre Ratchov <alex@caoua.org> * @@ -1054,8 +1054,6 @@ dev_allocbufs(struct dev *d) int dev_open(struct dev *d) { - struct opt *o; - d->mode = d->reqmode; d->round = d->reqround; d->bufsz = d->reqbufsz; @@ -1078,18 +1076,6 @@ dev_open(struct dev *d) return 0; d->pstate = DEV_INIT; - - /* add server.device if device is opened after opt_ref() call */ - for (o = opt_list; o != NULL; o = o->next) { - if (o->refcnt > 0 && !ctl_find(CTL_OPT_DEV, o, d)) { - ctl_new(CTL_OPT_DEV, o, d, - CTL_SEL, dev_getdisplay(d), - o->name, "server", -1, "device", - d->name, -1, 1, o->dev == d); - d->refcnt++; - } - } - return 1; } @@ -1164,14 +1150,6 @@ dev_freebufs(struct dev *d) void dev_close(struct dev *d) { - struct opt *o; - - /* remove server.device entries */ - for (o = opt_list; o != NULL; o = o->next) { - if (ctl_del(CTL_OPT_DEV, o, d)) - d->refcnt--; - } - d->pstate = DEV_CFG; dev_sio_close(d); dev_freebufs(d); |