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 @@ -48,51 +48,54 @@ int idx; }; static SLIST_HEAD(, feedertab_entry) feedertab; +static int feedercnt = 0; /*****************************************************************************/ -void -feeder_register(void *p) +static void +feeder_register_root(void *p) { - static int feedercnt = 0; - struct feeder_class *fc = p; struct feedertab_entry *fte; - int i; - - if (feedercnt == 0) { - KASSERT(fc->desc == NULL, ("first feeder not root: %s", fc->name)); - - SLIST_INIT(&feedertab); - fte = malloc(sizeof(*fte), M_FEEDER, M_NOWAIT | M_ZERO); - if (fte == NULL) { - printf("can't allocate memory for root feeder: %s\n", - fc->name); - return; - } - fte->feederclass = fc; - fte->desc = NULL; - fte->idx = feedercnt; - SLIST_INSERT_HEAD(&feedertab, fte, link); - feedercnt++; - - /* we've got our root feeder so don't veto pcm loading anymore */ - pcm_veto_load = 0; + KASSERT(fc->desc == NULL, ("first feeder not root: %s", fc->name)); + SLIST_INIT(&feedertab); + fte = malloc(sizeof(*fte), M_FEEDER, M_NOWAIT | M_ZERO); + if (fte == NULL) { + printf("can't allocate memory for root feeder: %s\n", fc->name); return; } + fte->feederclass = fc; + fte->desc = NULL; + fte->idx = feedercnt; + SLIST_INSERT_HEAD(&feedertab, fte, link); + feedercnt++; + + /* we've got our root feeder so don't veto pcm loading anymore */ + pcm_veto_load = 0; +} + +void +feeder_register(void *p) +{ + struct feeder_class *fc = p; + struct feedertab_entry *fte; + int i; KASSERT(fc->desc != NULL, ("feeder '%s' has no descriptor", fc->name)); - /* beyond this point failure is non-fatal but may result in some translations being unavailable */ + /* + * beyond this point failure is non-fatal but may result in some + * translations being unavailable + */ i = 0; while ((feedercnt < MAXFEEDERS) && (fc->desc[i].type > 0)) { - /* printf("adding feeder %s, %x -> %x\n", fc->name, fc->desc[i].in, fc->desc[i].out); */ fte = malloc(sizeof(*fte), M_FEEDER, M_NOWAIT | M_ZERO); if (fte == NULL) { - printf("can't allocate memory for feeder '%s', %x -> %x\n", fc->name, fc->desc[i].in, fc->desc[i].out); - + printf("can't allocate memory for feeder '%s', " + "%x -> %x\n", + fc->name, fc->desc[i].in, fc->desc[i].out); return; } fte->feederclass = fc; @@ -103,8 +106,10 @@ i++; } feedercnt++; - if (feedercnt >= MAXFEEDERS) - printf("MAXFEEDERS (%d >= %d) exceeded\n", feedercnt, MAXFEEDERS); + if (feedercnt >= MAXFEEDERS) { + printf("MAXFEEDERS (%d >= %d) exceeded\n", + feedercnt, MAXFEEDERS); + } } static void @@ -469,5 +474,6 @@ .desc = NULL, .data = NULL, }; -SYSINIT(feeder_root, SI_SUB_DRIVERS, SI_ORDER_FIRST, feeder_register, &feeder_root_class); +SYSINIT(feeder_root, SI_SUB_DRIVERS, SI_ORDER_FIRST, feeder_register_root, + &feeder_root_class); SYSUNINIT(feeder_root, SI_SUB_DRIVERS, SI_ORDER_FIRST, feeder_unregisterall, NULL);