Merge branch 'topic/component' of git://git.kernel.org/pub/scm/linux/kernel/git/broon...
[muen/linux.git] / sound / soc / soc-core.c
index 6ec127346e9c457df78ba125cb274029ca895fdf..166b6d218fe5c1f0da73c9a69b6d0e574c35df52 100644 (file)
@@ -3404,20 +3404,14 @@ static void snd_soc_component_del_unlocked(struct snd_soc_component *component)
        list_del(&component->list);
 }
 
-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)
+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)
 {
-       struct snd_soc_component *component;
        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);
        if (ret)
                goto err_free;
@@ -3441,6 +3435,24 @@ err_free:
        kfree(component);
        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);
 
 /**