*参照元 [#zfa5f039] #backlinks *説明 [#c6d0cd7c] -パス: [[linux-4.4.1/sound/soc/soc-core.c]] -FIXME: これは何? --説明 **引数 [#z10689a1] -struct snd_soc_component *component -- --[[linux-4.4.1/snd_soc_component]] -struct snd_soc_dai_driver *dai_drv -- --[[linux-4.4.1/snd_soc_dai_driver]] -size_t count -- -bool legacy_dai_naming -- **返り値 [#y85edf0d] -int -- **参考 [#e314442b] *実装 [#db9906dd] /** * snd_soc_register_dais - Register a DAI with the ASoC core * * @component: The component the DAIs are registered for * @dai_drv: DAI driver to use for the DAIs * @count: Number of DAIs * @legacy_dai_naming: Use the legacy naming scheme and let the DAI inherit the * parent's name. */ static int snd_soc_register_dais(struct snd_soc_component *component, struct snd_soc_dai_driver *dai_drv, size_t count, bool legacy_dai_naming) { struct device *dev = component->dev; struct snd_soc_dai *dai; unsigned int i; int ret; - --[[linux-4.4.1/device]] --[[linux-4.4.1/snd_soc_dai]] dev_dbg(dev, "ASoC: dai register %s #%Zu\n", dev_name(dev), count); - --[[linux-4.4.1/dev_dbg()]] --[[linux-4.4.1/dev_name()]] component->dai_drv = dai_drv; component->num_dai = count; for (i = 0; i < count; i++) { dai = kzalloc(sizeof(struct snd_soc_dai), GFP_KERNEL); if (dai == NULL) { ret = -ENOMEM; goto err; } - --[[linux-4.4.1/kzalloc()]] /* * Back in the old days when we still had component-less DAIs, * instead of having a static name, component-less DAIs would * inherit the name of the parent device so it is possible to * register multiple instances of the DAI. We still need to keep * the same naming style even though those DAIs are not * component-less anymore. */ if (count == 1 && legacy_dai_naming && (dai_drv[i].id == 0 || dai_drv[i].name == NULL)) { dai->name = fmt_single_name(dev, &dai->id); } else { dai->name = fmt_multiple_name(dev, &dai_drv[i]); if (dai_drv[i].id) dai->id = dai_drv[i].id; else dai->id = i; } - --[[linux-4.4.1/fmt_single_name()]] --[[linux-4.4.1/fmt_multiple_name()]] if (dai->name == NULL) { kfree(dai); ret = -ENOMEM; goto err; } - --[[linux-4.4.1/kfree()]] dai->component = component; dai->dev = dev; dai->driver = &dai_drv[i]; if (!dai->driver->ops) dai->driver->ops = &null_dai_ops; list_add(&dai->list, &component->dai_list); - --[[linux-4.4.1/list_add()]] dev_dbg(dev, "ASoC: Registered DAI '%s'\n", dai->name); } - --[[linux-4.4.1/dev_dbg()]] return 0; err: snd_soc_unregister_dais(component); - --[[linux-4.4.1/snd_soc_unregister_dais()]] return ret; } *コメント [#j4d0febf]