Linux Sound subsystem development
 help / color / mirror / Atom feed
From: Cezary Rojewski <cezary.rojewski@intel.com>
To: broonie@kernel.org, linux-sound@vger.kernel.org
Cc: tiwai@suse.com, perex@perex.cz, amade@asmblr.net,
	linux-kernel@vger.kernel.org, kuninori.morimoto.gx@renesas.com,
	Cezary Rojewski <cezary.rojewski@intel.com>
Subject: [PATCH 7/7] ASoC: core: Remove unused component-register members
Date: Wed,  7 Oct 2026 15:33:53 +0200	[thread overview]
Message-ID: <20261007133353.455185-8-cezary.rojewski@intel.com> (raw)
In-Reply-To: <20261007133353.455185-1-cezary.rojewski@intel.com>

With the new component constructor, functions snd_soc_component_alloc(),
snd_soc_component_set_name() and soc_component_initialize() become
unused. Remove them and drop the generic macro as there is only one
snd_soc_register_component() function.

Cc: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
Signed-off-by: Cezary Rojewski <cezary.rojewski@intel.com>
---
 include/sound/soc-component.h |  2 --
 include/sound/soc.h           |  8 +-----
 sound/soc/soc-component.c     | 19 ------------
 sound/soc/soc-core.c          | 54 ++++-------------------------------
 4 files changed, 6 insertions(+), 77 deletions(-)

diff --git a/include/sound/soc-component.h b/include/sound/soc-component.h
index f4d4f836269e..ac5e9412582e 100644
--- a/include/sound/soc-component.h
+++ b/include/sound/soc-component.h
@@ -297,9 +297,7 @@ struct snd_soc_component *snd_soc_component_new(struct device *dev, const char *
 int snd_soc_component_register(struct snd_soc_component *component,
 			       struct snd_soc_dai_driver *dai_drv,
 			       int num_dai);
-struct snd_soc_component *snd_soc_component_alloc(struct device *dev);
 
-void snd_soc_component_set_name(struct snd_soc_component *component, const char *name);
 const char *snd_soc_component_name(struct snd_soc_component *component);
 
 void snd_soc_component_set_priv(struct snd_soc_component *component, void *priv);
diff --git a/include/sound/soc.h b/include/sound/soc.h
index 553bb7e2be98..08fdee15dba7 100644
--- a/include/sound/soc.h
+++ b/include/sound/soc.h
@@ -447,15 +447,9 @@ static inline int snd_soc_resume(struct device *dev)
 }
 #endif
 int snd_soc_poweroff(struct device *dev);
-int snd_soc_register_component_c(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_d(struct device *dev,
+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);
-#define snd_soc_register_component(x, ...) _Generic((x),		\
-struct device * :		snd_soc_register_component_d, \
-struct snd_soc_component * :	snd_soc_register_component_c)(x, __VA_ARGS__)
 
 int devm_snd_soc_register_component(struct device *dev,
 			 const struct snd_soc_component_driver *component_driver,
diff --git a/sound/soc/soc-component.c b/sound/soc/soc-component.c
index 463ea227cac8..34efb270ce29 100644
--- a/sound/soc/soc-component.c
+++ b/sound/soc/soc-component.c
@@ -29,25 +29,6 @@ static inline int _soc_component_ret_reg_rw(struct snd_soc_component *component,
 			   func, component->name, reg);
 }
 
-struct snd_soc_component *snd_soc_component_alloc(struct device *dev)
-{
-	struct snd_soc_component *component = devm_kzalloc(dev, sizeof(*component), GFP_KERNEL);
-
-	if (!component)
-		return NULL;
-
-	component->dev = dev;
-
-	return component;
-}
-EXPORT_SYMBOL_GPL(snd_soc_component_alloc);
-
-void snd_soc_component_set_name(struct snd_soc_component *component, const char *name)
-{
-	component->name = name;
-}
-EXPORT_SYMBOL_GPL(snd_soc_component_set_name);
-
 const char *snd_soc_component_name(struct snd_soc_component *component)
 {
 	return component->name;
diff --git a/sound/soc/soc-core.c b/sound/soc/soc-core.c
index 93bc7fa32444..69181cc0258b 100644
--- a/sound/soc/soc-core.c
+++ b/sound/soc/soc-core.c
@@ -2560,35 +2560,6 @@ static void snd_soc_del_component_unlocked(struct snd_soc_component *component)
 	list_del(&component->list);
 }
 
-static int soc_component_initialize(struct snd_soc_component *component,
-				    const struct snd_soc_component_driver *driver)
-{
-	struct device *dev = component->dev;
-
-	component->dapm = snd_soc_dapm_alloc(dev);
-	if (!component->dapm)
-		return -ENOMEM;
-
-	INIT_LIST_HEAD(&component->dai_list);
-	INIT_LIST_HEAD(&component->dobj_list);
-	INIT_LIST_HEAD(&component->card_list);
-	INIT_LIST_HEAD(&component->list);
-	INIT_LIST_HEAD(&component->card_aux_list);
-	mutex_init(&component->io_mutex);
-
-	if (!component->name) {
-		component->name = snd_soc_fmt_single_name(dev, NULL);
-		if (!component->name) {
-			dev_err(dev, "ASoC: Failed to allocate name\n");
-			return -ENOMEM;
-		}
-	}
-
-	component->driver	= driver;
-
-	return 0;
-}
-
 struct snd_soc_component *snd_soc_component_new(struct device *dev, const char *name,
 						const struct snd_soc_component_driver *driver)
 {
@@ -2668,25 +2639,10 @@ int snd_soc_component_register(struct snd_soc_component *component,
 }
 EXPORT_SYMBOL_GPL(snd_soc_component_register);
 
-int snd_soc_register_component_c(struct snd_soc_component *component,
-			const struct snd_soc_component_driver *component_driver,
-			struct snd_soc_dai_driver *dai_drv,
-			int num_dai)
-{
-	int ret;
-
-	ret = soc_component_initialize(component, component_driver);
-	if (ret < 0)
-		return ret;
-
-	return snd_soc_component_register(component, dai_drv, num_dai);
-}
-EXPORT_SYMBOL_GPL(snd_soc_register_component_c);
-
-int snd_soc_register_component_d(struct device *dev,
-				 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)
 {
 	struct snd_soc_component *component;
 
@@ -2696,7 +2652,7 @@ int snd_soc_register_component_d(struct device *dev,
 
 	return snd_soc_component_register(component, dai_drv, num_dai);
 }
-EXPORT_SYMBOL_GPL(snd_soc_register_component_d);
+EXPORT_SYMBOL_GPL(snd_soc_register_component);
 
 /**
  * snd_soc_unregister_component_by_driver - Unregister component using a given driver
-- 
2.34.1


      parent reply	other threads:[~2026-10-07 13:28 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-10-07 13:33 [PATCH 0/7] ASoC: core: Create new components in sane state Cezary Rojewski
2026-10-07 13:33 ` [PATCH 1/7] ASoC: core: Add component constructor Cezary Rojewski
2026-10-07 13:33 ` [PATCH 2/7] ASoC: core: Rename and export soc_component_add() Cezary Rojewski
2026-10-07 13:33 ` [PATCH 3/7] ASoC: dmaengine: Switch to snd_snd_component_new() Cezary Rojewski
2026-10-07 13:33 ` [PATCH 4/7] ASoC: topology-test: " Cezary Rojewski
2026-10-07 13:33 ` [PATCH 5/7] ASoC: Intel: catpt: " Cezary Rojewski
2026-10-07 13:33 ` [PATCH 6/7] ASoC: Intel: avs: " Cezary Rojewski
2026-10-07 13:33 ` Cezary Rojewski [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20261007133353.455185-8-cezary.rojewski@intel.com \
    --to=cezary.rojewski@intel.com \
    --cc=amade@asmblr.net \
    --cc=broonie@kernel.org \
    --cc=kuninori.morimoto.gx@renesas.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-sound@vger.kernel.org \
    --cc=perex@perex.cz \
    --cc=tiwai@suse.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox