参照元†
- struct device *dev
- const struct snd_soc_component_driver *cmpnt_drv
- struct snd_soc_dai_driver *dai_drv
- int num_dai
返り値†
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;
cmpnt = kzalloc(sizeof(*cmpnt), GFP_KERNEL);
if (!cmpnt) {
dev_err(dev, "ASoC: Failed to allocate memory\n");
return -ENOMEM;
}
ret = snd_soc_component_initialize(cmpnt, cmpnt_drv, dev);
if (ret)
goto err_free;
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;
}
snd_soc_component_add(cmpnt);
return 0;
err_cleanup:
snd_soc_component_cleanup(cmpnt);
err_free:
kfree(cmpnt);
return ret;
}
EXPORT_SYMBOL_GPL(snd_soc_register_component);
コメント†