*参照元 [#m7653eec] #backlinks *説明 [#a6ae4c3e] -パス: [[linux-4.4.1/sound/soc/soc-core.c]] -FIXME: これは何? --説明 **引数 [#db15ec6c] -struct device *dev -- --[[linux-4.4.1/device]] -const struct snd_soc_component_driver *cmpnt_drv -- --[[linux-4.4.1/snd_soc_component_driver]] -struct snd_soc_dai_driver *dai_drv -- --[[linux-4.4.1/snd_soc_dai_driver]] -int num_dai -- **返り値 [#y671ec66] -int -- **参考 [#tdf76197] *実装 [#a46d5a8f] int snd_soc_register_component(struct device *dev, const struct snd_soc_component_driver *cmpnt_drv, struct snd_soc_dai_driver *dai_drv, int num_dai) { struct snd_soc_component *cmpnt; int ret; - --[[linux-4.4.1/snd_soc_component]] cmpnt = kzalloc(sizeof(*cmpnt), GFP_KERNEL); if (!cmpnt) { dev_err(dev, "ASoC: Failed to allocate memory\n"); return -ENOMEM; } - --[[linux-4.4.1/kzalloc()]] --[[linux-4.4.1/dev_err()]] ret = snd_soc_component_initialize(cmpnt, cmpnt_drv, dev); if (ret) goto err_free; - --[[linux-4.4.1/snd_soc_component_initialize()]] cmpnt->ignore_pmdown_time = true; cmpnt->registered_as_component = true; ret = snd_soc_register_dais(cmpnt, dai_drv, num_dai, true); if (ret < 0) { dev_err(dev, "ASoC: Failed to register DAIs: %d\n", ret); goto err_cleanup; } - --[[linux-4.4.1/snd_soc_register_dais()]] snd_soc_component_add(cmpnt); - --[[linux-4.4.1/snd_soc_component_add()]] return 0; err_cleanup: snd_soc_component_cleanup(cmpnt); - --[[linux-4.4.1/snd_soc_component_cleanup()]] err_free: kfree(cmpnt); return ret; - --[[linux-4.4.1/kfree()]] } EXPORT_SYMBOL_GPL(snd_soc_register_component); - --[[linux-4.4.1/EXPORT_SYMBOL_GPL()]] *コメント [#b2b35ed6]