From mboxrd@z Thu Jan 1 00:00:00 1970 From: Kuninori Morimoto Subject: [PATCH 04/13] ASoC: soc-core: add snd_soc_add_component() Date: Fri, 1 Sep 2017 05:32:45 +0000 Message-ID: <87val3m1m3.wl%kuninori.morimoto.gx@renesas.com> References: <873787ngjb.wl%kuninori.morimoto.gx@renesas.com> <871snrngcu.wl%kuninori.morimoto.gx@renesas.com> Mime-Version: 1.0 (generated by SEMI-EPG 1.14.7 - "Harue") Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Return-path: Received: from relmlie3.idc.renesas.com (relmlor4.renesas.com [210.160.252.174]) by alsa0.perex.cz (Postfix) with ESMTP id 366762674D2 for ; Fri, 1 Sep 2017 07:32:48 +0200 (CEST) In-Reply-To: <871snrngcu.wl%kuninori.morimoto.gx@renesas.com> List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: alsa-devel-bounces@alsa-project.org Sender: alsa-devel-bounces@alsa-project.org To: Mark Brown Cc: Linux-ALSA , Lars-Peter List-Id: alsa-devel@alsa-project.org From: Kuninori Morimoto 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: Kuninori Morimoto --- include/sound/soc.h | 5 +++++ sound/soc/soc-core.c | 34 +++++++++++++++++++++++----------- 2 files changed, 28 insertions(+), 11 deletions(-) diff --git a/include/sound/soc.h b/include/sound/soc.h index 11ca867..eea3007 100644 --- a/include/sound/soc.h +++ b/include/sound/soc.h @@ -468,6 +468,11 @@ int snd_soc_register_codec(struct device *dev, const struct snd_soc_codec_driver *codec_drv, struct snd_soc_dai_driver *dai_drv, int num_dai); 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, const struct snd_soc_component_driver *component_driver, struct snd_soc_dai_driver *dai_drv, int num_dai); diff --git a/sound/soc/soc-core.c b/sound/soc/soc-core.c index 8442946..6448c27 100644 --- a/sound/soc/soc-core.c +++ b/sound/soc/soc-core.c @@ -3402,20 +3402,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; @@ -3439,6 +3433,24 @@ int snd_soc_register_component(struct device *dev, 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); /** -- 1.9.1