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.
This commit is contained in:
Alexandre Ratchov 2020-04-13 07:43:00 +02:00
parent ea0520142e
commit fab9b7cb7e
1 changed files with 9 additions and 1 deletions

View File

@ -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",