diff --git a/sys/dev/sound/pcm/feeder.c b/sys/dev/sound/pcm/feeder.c --- a/sys/dev/sound/pcm/feeder.c +++ b/sys/dev/sound/pcm/feeder.c @@ -77,49 +77,6 @@ SLIST_INSERT_HEAD(&feedertab, fte, link); feedercnt++; - /* initialize global variables */ - - if (snd_verbose < 0 || snd_verbose > 4) - snd_verbose = 1; - - if (snd_unit < 0) - snd_unit = -1; - - if (snd_maxautovchans < 0 || - snd_maxautovchans > SND_MAXVCHANS) - snd_maxautovchans = 0; - - if (chn_latency < CHN_LATENCY_MIN || - chn_latency > CHN_LATENCY_MAX) - chn_latency = CHN_LATENCY_DEFAULT; - - if (chn_latency_profile < CHN_LATENCY_PROFILE_MIN || - chn_latency_profile > CHN_LATENCY_PROFILE_MAX) - chn_latency_profile = CHN_LATENCY_PROFILE_DEFAULT; - - if (feeder_rate_min < FEEDRATE_MIN || - feeder_rate_max < FEEDRATE_MIN || - feeder_rate_min > FEEDRATE_MAX || - feeder_rate_max > FEEDRATE_MAX || - !(feeder_rate_min < feeder_rate_max)) { - feeder_rate_min = FEEDRATE_RATEMIN; - feeder_rate_max = FEEDRATE_RATEMAX; - } - - if (feeder_rate_round < FEEDRATE_ROUNDHZ_MIN || - feeder_rate_round > FEEDRATE_ROUNDHZ_MAX) - feeder_rate_round = FEEDRATE_ROUNDHZ; - - if (bootverbose) - printf("%s: snd_unit=%d snd_maxautovchans=%d " - "latency=%d " - "feeder_rate_min=%d feeder_rate_max=%d " - "feeder_rate_round=%d\n", - __func__, snd_unit, snd_maxautovchans, - chn_latency, - feeder_rate_min, feeder_rate_max, - feeder_rate_round); - /* we've got our root feeder so don't veto pcm loading anymore */ pcm_veto_load = 0; 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 @@ -832,6 +832,51 @@ /************************************************************************/ +static void +sound_global_init(void) +{ + if (snd_verbose < 0 || snd_verbose > 4) + snd_verbose = 1; + + if (snd_unit < 0) + snd_unit = -1; + + if (snd_maxautovchans < 0 || + snd_maxautovchans > SND_MAXVCHANS) + snd_maxautovchans = 0; + + if (chn_latency < CHN_LATENCY_MIN || + chn_latency > CHN_LATENCY_MAX) + chn_latency = CHN_LATENCY_DEFAULT; + + if (chn_latency_profile < CHN_LATENCY_PROFILE_MIN || + chn_latency_profile > CHN_LATENCY_PROFILE_MAX) + chn_latency_profile = CHN_LATENCY_PROFILE_DEFAULT; + + if (feeder_rate_min < FEEDRATE_MIN || + feeder_rate_max < FEEDRATE_MIN || + feeder_rate_min > FEEDRATE_MAX || + feeder_rate_max > FEEDRATE_MAX || + !(feeder_rate_min < feeder_rate_max)) { + feeder_rate_min = FEEDRATE_RATEMIN; + feeder_rate_max = FEEDRATE_RATEMAX; + } + + if (feeder_rate_round < FEEDRATE_ROUNDHZ_MIN || + feeder_rate_round > FEEDRATE_ROUNDHZ_MAX) + feeder_rate_round = FEEDRATE_ROUNDHZ; + + if (bootverbose) + printf("%s: snd_unit=%d snd_maxautovchans=%d " + "latency=%d " + "feeder_rate_min=%d feeder_rate_max=%d " + "feeder_rate_round=%d\n", + __func__, snd_unit, snd_maxautovchans, + chn_latency, + feeder_rate_min, feeder_rate_max, + feeder_rate_round); +} + static int sound_modevent(module_t mod, int type, void *data) { @@ -846,6 +891,8 @@ vp_unr = new_unrhdr(0, INT_MAX, NULL); r_unr = new_unrhdr(0, INT_MAX, NULL); vr_unr = new_unrhdr(0, INT_MAX, NULL); + + sound_global_init(); break; case MOD_UNLOAD: if (pcmsg_unrhdr != NULL) {