提交 e0dac41b 编写于 作者: K Kuninori Morimoto 提交者: Mark Brown

ASoC: soc-core: add snd_soc_add_component()

ALSA SoC platform/codec will be replaced to component soon.
But, some function exist in "platform" doesn't exist in "component".
Current soc-core has snd_soc_register_component(), but
doesn't have snd_soc_add_component() like snd_soc_add_platform().
This patch adds it.
Signed-off-by: NKuninori Morimoto <kuninori.morimoto.gx@renesas.com>
Signed-off-by: NMark Brown <broonie@kernel.org>
上级 840bc448
...@@ -468,6 +468,11 @@ int snd_soc_register_codec(struct device *dev, ...@@ -468,6 +468,11 @@ int snd_soc_register_codec(struct device *dev,
const struct snd_soc_codec_driver *codec_drv, const struct snd_soc_codec_driver *codec_drv,
struct snd_soc_dai_driver *dai_drv, int num_dai); struct snd_soc_dai_driver *dai_drv, int num_dai);
void snd_soc_unregister_codec(struct device *dev); void snd_soc_unregister_codec(struct device *dev);
int snd_soc_add_component(struct device *dev,
struct snd_soc_component *component,
const struct snd_soc_component_driver *component_driver,
struct snd_soc_dai_driver *dai_drv,
int num_dai);
int snd_soc_register_component(struct device *dev, int snd_soc_register_component(struct device *dev,
const struct snd_soc_component_driver *component_driver, const struct snd_soc_component_driver *component_driver,
struct snd_soc_dai_driver *dai_drv, int num_dai); struct snd_soc_dai_driver *dai_drv, int num_dai);
......
...@@ -3371,20 +3371,14 @@ static void snd_soc_component_del_unlocked(struct snd_soc_component *component) ...@@ -3371,20 +3371,14 @@ static void snd_soc_component_del_unlocked(struct snd_soc_component *component)
list_del(&component->list); list_del(&component->list);
} }
int snd_soc_register_component(struct device *dev, int snd_soc_add_component(struct device *dev,
struct snd_soc_component *component,
const struct snd_soc_component_driver *component_driver, const struct snd_soc_component_driver *component_driver,
struct snd_soc_dai_driver *dai_drv, struct snd_soc_dai_driver *dai_drv,
int num_dai) int num_dai)
{ {
struct snd_soc_component *component;
int ret; int ret;
component = kzalloc(sizeof(*component), GFP_KERNEL);
if (!component) {
dev_err(dev, "ASoC: Failed to allocate memory\n");
return -ENOMEM;
}
ret = snd_soc_component_initialize(component, component_driver, dev); ret = snd_soc_component_initialize(component, component_driver, dev);
if (ret) if (ret)
goto err_free; goto err_free;
...@@ -3408,6 +3402,24 @@ int snd_soc_register_component(struct device *dev, ...@@ -3408,6 +3402,24 @@ int snd_soc_register_component(struct device *dev,
kfree(component); kfree(component);
return ret; return ret;
} }
EXPORT_SYMBOL_GPL(snd_soc_add_component);
int snd_soc_register_component(struct device *dev,
const struct snd_soc_component_driver *component_driver,
struct snd_soc_dai_driver *dai_drv,
int num_dai)
{
struct snd_soc_component *component;
component = kzalloc(sizeof(*component), GFP_KERNEL);
if (!component) {
dev_err(dev, "ASoC: Failed to allocate memory\n");
return -ENOMEM;
}
return snd_soc_add_component(dev, component, component_driver,
dai_drv, num_dai);
}
EXPORT_SYMBOL_GPL(snd_soc_register_component); EXPORT_SYMBOL_GPL(snd_soc_register_component);
/** /**
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册