diff --git a/sys/dev/sound/pcm/sound.c b/sys/dev/sound/pcm/sound.c --- a/sys/dev/sound/pcm/sound.c +++ b/sys/dev/sound/pcm/sound.c @@ -316,7 +316,7 @@ else if (snd_unit_auto == 1) snd_unit = pcm_best_unit(snd_unit); - return (0); + return (dsp_make_dev(dev)); } uint32_t @@ -433,6 +433,15 @@ mode = pcm_mode_init(d); + sysctl_ctx_init(&d->play_sysctl_ctx); + d->play_sysctl_tree = SYSCTL_ADD_NODE(&d->play_sysctl_ctx, + SYSCTL_CHILDREN(device_get_sysctl_tree(dev)), OID_AUTO, "play", + CTLFLAG_RD | CTLFLAG_MPSAFE, 0, "playback channels node"); + sysctl_ctx_init(&d->rec_sysctl_ctx); + d->rec_sysctl_tree = SYSCTL_ADD_NODE(&d->rec_sysctl_ctx, + SYSCTL_CHILDREN(device_get_sysctl_tree(dev)), OID_AUTO, "rec", + CTLFLAG_RD | CTLFLAG_MPSAFE, 0, "recording channels node"); + /* XXX: a user should be able to set this with a control tool, the sysadmin then needs min+max sysctls for this */ SYSCTL_ADD_UINT(device_get_sysctl_ctx(dev), @@ -497,21 +506,12 @@ if ((numplay == 0 || numrec == 0) && numplay != numrec) d->flags |= SD_F_SIMPLEX; - sysctl_ctx_init(&d->play_sysctl_ctx); - d->play_sysctl_tree = SYSCTL_ADD_NODE(&d->play_sysctl_ctx, - SYSCTL_CHILDREN(device_get_sysctl_tree(dev)), OID_AUTO, "play", - CTLFLAG_RD | CTLFLAG_MPSAFE, 0, "playback channels node"); - sysctl_ctx_init(&d->rec_sysctl_ctx); - d->rec_sysctl_tree = SYSCTL_ADD_NODE(&d->rec_sysctl_ctx, - SYSCTL_CHILDREN(device_get_sysctl_tree(dev)), OID_AUTO, "rec", - CTLFLAG_RD | CTLFLAG_MPSAFE, 0, "recording channels node"); - if (numplay > 0 || numrec > 0) d->flags |= SD_F_AUTOVCHAN; sndstat_register(dev, d->status); - return (dsp_make_dev(dev)); + return (0); } int