diff --git a/sys/dev/sound/pcm/vchan.c b/sys/dev/sound/pcm/vchan.c --- a/sys/dev/sound/pcm/vchan.c +++ b/sys/dev/sound/pcm/vchan.c @@ -497,9 +497,7 @@ KASSERT(direction == c->direction, ("%s(): invalid direction %d/%d", __func__, direction, c->direction)); - CHN_LOCK(c); - newspd = c->speed; - CHN_UNLOCK(c); + newspd = *vchanrate; ret = sysctl_handle_int(oidp, &newspd, 0, req); if (ret != 0 || req->newptr == NULL) { @@ -527,10 +525,10 @@ newspd = CHANNEL_SETSPEED(c->methods, c->devinfo, newspd); } + *vchanrate = newspd; ret = chn_reset(c, c->format, newspd); if (ret == 0) { - *vchanrate = c->speed; if (restart != 0) { CHN_FOREACH(ch, c, children.busy) { CHN_LOCK(ch); @@ -605,15 +603,11 @@ KASSERT(direction == c->direction, ("%s(): invalid direction %d/%d", __func__, direction, c->direction)); - CHN_LOCK(c); - bzero(fmtstr, sizeof(fmtstr)); - if (snd_afmt2str(c->format, fmtstr, sizeof(fmtstr)) != c->format) + if (snd_afmt2str(*vchanformat, fmtstr, sizeof(fmtstr)) != *vchanformat) strlcpy(fmtstr, "", sizeof(fmtstr)); - CHN_UNLOCK(c); - ret = sysctl_handle_string(oidp, fmtstr, sizeof(fmtstr), req); if (ret != 0 || req->newptr == NULL) { PCM_RELEASE_QUICK(d); @@ -634,10 +628,10 @@ restart = 1; } else restart = 0; + *vchanformat = newfmt; ret = chn_reset(c, newfmt, c->speed); if (ret == 0) { - *vchanformat = c->format; if (restart != 0) { CHN_FOREACH(ch, c, children.busy) { CHN_LOCK(ch);