From fab9b7cb7e5aa20c0e0b4dd7a2581876743648e8 Mon Sep 17 00:00:00 2001 From: Alexandre Ratchov Date: Mon, 13 Apr 2020 07:43:00 +0200 Subject: [PATCH] Call dev_ctlsync(), even if there's no control device In the dev_reopen() code-path, the controls of the old device were removed so all clients must be notified about the controls change. --- sndiod/dev_sioctl.c | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/sndiod/dev_sioctl.c b/sndiod/dev_sioctl.c index d676bea..e3174c6 100644 --- a/sndiod/dev_sioctl.c +++ b/sndiod/dev_sioctl.c @@ -116,8 +116,16 @@ dev_sioctl_onval(void *arg, unsigned int addr, unsigned int val) void dev_sioctl_open(struct dev *d) { - if (d->sioctl.hdl == NULL) + if (d->sioctl.hdl == NULL) { + /* + * At this point there are clients, for instance if we're + * called by dev_reopen() but the control device couldn't + * be opened. In this case controls have changed (thoseof + * old device are just removed) so we need to notify clients. + */ + dev_ctlsync(d); return; + } sioctl_ondesc(d->sioctl.hdl, dev_sioctl_ondesc, d); sioctl_onval(d->sioctl.hdl, dev_sioctl_onval, d); d->sioctl.file = file_new(&dev_sioctl_ops, d, "mix",