Linux Sound subsystem development
 help / color / mirror / Atom feed
* [PATCH v3 01/12] ASoC: soc-component: move soc_component_field_shift()
  2026-07-06  2:01 [PATCH v3 00/12] ASoC: add and use new snd_soc_register_component() Kuninori Morimoto
@ 2026-07-03  1:19 ` Kuninori Morimoto
  2026-07-06  2:02 ` [PATCH v3 02/12] ASoC: soc-component: add snd_soc_component_alloc() Kuninori Morimoto
                   ` (11 subsequent siblings)
  12 siblings, 0 replies; 16+ messages in thread
From: Kuninori Morimoto @ 2026-07-03  1:19 UTC (permalink / raw)
  To: Bard Liao, bui duc phuc, Cezary Rojewski, Fabio Estevam,
	Jaroslav Kysela, Kai Vehmanen, Lars-Peter Clausen, Liam Girdwood,
	Mark Brown, Nicolin Chen, Peter Ujfalusi, Pierre-Louis Bossart,
	Shengjiu Wang, Takashi Iwai, Xiubo Li
  Cc: linux-sound

soc_component_field_shift() is used from
snd_soc_component_{read/write}_field(). It is better to located around
them.

Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
---
 sound/soc/soc-component.c | 24 ++++++++++++------------
 1 file changed, 12 insertions(+), 12 deletions(-)

diff --git a/sound/soc/soc-component.c b/sound/soc/soc-component.c
index 21492d15833f7..718246e53e896 100644
--- a/sound/soc/soc-component.c
+++ b/sound/soc/soc-component.c
@@ -29,18 +29,6 @@ static inline int _soc_component_ret_reg_rw(struct snd_soc_component *component,
 			   func, component->name, reg);
 }
 
-static inline int soc_component_field_shift(struct snd_soc_component *component,
-					    unsigned int mask)
-{
-	if (!mask) {
-		dev_err(component->dev,	"ASoC: error field mask is zero for %s\n",
-			component->name);
-		return 0;
-	}
-
-	return (ffs(mask) - 1);
-}
-
 /*
  * We might want to check substream by using list.
  * In such case, we can update these macros.
@@ -810,6 +798,18 @@ int snd_soc_component_update_bits_async(struct snd_soc_component *component,
 }
 EXPORT_SYMBOL_GPL(snd_soc_component_update_bits_async);
 
+static inline int soc_component_field_shift(struct snd_soc_component *component,
+					    unsigned int mask)
+{
+	if (!mask) {
+		dev_err(component->dev,	"ASoC: error field mask is zero for %s\n",
+			component->name);
+		return 0;
+	}
+
+	return (ffs(mask) - 1);
+}
+
 /**
  * snd_soc_component_read_field() - Read register field value
  * @component: Component to read from
-- 
2.53.0


^ permalink raw reply related	[flat|nested] 16+ messages in thread

* [PATCH v3 00/12] ASoC: add and use new snd_soc_register_component()
@ 2026-07-06  2:01 Kuninori Morimoto
  2026-07-03  1:19 ` [PATCH v3 01/12] ASoC: soc-component: move soc_component_field_shift() Kuninori Morimoto
                   ` (12 more replies)
  0 siblings, 13 replies; 16+ messages in thread
From: Kuninori Morimoto @ 2026-07-06  2:01 UTC (permalink / raw)
  To: "Amadeusz Sławiński", Bard Liao, bui duc phuc,
	Cezary Rojewski, Fabio Estevam, Jaroslav Kysela, Kai Vehmanen,
	Lars-Peter Clausen, Liam Girdwood, linux-sound, Mark Brown,
	Nicolin Chen, Peter Ujfalusi, Pierre-Louis Bossart, Shengjiu Wang,
	Takashi Iwai, Xiubo Li

Hi

Current component has component->name. But snd_soc_register_component()
user can't setup it, because component itself is alloced in that function.

So, to setup it, user need to use snd_soc_component_initialize() /
snd_soc_add_component() directly instead of using
snd_soc_register_component().

In the same time, Component will be capsuled soon.

Let's tidyup around here.
All strange code can be gone if we have both below style.

Normal case
	snd_soc_register_component(dev, ...);

Want to setup case
	component = snd_soc_component_alloc(...);

	snd_soc_component_set_xxx(component, ...);
	snd_soc_component_set_xxx(component, ...);

(A)	snd_soc_register_component(component, ...);

This patch-set adds new snd_soc_register_component() which allows to use
component (A).

Originally, this patch-set was posted as
	v1: ASoC: intel: use component_name for Component name
	v2: ASoC: add [devm_]snd_soc_register_component_with_name()

Link: https://lore.kernel.org/r/87fr29esth.wl-kuninori.morimoto.gx@renesas.com
Link: https://lore.kernel.org/r/87v7ayxk3s.wl-kuninori.morimoto.gx@renesas.com

Kuninori Morimoto (12):
  ASoC: soc-component: move soc_component_field_shift()
  ASoC: soc-component: add snd_soc_component_alloc()
  ASoC: soc-component: add snd_soc_register_component_{c/d}()
  ASoC: soc-component: add snd_soc_component_{set_}name()
  ASoC: soc-component: add snd_soc_component_{set/to}_priv()
  ASoC: intel: avs: use snd_soc_register_component()
  ASoC: intel: avs: probes: use snd_soc_register_component()
  ASoC: intel: catpt: pcm: use snd_soc_register_component()
  ASoC: soc-generic-dmaengine-pcm: use snd_soc_register_component()
  ASoC: soc-topology-test: use snd_soc_register_component()
  ASoC: soc-core: makes snd_soc_component_initialize() / snd_soc_add_component() local
  ASoC: soc-core: remove dev from soc_component_initialize()

 include/sound/dmaengine_pcm.h         |   6 --
 include/sound/soc-component.h         |  11 ++
 include/sound/soc.h                   |  15 +--
 sound/soc/fsl/fsl_asrc_dma.c          |   4 +-
 sound/soc/intel/avs/avs.h             |   5 +-
 sound/soc/intel/avs/ipc.c             |   2 +-
 sound/soc/intel/avs/pcm.c             |  18 +++-
 sound/soc/intel/avs/probes.c          |  16 +--
 sound/soc/intel/catpt/pcm.c           |  14 +--
 sound/soc/soc-component.c             |  53 ++++++++--
 sound/soc/soc-core.c                  |  44 ++++----
 sound/soc/soc-generic-dmaengine-pcm.c |  30 +++---
 sound/soc/soc-topology-test.c         | 144 ++++++++++++++++----------
 13 files changed, 230 insertions(+), 132 deletions(-)

-- 
2.53.0


^ permalink raw reply	[flat|nested] 16+ messages in thread

* [PATCH v3 02/12] ASoC: soc-component: add snd_soc_component_alloc()
  2026-07-06  2:01 [PATCH v3 00/12] ASoC: add and use new snd_soc_register_component() Kuninori Morimoto
  2026-07-03  1:19 ` [PATCH v3 01/12] ASoC: soc-component: move soc_component_field_shift() Kuninori Morimoto
@ 2026-07-06  2:02 ` Kuninori Morimoto
  2026-07-06  2:02 ` [PATCH v3 03/12] ASoC: soc-component: add snd_soc_register_component_{c/d}() Kuninori Morimoto
                   ` (10 subsequent siblings)
  12 siblings, 0 replies; 16+ messages in thread
From: Kuninori Morimoto @ 2026-07-06  2:02 UTC (permalink / raw)
  To: Bard Liao, bui duc phuc, Cezary Rojewski, Fabio Estevam,
	Jaroslav Kysela, Kai Vehmanen, Lars-Peter Clausen, Liam Girdwood,
	Mark Brown, Nicolin Chen, Peter Ujfalusi, Pierre-Louis Bossart,
	Shengjiu Wang, Takashi Iwai, Xiubo Li
  Cc: linux-sound

struct snd_soc_component will be capsuled soon, then, we will can't alloc
it. Adds snd_soc_component_alloc() to alloc it.

Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
---
 include/sound/soc-component.h |  1 +
 sound/soc/soc-component.c     | 13 +++++++++++++
 2 files changed, 14 insertions(+)

diff --git a/include/sound/soc-component.h b/include/sound/soc-component.h
index aa423865dbe7c..3c628402e289b 100644
--- a/include/sound/soc-component.h
+++ b/include/sound/soc-component.h
@@ -282,6 +282,7 @@ static inline int snd_soc_component_cache_sync(
 	return regcache_sync(component->regmap);
 }
 
+struct snd_soc_component *snd_soc_component_alloc(struct device *dev);
 void snd_soc_component_set_aux(struct snd_soc_component *component,
 			       struct snd_soc_aux_dev *aux);
 int snd_soc_component_init(struct snd_soc_component *component);
diff --git a/sound/soc/soc-component.c b/sound/soc/soc-component.c
index 718246e53e896..f0506a9c36ec9 100644
--- a/sound/soc/soc-component.c
+++ b/sound/soc/soc-component.c
@@ -29,6 +29,19 @@ 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);
+
 /*
  * We might want to check substream by using list.
  * In such case, we can update these macros.
-- 
2.53.0


^ permalink raw reply related	[flat|nested] 16+ messages in thread

* [PATCH v3 03/12] ASoC: soc-component: add snd_soc_register_component_{c/d}()
  2026-07-06  2:01 [PATCH v3 00/12] ASoC: add and use new snd_soc_register_component() Kuninori Morimoto
  2026-07-03  1:19 ` [PATCH v3 01/12] ASoC: soc-component: move soc_component_field_shift() Kuninori Morimoto
  2026-07-06  2:02 ` [PATCH v3 02/12] ASoC: soc-component: add snd_soc_component_alloc() Kuninori Morimoto
@ 2026-07-06  2:02 ` Kuninori Morimoto
  2026-07-06  2:02 ` [PATCH v3 04/12] ASoC: soc-component: add snd_soc_component_{set_}name() Kuninori Morimoto
                   ` (9 subsequent siblings)
  12 siblings, 0 replies; 16+ messages in thread
From: Kuninori Morimoto @ 2026-07-06  2:02 UTC (permalink / raw)
  To: Bard Liao, bui duc phuc, Cezary Rojewski, Fabio Estevam,
	Jaroslav Kysela, Kai Vehmanen, Lars-Peter Clausen, Liam Girdwood,
	Mark Brown, Nicolin Chen, Peter Ujfalusi, Pierre-Louis Bossart,
	Shengjiu Wang, Takashi Iwai, Xiubo Li
  Cc: linux-sound

We have snd_soc_register_component() (A), but we can't setup component
specific setting, like name, etc from driver, because component
itself is allocated in that function (x).

(A)	int snd_soc_register_component(...)
	{
		...
(x)		component = devm_kzalloc(...);
		if (!component)
			return -ENOMEM;

(B)		ret = snd_soc_component_initialize(...);
		if (ret < 0)
			return ret;

(C)		return snd_soc_add_component(...);
	}

So each driver needs to use snd_soc_component_{initialize/add}() (= B/C)
instead of using snd_soc_register_component() (A), but it looks
unbalanced with its paired unregiser function.

Let's merge (B) and (C) into new register function, and allows component
as parameter. We can use both

	snd_soc_register_component(dev, ...);		// already exists
	snd_soc_register_component(component, ...);	// new function

Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
---
 include/sound/soc.h  |  9 ++++++++-
 sound/soc/soc-core.c | 26 ++++++++++++++++++--------
 2 files changed, 26 insertions(+), 9 deletions(-)

diff --git a/include/sound/soc.h b/include/sound/soc.h
index 10ad80f930c2e..cb0de41e2ada5 100644
--- a/include/sound/soc.h
+++ b/include/sound/soc.h
@@ -453,9 +453,16 @@ int snd_soc_component_initialize(struct snd_soc_component *component,
 int snd_soc_add_component(struct snd_soc_component *component,
 			  struct snd_soc_dai_driver *dai_drv,
 			  int num_dai);
-int snd_soc_register_component(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,
+			       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,
 			 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 7817beea5b3bc..3b1d18bfadda9 100644
--- a/sound/soc/soc-core.c
+++ b/sound/soc/soc-core.c
@@ -2775,25 +2775,35 @@ int snd_soc_add_component(struct snd_soc_component *component,
 }
 EXPORT_SYMBOL_GPL(snd_soc_add_component);
 
-int snd_soc_register_component(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)
 {
-	struct snd_soc_component *component;
 	int ret;
 
-	component = devm_kzalloc(dev, sizeof(*component), GFP_KERNEL);
-	if (!component)
-		return -ENOMEM;
-
-	ret = snd_soc_component_initialize(component, component_driver, dev);
+	ret = snd_soc_component_initialize(component, component_driver, component->dev);
 	if (ret < 0)
 		return ret;
 
 	return snd_soc_add_component(component, dai_drv, num_dai);
 }
-EXPORT_SYMBOL_GPL(snd_soc_register_component);
+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)
+{
+	struct snd_soc_component *component;
+
+	component = snd_soc_component_alloc(dev);
+	if (!component)
+		return -ENOMEM;
+
+	return snd_soc_register_component_c(component, component_driver, dai_drv, num_dai);
+}
+EXPORT_SYMBOL_GPL(snd_soc_register_component_d);
 
 /**
  * snd_soc_unregister_component_by_driver - Unregister component using a given driver
-- 
2.53.0


^ permalink raw reply related	[flat|nested] 16+ messages in thread

* [PATCH v3 04/12] ASoC: soc-component: add snd_soc_component_{set_}name()
  2026-07-06  2:01 [PATCH v3 00/12] ASoC: add and use new snd_soc_register_component() Kuninori Morimoto
                   ` (2 preceding siblings ...)
  2026-07-06  2:02 ` [PATCH v3 03/12] ASoC: soc-component: add snd_soc_register_component_{c/d}() Kuninori Morimoto
@ 2026-07-06  2:02 ` Kuninori Morimoto
  2026-07-06  2:02 ` [PATCH v3 05/12] ASoC: soc-component: add snd_soc_component_{set/to}_priv() Kuninori Morimoto
                   ` (8 subsequent siblings)
  12 siblings, 0 replies; 16+ messages in thread
From: Kuninori Morimoto @ 2026-07-06  2:02 UTC (permalink / raw)
  To: Bard Liao, bui duc phuc, Cezary Rojewski, Fabio Estevam,
	Jaroslav Kysela, Kai Vehmanen, Lars-Peter Clausen, Liam Girdwood,
	Mark Brown, Nicolin Chen, Peter Ujfalusi, Pierre-Louis Bossart,
	Shengjiu Wang, Takashi Iwai, Xiubo Li
  Cc: linux-sound

struct snd_soc_component will be capsuled soon, its member will not be
able to access from non soc-component.c.

Add snd_soc_component_{set_}name() to access name.

Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
---
 include/sound/soc-component.h |  4 ++++
 sound/soc/soc-component.c     | 12 ++++++++++++
 2 files changed, 16 insertions(+)

diff --git a/include/sound/soc-component.h b/include/sound/soc-component.h
index 3c628402e289b..61aa6523f2f75 100644
--- a/include/sound/soc-component.h
+++ b/include/sound/soc-component.h
@@ -283,6 +283,10 @@ static inline int snd_soc_component_cache_sync(
 }
 
 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_aux(struct snd_soc_component *component,
 			       struct snd_soc_aux_dev *aux);
 int snd_soc_component_init(struct snd_soc_component *component);
diff --git a/sound/soc/soc-component.c b/sound/soc/soc-component.c
index f0506a9c36ec9..625714293fbb4 100644
--- a/sound/soc/soc-component.c
+++ b/sound/soc/soc-component.c
@@ -42,6 +42,18 @@ struct snd_soc_component *snd_soc_component_alloc(struct device *dev)
 }
 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;
+}
+EXPORT_SYMBOL_GPL(snd_soc_component_name);
+
 /*
  * We might want to check substream by using list.
  * In such case, we can update these macros.
-- 
2.53.0


^ permalink raw reply related	[flat|nested] 16+ messages in thread

* [PATCH v3 05/12] ASoC: soc-component: add snd_soc_component_{set/to}_priv()
  2026-07-06  2:01 [PATCH v3 00/12] ASoC: add and use new snd_soc_register_component() Kuninori Morimoto
                   ` (3 preceding siblings ...)
  2026-07-06  2:02 ` [PATCH v3 04/12] ASoC: soc-component: add snd_soc_component_{set_}name() Kuninori Morimoto
@ 2026-07-06  2:02 ` Kuninori Morimoto
  2026-07-06  2:02 ` [PATCH v3 06/12] ASoC: intel: avs: use snd_soc_register_component() Kuninori Morimoto
                   ` (7 subsequent siblings)
  12 siblings, 0 replies; 16+ messages in thread
From: Kuninori Morimoto @ 2026-07-06  2:02 UTC (permalink / raw)
  To: Bard Liao, bui duc phuc, Cezary Rojewski, Fabio Estevam,
	Jaroslav Kysela, Kai Vehmanen, Lars-Peter Clausen, Liam Girdwood,
	Mark Brown, Nicolin Chen, Peter Ujfalusi, Pierre-Louis Bossart,
	Shengjiu Wang, Takashi Iwai, Xiubo Li
  Cc: linux-sound

struct snd_soc_component will be capsuled soon, its member will not be
able to access from non soc-component.c.

Basically, each drivers are using dev_{set/get}_drvdata() to set own data,
but it is not enough. Let's add .priv.

Add snd_soc_component_{set/to}_priv() to access priv.

Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
---
 include/sound/soc-component.h |  6 ++++++
 sound/soc/soc-component.c     | 12 ++++++++++++
 2 files changed, 18 insertions(+)

diff --git a/include/sound/soc-component.h b/include/sound/soc-component.h
index 61aa6523f2f75..f00a6a809b169 100644
--- a/include/sound/soc-component.h
+++ b/include/sound/soc-component.h
@@ -252,6 +252,9 @@ struct snd_soc_component {
 	void *mark_pm;
 
 	struct dentry *debugfs_root;
+
+	/* Component private data */
+	void *priv;
 };
 
 #define for_each_component_dais(component, dai)\
@@ -287,6 +290,9 @@ 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);
+void *snd_soc_component_to_priv(struct snd_soc_component *component);
+
 void snd_soc_component_set_aux(struct snd_soc_component *component,
 			       struct snd_soc_aux_dev *aux);
 int snd_soc_component_init(struct snd_soc_component *component);
diff --git a/sound/soc/soc-component.c b/sound/soc/soc-component.c
index 625714293fbb4..dc00891b64cdc 100644
--- a/sound/soc/soc-component.c
+++ b/sound/soc/soc-component.c
@@ -54,6 +54,18 @@ const char *snd_soc_component_name(struct snd_soc_component *component)
 }
 EXPORT_SYMBOL_GPL(snd_soc_component_name);
 
+void snd_soc_component_set_priv(struct snd_soc_component *component, void *priv)
+{
+	component->priv = priv;
+}
+EXPORT_SYMBOL_GPL(snd_soc_component_set_priv);
+
+void *snd_soc_component_to_priv(struct snd_soc_component *component)
+{
+	return component->priv;
+}
+EXPORT_SYMBOL_GPL(snd_soc_component_to_priv);
+
 /*
  * We might want to check substream by using list.
  * In such case, we can update these macros.
-- 
2.53.0


^ permalink raw reply related	[flat|nested] 16+ messages in thread

* [PATCH v3 06/12] ASoC: intel: avs: use snd_soc_register_component()
  2026-07-06  2:01 [PATCH v3 00/12] ASoC: add and use new snd_soc_register_component() Kuninori Morimoto
                   ` (4 preceding siblings ...)
  2026-07-06  2:02 ` [PATCH v3 05/12] ASoC: soc-component: add snd_soc_component_{set/to}_priv() Kuninori Morimoto
@ 2026-07-06  2:02 ` Kuninori Morimoto
  2026-07-06  8:55   ` Cezary Rojewski
  2026-07-06  2:02 ` [PATCH v3 07/12] ASoC: intel: avs: probes: " Kuninori Morimoto
                   ` (6 subsequent siblings)
  12 siblings, 1 reply; 16+ messages in thread
From: Kuninori Morimoto @ 2026-07-06  2:02 UTC (permalink / raw)
  To: Bard Liao, bui duc phuc, Cezary Rojewski, Fabio Estevam,
	Jaroslav Kysela, Kai Vehmanen, Lars-Peter Clausen, Liam Girdwood,
	Mark Brown, Nicolin Chen, Peter Ujfalusi, Pierre-Louis Bossart,
	Shengjiu Wang, Takashi Iwai, Xiubo Li
  Cc: linux-sound

It is calling snd_soc_component_initialize() / snd_soc_add_component().
We can now use snd_soc_register_component() instead.

It is using container_of() to get avs_soc_component from component, but
will not be able to use it when capsuling has done.
We can now use snd_soc_component_to_priv() instead.

Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
---
 sound/soc/intel/avs/avs.h |  5 ++---
 sound/soc/intel/avs/ipc.c |  2 +-
 sound/soc/intel/avs/pcm.c | 18 +++++++++++++-----
 3 files changed, 16 insertions(+), 9 deletions(-)

diff --git a/sound/soc/intel/avs/avs.h b/sound/soc/intel/avs/avs.h
index 0f8ddd0e9e5f1..b4f9d66d55ad7 100644
--- a/sound/soc/intel/avs/avs.h
+++ b/sound/soc/intel/avs/avs.h
@@ -336,14 +336,13 @@ int avs_icl_load_basefw(struct avs_dev *adev, struct firmware *fw);
 /* Soc component members */
 
 struct avs_soc_component {
-	struct snd_soc_component base;
+	struct snd_soc_component *base;
 	struct avs_tplg *tplg;
 
 	struct list_head node;
 };
 
-#define to_avs_soc_component(comp) \
-	container_of(comp, struct avs_soc_component, base)
+#define to_avs_soc_component(comp) snd_soc_component_to_priv(comp)
 
 extern const struct snd_soc_dai_ops avs_dai_fe_ops;
 
diff --git a/sound/soc/intel/avs/ipc.c b/sound/soc/intel/avs/ipc.c
index 71e7997e52c2f..39b0de9831da1 100644
--- a/sound/soc/intel/avs/ipc.c
+++ b/sound/soc/intel/avs/ipc.c
@@ -106,7 +106,7 @@ static void avs_dsp_recovery(struct avs_dev *adev)
 			struct snd_soc_pcm_runtime *rtd;
 			struct snd_soc_card *card;
 
-			card = acomp->base.card;
+			card = acomp->base->card;
 			if (!card)
 				continue;
 
diff --git a/sound/soc/intel/avs/pcm.c b/sound/soc/intel/avs/pcm.c
index 797b9c9163b49..aca52f5dac2d4 100644
--- a/sound/soc/intel/avs/pcm.c
+++ b/sound/soc/intel/avs/pcm.c
@@ -958,7 +958,7 @@ static const struct file_operations topology_name_fops = {
 static int avs_component_load_libraries(struct avs_soc_component *acomp)
 {
 	struct avs_tplg *tplg = acomp->tplg;
-	struct avs_dev *adev = to_avs_dev(acomp->base.dev);
+	struct avs_dev *adev = to_avs_dev(acomp->base->dev);
 	int ret;
 
 	if (!tplg->num_libs)
@@ -1387,25 +1387,33 @@ int avs_register_component(struct device *dev, const char *name,
 			   struct snd_soc_dai_driver *cpu_dais, int num_cpu_dais)
 {
 	struct avs_soc_component *acomp;
+	const char *comp_name;
 	int ret;
 
 	acomp = devm_kzalloc(dev, sizeof(*acomp), GFP_KERNEL);
 	if (!acomp)
 		return -ENOMEM;
 
-	acomp->base.name = devm_kstrdup(dev, name, GFP_KERNEL);
-	if (!acomp->base.name)
+	acomp->base = snd_soc_component_alloc(dev);
+	if (acomp->base)
+		return -ENOMEM;
+
+	comp_name = devm_kstrdup(dev, name, GFP_KERNEL);
+	if (!comp_name)
 		return -ENOMEM;
 
 	INIT_LIST_HEAD(&acomp->node);
 
 	drv->use_dai_pcm_id = !obsolete_card_names;
 
-	ret = snd_soc_component_initialize(&acomp->base, drv, dev);
+	snd_soc_component_set_name(acomp->base, comp_name);
+	snd_soc_component_set_priv(acomp->base, acomp);
+
+	ret = snd_soc_register_component(acomp->base, drv, cpu_dais, num_cpu_dais);
 	if (ret < 0)
 		return ret;
 
-	return snd_soc_add_component(&acomp->base, cpu_dais, num_cpu_dais);
+	return 0;
 }
 
 static struct snd_soc_dai_driver dmic_cpu_dais[] = {
-- 
2.53.0


^ permalink raw reply related	[flat|nested] 16+ messages in thread

* [PATCH v3 07/12] ASoC: intel: avs: probes: use snd_soc_register_component()
  2026-07-06  2:01 [PATCH v3 00/12] ASoC: add and use new snd_soc_register_component() Kuninori Morimoto
                   ` (5 preceding siblings ...)
  2026-07-06  2:02 ` [PATCH v3 06/12] ASoC: intel: avs: use snd_soc_register_component() Kuninori Morimoto
@ 2026-07-06  2:02 ` Kuninori Morimoto
  2026-07-06  2:02 ` [PATCH v3 08/12] ASoC: intel: catpt: pcm: " Kuninori Morimoto
                   ` (5 subsequent siblings)
  12 siblings, 0 replies; 16+ messages in thread
From: Kuninori Morimoto @ 2026-07-06  2:02 UTC (permalink / raw)
  To: Bard Liao, bui duc phuc, Cezary Rojewski, Fabio Estevam,
	Jaroslav Kysela, Kai Vehmanen, Lars-Peter Clausen, Liam Girdwood,
	Mark Brown, Nicolin Chen, Peter Ujfalusi, Pierre-Louis Bossart,
	Shengjiu Wang, Takashi Iwai, Xiubo Li
  Cc: linux-sound

It is calling snd_soc_component_initialize() / snd_soc_add_component().
We can now use snd_soc_register_component() instead.

Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
---
 sound/soc/intel/avs/probes.c | 16 ++++++++--------
 1 file changed, 8 insertions(+), 8 deletions(-)

diff --git a/sound/soc/intel/avs/probes.c b/sound/soc/intel/avs/probes.c
index 099119ad28b3c..e957ef46198a6 100644
--- a/sound/soc/intel/avs/probes.c
+++ b/sound/soc/intel/avs/probes.c
@@ -296,19 +296,19 @@ static const struct snd_soc_component_driver avs_probe_component_driver = {
 int avs_register_probe_component(struct avs_dev *adev, const char *name)
 {
 	struct snd_soc_component *component;
-	int ret;
+	const char *comp_name;
 
-	component = devm_kzalloc(adev->dev, sizeof(*component), GFP_KERNEL);
+	component = snd_soc_component_alloc(adev->dev);
 	if (!component)
 		return -ENOMEM;
 
-	component->name = devm_kstrdup(adev->dev, name, GFP_KERNEL);
-	if (!component->name)
+	comp_name = devm_kstrdup(adev->dev, name, GFP_KERNEL);
+	if (!comp_name)
 		return -ENOMEM;
 
-	ret = snd_soc_component_initialize(component, &avs_probe_component_driver, adev->dev);
-	if (ret)
-		return ret;
+	snd_soc_component_set_name(component, comp_name);
 
-	return snd_soc_add_component(component, probe_cpu_dais, ARRAY_SIZE(probe_cpu_dais));
+	return snd_soc_register_component(component,
+					  &avs_probe_component_driver,
+					  probe_cpu_dais, ARRAY_SIZE(probe_cpu_dais));
 }
-- 
2.53.0


^ permalink raw reply related	[flat|nested] 16+ messages in thread

* [PATCH v3 08/12] ASoC: intel: catpt: pcm: use snd_soc_register_component()
  2026-07-06  2:01 [PATCH v3 00/12] ASoC: add and use new snd_soc_register_component() Kuninori Morimoto
                   ` (6 preceding siblings ...)
  2026-07-06  2:02 ` [PATCH v3 07/12] ASoC: intel: avs: probes: " Kuninori Morimoto
@ 2026-07-06  2:02 ` Kuninori Morimoto
  2026-07-06  2:02 ` [PATCH v3 09/12] ASoC: soc-generic-dmaengine-pcm: " Kuninori Morimoto
                   ` (4 subsequent siblings)
  12 siblings, 0 replies; 16+ messages in thread
From: Kuninori Morimoto @ 2026-07-06  2:02 UTC (permalink / raw)
  To: Bard Liao, bui duc phuc, Cezary Rojewski, Fabio Estevam,
	Jaroslav Kysela, Kai Vehmanen, Lars-Peter Clausen, Liam Girdwood,
	Mark Brown, Nicolin Chen, Peter Ujfalusi, Pierre-Louis Bossart,
	Shengjiu Wang, Takashi Iwai, Xiubo Li
  Cc: linux-sound

It is calling snd_soc_component_initialize() / snd_soc_add_component().
We can now use snd_soc_register_component() instead.

Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
---
 sound/soc/intel/catpt/pcm.c | 14 +++++---------
 1 file changed, 5 insertions(+), 9 deletions(-)

diff --git a/sound/soc/intel/catpt/pcm.c b/sound/soc/intel/catpt/pcm.c
index 8fb0efb67eb1d..6c1b87d9fc4a4 100644
--- a/sound/soc/intel/catpt/pcm.c
+++ b/sound/soc/intel/catpt/pcm.c
@@ -1073,18 +1073,14 @@ int catpt_arm_stream_templates(struct catpt_dev *cdev)
 int catpt_register_plat_component(struct catpt_dev *cdev)
 {
 	struct snd_soc_component *component;
-	int ret;
 
-	component = devm_kzalloc(cdev->dev, sizeof(*component), GFP_KERNEL);
+	component = snd_soc_component_alloc(cdev->dev);
 	if (!component)
 		return -ENOMEM;
 
-	ret = snd_soc_component_initialize(component, &catpt_comp_driver,
-					   cdev->dev);
-	if (ret)
-		return ret;
+	snd_soc_component_set_name(component, catpt_comp_driver.name);
 
-	component->name = catpt_comp_driver.name;
-	return snd_soc_add_component(component, dai_drivers,
-				     ARRAY_SIZE(dai_drivers));
+	return snd_soc_register_component(component,
+					  &catpt_comp_driver,
+					  dai_drivers, ARRAY_SIZE(dai_drivers));
 }
-- 
2.53.0


^ permalink raw reply related	[flat|nested] 16+ messages in thread

* [PATCH v3 09/12] ASoC: soc-generic-dmaengine-pcm: use snd_soc_register_component()
  2026-07-06  2:01 [PATCH v3 00/12] ASoC: add and use new snd_soc_register_component() Kuninori Morimoto
                   ` (7 preceding siblings ...)
  2026-07-06  2:02 ` [PATCH v3 08/12] ASoC: intel: catpt: pcm: " Kuninori Morimoto
@ 2026-07-06  2:02 ` Kuninori Morimoto
  2026-07-06  2:02 ` [PATCH v3 10/12] ASoC: soc-topology-test: " Kuninori Morimoto
                   ` (3 subsequent siblings)
  12 siblings, 0 replies; 16+ messages in thread
From: Kuninori Morimoto @ 2026-07-06  2:02 UTC (permalink / raw)
  To: Bard Liao, bui duc phuc, Cezary Rojewski, Fabio Estevam,
	Jaroslav Kysela, Kai Vehmanen, Lars-Peter Clausen, Liam Girdwood,
	Mark Brown, Nicolin Chen, Peter Ujfalusi, Pierre-Louis Bossart,
	Shengjiu Wang, Takashi Iwai, Xiubo Li
  Cc: linux-sound

it is calling snd_soc_component_initialize() / snd_soc_add_component().
We can now use snd_soc_register_component() instead.

It is using container_of() to get dmaengine_pcm from component, but
will not be able to use it when capsuling has done.
We can now use snd_soc_component_to_priv() instead.

Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
---
 include/sound/dmaengine_pcm.h         |  6 ------
 sound/soc/fsl/fsl_asrc_dma.c          |  4 +++-
 sound/soc/soc-generic-dmaengine-pcm.c | 30 ++++++++++++++-------------
 3 files changed, 19 insertions(+), 21 deletions(-)

diff --git a/include/sound/dmaengine_pcm.h b/include/sound/dmaengine_pcm.h
index 9472f0a966a27..81422219ed390 100644
--- a/include/sound/dmaengine_pcm.h
+++ b/include/sound/dmaengine_pcm.h
@@ -175,12 +175,6 @@ int snd_dmaengine_pcm_prepare_slave_config(struct snd_pcm_substream *substream,
 struct dmaengine_pcm {
 	struct dma_chan *chan[SNDRV_PCM_STREAM_LAST + 1];
 	const struct snd_dmaengine_pcm_config *config;
-	struct snd_soc_component component;
 	unsigned int flags;
 };
-
-static inline struct dmaengine_pcm *soc_component_to_pcm(struct snd_soc_component *p)
-{
-	return container_of(p, struct dmaengine_pcm, component);
-}
 #endif
diff --git a/sound/soc/fsl/fsl_asrc_dma.c b/sound/soc/fsl/fsl_asrc_dma.c
index 38f2b7c63133a..2f662bdf14d07 100644
--- a/sound/soc/fsl/fsl_asrc_dma.c
+++ b/sound/soc/fsl/fsl_asrc_dma.c
@@ -219,7 +219,9 @@ static int fsl_asrc_dma_hw_params(struct snd_soc_component *component,
 	 */
 	component_be = snd_soc_lookup_component_nolocked(dev_be, SND_DMAENGINE_PCM_DRV_NAME);
 	if (component_be) {
-		be_chan = soc_component_to_pcm(component_be)->chan[substream->stream];
+		struct dmaengine_pcm *pcm = snd_soc_component_to_priv(component_be);
+
+		be_chan = pcm->chan[substream->stream];
 		tmp_chan = be_chan;
 	}
 	if (!tmp_chan) {
diff --git a/sound/soc/soc-generic-dmaengine-pcm.c b/sound/soc/soc-generic-dmaengine-pcm.c
index 467426d2b5e4e..523674ce1ed27 100644
--- a/sound/soc/soc-generic-dmaengine-pcm.c
+++ b/sound/soc/soc-generic-dmaengine-pcm.c
@@ -77,7 +77,7 @@ static int dmaengine_pcm_hw_params(struct snd_soc_component *component,
 				   struct snd_pcm_substream *substream,
 				   struct snd_pcm_hw_params *params)
 {
-	struct dmaengine_pcm *pcm = soc_component_to_pcm(component);
+	struct dmaengine_pcm *pcm = snd_soc_component_to_priv(component);
 	struct dma_chan *chan = snd_dmaengine_pcm_get_chan(substream);
 	struct dma_slave_config slave_config;
 	int ret;
@@ -99,7 +99,7 @@ dmaengine_pcm_set_runtime_hwparams(struct snd_soc_component *component,
 				   struct snd_pcm_substream *substream)
 {
 	struct snd_soc_pcm_runtime *rtd = snd_soc_substream_to_rtd(substream);
-	struct dmaengine_pcm *pcm = soc_component_to_pcm(component);
+	struct dmaengine_pcm *pcm = snd_soc_component_to_priv(component);
 	struct device *dma_dev = dmaengine_dma_dev(pcm, substream);
 	struct dma_chan *chan = pcm->chan[substream->stream];
 	struct snd_dmaengine_dai_dma_data *dma_data;
@@ -148,7 +148,7 @@ dmaengine_pcm_set_runtime_hwparams(struct snd_soc_component *component,
 static int dmaengine_pcm_open(struct snd_soc_component *component,
 			      struct snd_pcm_substream *substream)
 {
-	struct dmaengine_pcm *pcm = soc_component_to_pcm(component);
+	struct dmaengine_pcm *pcm = snd_soc_component_to_priv(component);
 	struct dma_chan *chan = pcm->chan[substream->stream];
 	int ret;
 
@@ -176,7 +176,7 @@ static struct dma_chan *dmaengine_pcm_compat_request_channel(
 	struct snd_soc_pcm_runtime *rtd,
 	struct snd_pcm_substream *substream)
 {
-	struct dmaengine_pcm *pcm = soc_component_to_pcm(component);
+	struct dmaengine_pcm *pcm = snd_soc_component_to_priv(component);
 	struct snd_dmaengine_dai_dma_data *dma_data;
 
 	if (rtd->dai_link->num_cpus > 1) {
@@ -219,7 +219,7 @@ static bool dmaengine_pcm_can_report_residue(struct device *dev,
 static int dmaengine_pcm_new(struct snd_soc_component *component,
 			     struct snd_soc_pcm_runtime *rtd)
 {
-	struct dmaengine_pcm *pcm = soc_component_to_pcm(component);
+	struct dmaengine_pcm *pcm = snd_soc_component_to_priv(component);
 	const struct snd_dmaengine_pcm_config *config = pcm->config;
 	struct device *dev = component->dev;
 	size_t prealloc_buffer_size;
@@ -279,7 +279,7 @@ static snd_pcm_uframes_t dmaengine_pcm_pointer(
 	struct snd_soc_component *component,
 	struct snd_pcm_substream *substream)
 {
-	struct dmaengine_pcm *pcm = soc_component_to_pcm(component);
+	struct dmaengine_pcm *pcm = snd_soc_component_to_priv(component);
 
 	if (pcm->flags & SND_DMAENGINE_PCM_FLAG_NO_RESIDUE)
 		return snd_dmaengine_pcm_pointer_no_residue(substream);
@@ -293,7 +293,7 @@ static int dmaengine_copy(struct snd_soc_component *component,
 			  struct iov_iter *iter, unsigned long bytes)
 {
 	struct snd_pcm_runtime *runtime = substream->runtime;
-	struct dmaengine_pcm *pcm = soc_component_to_pcm(component);
+	struct dmaengine_pcm *pcm = snd_soc_component_to_priv(component);
 	int (*process)(struct snd_pcm_substream *substream,
 		       int channel, unsigned long hwoff,
 		       unsigned long bytes) = pcm->config->process;
@@ -435,10 +435,15 @@ static const struct snd_dmaengine_pcm_config snd_dmaengine_pcm_default_config =
 int snd_dmaengine_pcm_register(struct device *dev,
 	const struct snd_dmaengine_pcm_config *config, unsigned int flags)
 {
+	struct snd_soc_component *component;
 	const struct snd_soc_component_driver *driver;
 	struct dmaengine_pcm *pcm;
 	int ret;
 
+	component = snd_soc_component_alloc(dev);
+	if (!component)
+		return -ENOMEM;
+
 	pcm = kzalloc_obj(*pcm);
 	if (!pcm)
 		return -ENOMEM;
@@ -449,7 +454,8 @@ int snd_dmaengine_pcm_register(struct device *dev,
 	pcm->flags = flags;
 
 	if (config->name)
-		pcm->component.name = config->name;
+		snd_soc_component_set_name(component, config->name);
+	snd_soc_component_set_priv(component, pcm);
 
 	ret = dmaengine_pcm_request_chan_of(pcm, dev, config);
 	if (ret)
@@ -460,11 +466,7 @@ int snd_dmaengine_pcm_register(struct device *dev,
 	else
 		driver = &dmaengine_pcm_component;
 
-	ret = snd_soc_component_initialize(&pcm->component, driver, dev);
-	if (ret)
-		goto err_free_dma;
-
-	ret = snd_soc_add_component(&pcm->component, NULL, 0);
+	ret = snd_soc_register_component(component, driver, NULL, 0);
 	if (ret)
 		goto err_free_dma;
 
@@ -493,7 +495,7 @@ void snd_dmaengine_pcm_unregister(struct device *dev)
 	if (!component)
 		return;
 
-	pcm = soc_component_to_pcm(component);
+	pcm = snd_soc_component_to_priv(component);
 
 	snd_soc_unregister_component_by_driver(dev, component->driver);
 	dmaengine_pcm_release_chan(pcm);
-- 
2.53.0


^ permalink raw reply related	[flat|nested] 16+ messages in thread

* [PATCH v3 10/12] ASoC: soc-topology-test: use snd_soc_register_component()
  2026-07-06  2:01 [PATCH v3 00/12] ASoC: add and use new snd_soc_register_component() Kuninori Morimoto
                   ` (8 preceding siblings ...)
  2026-07-06  2:02 ` [PATCH v3 09/12] ASoC: soc-generic-dmaengine-pcm: " Kuninori Morimoto
@ 2026-07-06  2:02 ` Kuninori Morimoto
  2026-07-06  2:02 ` [PATCH v3 11/12] ASoC: soc-core: makes snd_soc_component_initialize() / snd_soc_add_component() local Kuninori Morimoto
                   ` (2 subsequent siblings)
  12 siblings, 0 replies; 16+ messages in thread
From: Kuninori Morimoto @ 2026-07-06  2:02 UTC (permalink / raw)
  To: Bard Liao, bui duc phuc, Cezary Rojewski, Fabio Estevam,
	Jaroslav Kysela, Kai Vehmanen, Lars-Peter Clausen, Liam Girdwood,
	Mark Brown, Nicolin Chen, Peter Ujfalusi, Pierre-Louis Bossart,
	Shengjiu Wang, Takashi Iwai, Xiubo Li
  Cc: linux-sound

It is calling snd_soc_component_initialize() / snd_soc_add_component().
We can now use snd_soc_register_component() instead.

It is using container_of() to get kunit_soc_component from component, but
will not be able to use it when capsuling has done.
We can use snd_soc_component_to_priv() instead.

Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
---
 sound/soc/soc-topology-test.c | 144 ++++++++++++++++++++++------------
 1 file changed, 92 insertions(+), 52 deletions(-)

diff --git a/sound/soc/soc-topology-test.c b/sound/soc/soc-topology-test.c
index c8f2ec29e9703..8feb3dcf8d557 100644
--- a/sound/soc/soc-topology-test.c
+++ b/sound/soc/soc-topology-test.c
@@ -45,15 +45,13 @@ static void snd_soc_tplg_test_exit(struct kunit *test)
 struct kunit_soc_component {
 	struct kunit *kunit;
 	int expect; /* what result we expect when loading topology */
-	struct snd_soc_component comp;
 	struct snd_soc_card card;
 	struct firmware fw;
 };
 
 static int d_probe(struct snd_soc_component *component)
 {
-	struct kunit_soc_component *kunit_comp =
-			container_of(component, struct kunit_soc_component, comp);
+	struct kunit_soc_component *kunit_comp = snd_soc_component_to_priv(component);
 	int ret;
 
 	ret = snd_soc_tplg_component_load(component, NULL, &kunit_comp->fw);
@@ -65,8 +63,7 @@ static int d_probe(struct snd_soc_component *component)
 
 static void d_remove(struct snd_soc_component *component)
 {
-	struct kunit_soc_component *kunit_comp =
-			container_of(component, struct kunit_soc_component, comp);
+	struct kunit_soc_component *kunit_comp = snd_soc_component_to_priv(component);
 	int ret;
 
 	ret = snd_soc_tplg_component_remove(component);
@@ -214,8 +211,7 @@ static struct tplg_tmpl_002 tplg_tmpl_with_pcm = {
  */
 static int d_probe_null_comp(struct snd_soc_component *component)
 {
-	struct kunit_soc_component *kunit_comp =
-			container_of(component, struct kunit_soc_component, comp);
+	struct kunit_soc_component *kunit_comp = snd_soc_component_to_priv(component);
 	int ret;
 
 	/* instead of passing component pointer as first argument, pass NULL here */
@@ -234,6 +230,7 @@ static const struct snd_soc_component_driver test_component_null_comp = {
 static void snd_soc_tplg_test_load_with_null_comp(struct kunit *test)
 {
 	struct kunit_soc_component *kunit_comp;
+	struct snd_soc_component *component;
 	int ret;
 
 	/* prepare */
@@ -249,15 +246,18 @@ static void snd_soc_tplg_test_load_with_null_comp(struct kunit *test)
 	kunit_comp->card.num_links = ARRAY_SIZE(kunit_dai_links);
 	kunit_comp->card.fully_routed = true;
 
+	component = snd_soc_component_alloc(test_dev);
+	if (!component)
+		KUNIT_FAIL(test, "Failed to alloc component");
+
+	snd_soc_component_set_priv(component, kunit_comp);
+
 	/* run test */
 	ret = snd_soc_register_card(&kunit_comp->card);
 	if (ret != 0 && ret != -EPROBE_DEFER)
 		KUNIT_FAIL(test, "Failed to register card");
 
-	ret = snd_soc_component_initialize(&kunit_comp->comp, &test_component_null_comp, test_dev);
-	KUNIT_EXPECT_EQ(test, 0, ret);
-
-	ret = snd_soc_add_component(&kunit_comp->comp, NULL, 0);
+	ret = snd_soc_register_component(component, &test_component_null_comp, NULL, 0);
 	KUNIT_EXPECT_EQ(test, 0, ret);
 
 	/* cleanup */
@@ -276,6 +276,7 @@ static void snd_soc_tplg_test_load_with_null_comp(struct kunit *test)
 static void snd_soc_tplg_test_load_with_null_ops(struct kunit *test)
 {
 	struct kunit_soc_component *kunit_comp;
+	struct snd_soc_component *component;
 	int ret;
 
 	/* prepare */
@@ -291,15 +292,18 @@ static void snd_soc_tplg_test_load_with_null_ops(struct kunit *test)
 	kunit_comp->card.num_links = ARRAY_SIZE(kunit_dai_links);
 	kunit_comp->card.fully_routed = true;
 
+	component = snd_soc_component_alloc(test_dev);
+	if (!component)
+		KUNIT_FAIL(test, "Failed to alloc component");
+
+	snd_soc_component_set_priv(component, kunit_comp);
+
 	/* run test */
 	ret = snd_soc_register_card(&kunit_comp->card);
 	if (ret != 0 && ret != -EPROBE_DEFER)
 		KUNIT_FAIL(test, "Failed to register card");
 
-	ret = snd_soc_component_initialize(&kunit_comp->comp, &test_component, test_dev);
-	KUNIT_EXPECT_EQ(test, 0, ret);
-
-	ret = snd_soc_add_component(&kunit_comp->comp, NULL, 0);
+	ret = snd_soc_register_component(component, &test_component, NULL, 0);
 	KUNIT_EXPECT_EQ(test, 0, ret);
 
 	/* cleanup */
@@ -318,8 +322,7 @@ static void snd_soc_tplg_test_load_with_null_ops(struct kunit *test)
  */
 static int d_probe_null_fw(struct snd_soc_component *component)
 {
-	struct kunit_soc_component *kunit_comp =
-			container_of(component, struct kunit_soc_component, comp);
+	struct kunit_soc_component *kunit_comp = snd_soc_component_to_priv(component);
 	int ret;
 
 	/* instead of passing fw pointer as third argument, pass NULL here */
@@ -338,6 +341,7 @@ static const struct snd_soc_component_driver test_component_null_fw = {
 static void snd_soc_tplg_test_load_with_null_fw(struct kunit *test)
 {
 	struct kunit_soc_component *kunit_comp;
+	struct snd_soc_component *component;
 	int ret;
 
 	/* prepare */
@@ -353,15 +357,18 @@ static void snd_soc_tplg_test_load_with_null_fw(struct kunit *test)
 	kunit_comp->card.num_links = ARRAY_SIZE(kunit_dai_links);
 	kunit_comp->card.fully_routed = true;
 
+	component = snd_soc_component_alloc(test_dev);
+	if (!component)
+		KUNIT_FAIL(test, "Failed to alloc component");
+
+	snd_soc_component_set_priv(component, kunit_comp);
+
 	/* run test */
 	ret = snd_soc_register_card(&kunit_comp->card);
 	if (ret != 0 && ret != -EPROBE_DEFER)
 		KUNIT_FAIL(test, "Failed to register card");
 
-	ret = snd_soc_component_initialize(&kunit_comp->comp, &test_component_null_fw, test_dev);
-	KUNIT_EXPECT_EQ(test, 0, ret);
-
-	ret = snd_soc_add_component(&kunit_comp->comp, NULL, 0);
+	ret = snd_soc_register_component(component, &test_component_null_fw, NULL, 0);
 	KUNIT_EXPECT_EQ(test, 0, ret);
 
 	/* cleanup */
@@ -375,6 +382,7 @@ static void snd_soc_tplg_test_load_with_null_fw(struct kunit *test)
 static void snd_soc_tplg_test_load_empty_tplg(struct kunit *test)
 {
 	struct kunit_soc_component *kunit_comp;
+	struct snd_soc_component *component;
 	struct tplg_tmpl_001 *data;
 	int size;
 	int ret;
@@ -401,15 +409,18 @@ static void snd_soc_tplg_test_load_empty_tplg(struct kunit *test)
 	kunit_comp->card.num_links = ARRAY_SIZE(kunit_dai_links);
 	kunit_comp->card.fully_routed = true;
 
+	component = snd_soc_component_alloc(test_dev);
+	if (!component)
+		KUNIT_FAIL(test, "Failed to alloc component");
+
+	snd_soc_component_set_priv(component, kunit_comp);
+
 	/* run test */
 	ret = snd_soc_register_card(&kunit_comp->card);
 	if (ret != 0 && ret != -EPROBE_DEFER)
 		KUNIT_FAIL(test, "Failed to register card");
 
-	ret = snd_soc_component_initialize(&kunit_comp->comp, &test_component, test_dev);
-	KUNIT_EXPECT_EQ(test, 0, ret);
-
-	ret = snd_soc_add_component(&kunit_comp->comp, NULL, 0);
+	ret = snd_soc_register_component(component, &test_component, NULL, 0);
 	KUNIT_EXPECT_EQ(test, 0, ret);
 
 	/* cleanup */
@@ -425,6 +436,7 @@ static void snd_soc_tplg_test_load_empty_tplg(struct kunit *test)
 static void snd_soc_tplg_test_load_empty_tplg_bad_magic(struct kunit *test)
 {
 	struct kunit_soc_component *kunit_comp;
+	struct snd_soc_component *component;
 	struct tplg_tmpl_001 *data;
 	int size;
 	int ret;
@@ -456,15 +468,18 @@ static void snd_soc_tplg_test_load_empty_tplg_bad_magic(struct kunit *test)
 	kunit_comp->card.num_links = ARRAY_SIZE(kunit_dai_links);
 	kunit_comp->card.fully_routed = true;
 
+	component = snd_soc_component_alloc(test_dev);
+	if (!component)
+		KUNIT_FAIL(test, "Failed to alloc component");
+
+	snd_soc_component_set_priv(component, kunit_comp);
+
 	/* run test */
 	ret = snd_soc_register_card(&kunit_comp->card);
 	if (ret != 0 && ret != -EPROBE_DEFER)
 		KUNIT_FAIL(test, "Failed to register card");
 
-	ret = snd_soc_component_initialize(&kunit_comp->comp, &test_component, test_dev);
-	KUNIT_EXPECT_EQ(test, 0, ret);
-
-	ret = snd_soc_add_component(&kunit_comp->comp, NULL, 0);
+	ret = snd_soc_register_component(component, &test_component, NULL, 0);
 	KUNIT_EXPECT_EQ(test, 0, ret);
 
 	/* cleanup */
@@ -480,6 +495,7 @@ static void snd_soc_tplg_test_load_empty_tplg_bad_magic(struct kunit *test)
 static void snd_soc_tplg_test_load_empty_tplg_bad_abi(struct kunit *test)
 {
 	struct kunit_soc_component *kunit_comp;
+	struct snd_soc_component *component;
 	struct tplg_tmpl_001 *data;
 	int size;
 	int ret;
@@ -511,15 +527,18 @@ static void snd_soc_tplg_test_load_empty_tplg_bad_abi(struct kunit *test)
 	kunit_comp->card.num_links = ARRAY_SIZE(kunit_dai_links);
 	kunit_comp->card.fully_routed = true;
 
+	component = snd_soc_component_alloc(test_dev);
+	if (!component)
+		KUNIT_FAIL(test, "Failed to alloc component");
+
+	snd_soc_component_set_priv(component, kunit_comp);
+
 	/* run test */
 	ret = snd_soc_register_card(&kunit_comp->card);
 	if (ret != 0 && ret != -EPROBE_DEFER)
 		KUNIT_FAIL(test, "Failed to register card");
 
-	ret = snd_soc_component_initialize(&kunit_comp->comp, &test_component, test_dev);
-	KUNIT_EXPECT_EQ(test, 0, ret);
-
-	ret = snd_soc_add_component(&kunit_comp->comp, NULL, 0);
+	ret = snd_soc_register_component(component, &test_component, NULL, 0);
 	KUNIT_EXPECT_EQ(test, 0, ret);
 
 	/* cleanup */
@@ -535,6 +554,7 @@ static void snd_soc_tplg_test_load_empty_tplg_bad_abi(struct kunit *test)
 static void snd_soc_tplg_test_load_empty_tplg_bad_size(struct kunit *test)
 {
 	struct kunit_soc_component *kunit_comp;
+	struct snd_soc_component *component;
 	struct tplg_tmpl_001 *data;
 	int size;
 	int ret;
@@ -566,15 +586,18 @@ static void snd_soc_tplg_test_load_empty_tplg_bad_size(struct kunit *test)
 	kunit_comp->card.num_links = ARRAY_SIZE(kunit_dai_links);
 	kunit_comp->card.fully_routed = true;
 
+	component = snd_soc_component_alloc(test_dev);
+	if (!component)
+		KUNIT_FAIL(test, "Failed to alloc component");
+
+	snd_soc_component_set_priv(component, kunit_comp);
+
 	/* run test */
 	ret = snd_soc_register_card(&kunit_comp->card);
 	if (ret != 0 && ret != -EPROBE_DEFER)
 		KUNIT_FAIL(test, "Failed to register card");
 
-	ret = snd_soc_component_initialize(&kunit_comp->comp, &test_component, test_dev);
-	KUNIT_EXPECT_EQ(test, 0, ret);
-
-	ret = snd_soc_add_component(&kunit_comp->comp, NULL, 0);
+	ret = snd_soc_register_component(component, &test_component, NULL, 0);
 	KUNIT_EXPECT_EQ(test, 0, ret);
 
 	/* cleanup */
@@ -590,6 +613,7 @@ static void snd_soc_tplg_test_load_empty_tplg_bad_size(struct kunit *test)
 static void snd_soc_tplg_test_load_empty_tplg_bad_payload_size(struct kunit *test)
 {
 	struct kunit_soc_component *kunit_comp;
+	struct snd_soc_component *component;
 	struct tplg_tmpl_001 *data;
 	int size;
 	int ret;
@@ -622,15 +646,18 @@ static void snd_soc_tplg_test_load_empty_tplg_bad_payload_size(struct kunit *tes
 	kunit_comp->card.num_links = ARRAY_SIZE(kunit_dai_links);
 	kunit_comp->card.fully_routed = true;
 
+	component = snd_soc_component_alloc(test_dev);
+	if (!component)
+		KUNIT_FAIL(test, "Failed to alloc component");
+
+	snd_soc_component_set_priv(component, kunit_comp);
+
 	/* run test */
 	ret = snd_soc_register_card(&kunit_comp->card);
 	if (ret != 0 && ret != -EPROBE_DEFER)
 		KUNIT_FAIL(test, "Failed to register card");
 
-	ret = snd_soc_component_initialize(&kunit_comp->comp, &test_component, test_dev);
-	KUNIT_EXPECT_EQ(test, 0, ret);
-
-	ret = snd_soc_add_component(&kunit_comp->comp, NULL, 0);
+	ret = snd_soc_register_component(component, &test_component, NULL, 0);
 	KUNIT_EXPECT_EQ(test, 0, ret);
 
 	/* cleanup */
@@ -644,6 +671,7 @@ static void snd_soc_tplg_test_load_empty_tplg_bad_payload_size(struct kunit *tes
 static void snd_soc_tplg_test_load_pcm_tplg(struct kunit *test)
 {
 	struct kunit_soc_component *kunit_comp;
+	struct snd_soc_component *component;
 	u8 *data;
 	int size;
 	int ret;
@@ -670,15 +698,18 @@ static void snd_soc_tplg_test_load_pcm_tplg(struct kunit *test)
 	kunit_comp->card.num_links = ARRAY_SIZE(kunit_dai_links);
 	kunit_comp->card.fully_routed = true;
 
+	component = snd_soc_component_alloc(test_dev);
+	if (!component)
+		KUNIT_FAIL(test, "Failed to alloc component");
+
+	snd_soc_component_set_priv(component, kunit_comp);
+
 	/* run test */
 	ret = snd_soc_register_card(&kunit_comp->card);
 	if (ret != 0 && ret != -EPROBE_DEFER)
 		KUNIT_FAIL(test, "Failed to register card");
 
-	ret = snd_soc_component_initialize(&kunit_comp->comp, &test_component, test_dev);
-	KUNIT_EXPECT_EQ(test, 0, ret);
-
-	ret = snd_soc_add_component(&kunit_comp->comp, NULL, 0);
+	ret = snd_soc_register_component(component, &test_component, NULL, 0);
 	KUNIT_EXPECT_EQ(test, 0, ret);
 
 	snd_soc_unregister_component(test_dev);
@@ -693,6 +724,7 @@ static void snd_soc_tplg_test_load_pcm_tplg(struct kunit *test)
 static void snd_soc_tplg_test_load_pcm_tplg_reload_comp(struct kunit *test)
 {
 	struct kunit_soc_component *kunit_comp;
+	struct snd_soc_component *component;
 	u8 *data;
 	int size;
 	int ret;
@@ -720,16 +752,20 @@ static void snd_soc_tplg_test_load_pcm_tplg_reload_comp(struct kunit *test)
 	kunit_comp->card.num_links = ARRAY_SIZE(kunit_dai_links);
 	kunit_comp->card.fully_routed = true;
 
+	component = snd_soc_component_alloc(test_dev);
+	if (!component)
+		KUNIT_FAIL(test, "Failed to alloc component");
+
+	snd_soc_component_set_priv(component, kunit_comp);
+
 	/* run test */
 	ret = snd_soc_register_card(&kunit_comp->card);
 	if (ret != 0 && ret != -EPROBE_DEFER)
 		KUNIT_FAIL(test, "Failed to register card");
 
 	for (i = 0; i < 100; i++) {
-		ret = snd_soc_component_initialize(&kunit_comp->comp, &test_component, test_dev);
-		KUNIT_EXPECT_EQ(test, 0, ret);
 
-		ret = snd_soc_add_component(&kunit_comp->comp, NULL, 0);
+		ret = snd_soc_register_component(component, &test_component, NULL, 0);
 		KUNIT_EXPECT_EQ(test, 0, ret);
 
 		snd_soc_unregister_component(test_dev);
@@ -745,6 +781,7 @@ static void snd_soc_tplg_test_load_pcm_tplg_reload_comp(struct kunit *test)
 static void snd_soc_tplg_test_load_pcm_tplg_reload_card(struct kunit *test)
 {
 	struct kunit_soc_component *kunit_comp;
+	struct snd_soc_component *component;
 	u8 *data;
 	int size;
 	int ret;
@@ -772,11 +809,14 @@ static void snd_soc_tplg_test_load_pcm_tplg_reload_card(struct kunit *test)
 	kunit_comp->card.num_links = ARRAY_SIZE(kunit_dai_links);
 	kunit_comp->card.fully_routed = true;
 
-	/* run test */
-	ret = snd_soc_component_initialize(&kunit_comp->comp, &test_component, test_dev);
-	KUNIT_EXPECT_EQ(test, 0, ret);
+	component = snd_soc_component_alloc(test_dev);
+	if (!component)
+		KUNIT_FAIL(test, "Failed to alloc component");
 
-	ret = snd_soc_add_component(&kunit_comp->comp, NULL, 0);
+	snd_soc_component_set_priv(component, kunit_comp);
+
+	/* run test */
+	ret = snd_soc_register_component(component, &test_component, NULL, 0);
 	KUNIT_EXPECT_EQ(test, 0, ret);
 
 	for (i = 0; i < 100; i++) {
-- 
2.53.0


^ permalink raw reply related	[flat|nested] 16+ messages in thread

* [PATCH v3 11/12] ASoC: soc-core: makes snd_soc_component_initialize() / snd_soc_add_component() local
  2026-07-06  2:01 [PATCH v3 00/12] ASoC: add and use new snd_soc_register_component() Kuninori Morimoto
                   ` (9 preceding siblings ...)
  2026-07-06  2:02 ` [PATCH v3 10/12] ASoC: soc-topology-test: " Kuninori Morimoto
@ 2026-07-06  2:02 ` Kuninori Morimoto
  2026-07-06  2:03 ` [PATCH v3 12/12] ASoC: soc-core: remove dev from soc_component_initialize() Kuninori Morimoto
  2026-07-06  9:01 ` [PATCH v3 00/12] ASoC: add and use new snd_soc_register_component() Cezary Rojewski
  12 siblings, 0 replies; 16+ messages in thread
From: Kuninori Morimoto @ 2026-07-06  2:02 UTC (permalink / raw)
  To: Bard Liao, bui duc phuc, Cezary Rojewski, Fabio Estevam,
	Jaroslav Kysela, Kai Vehmanen, Lars-Peter Clausen, Liam Girdwood,
	Mark Brown, Nicolin Chen, Peter Ujfalusi, Pierre-Louis Bossart,
	Shengjiu Wang, Takashi Iwai, Xiubo Li
  Cc: linux-sound

No one is calling snd_soc_component_initialize() / snd_soc_add_component()
calling from driver. Makes them local functions.

It renames
	- snd_soc_add_component()
	+ snd_soc_component_add()

Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
---
 include/sound/soc.h  |  6 ------
 sound/soc/soc-core.c | 18 ++++++++----------
 2 files changed, 8 insertions(+), 16 deletions(-)

diff --git a/include/sound/soc.h b/include/sound/soc.h
index cb0de41e2ada5..f46b2bc2a022b 100644
--- a/include/sound/soc.h
+++ b/include/sound/soc.h
@@ -447,12 +447,6 @@ static inline int snd_soc_resume(struct device *dev)
 }
 #endif
 int snd_soc_poweroff(struct device *dev);
-int snd_soc_component_initialize(struct snd_soc_component *component,
-				 const struct snd_soc_component_driver *driver,
-				 struct device *dev);
-int snd_soc_add_component(struct snd_soc_component *component,
-			  struct snd_soc_dai_driver *dai_drv,
-			  int num_dai);
 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);
diff --git a/sound/soc/soc-core.c b/sound/soc/soc-core.c
index 3b1d18bfadda9..f1368bfe3fa4e 100644
--- a/sound/soc/soc-core.c
+++ b/sound/soc/soc-core.c
@@ -2702,9 +2702,9 @@ static void snd_soc_del_component_unlocked(struct snd_soc_component *component)
 	list_del(&component->list);
 }
 
-int snd_soc_component_initialize(struct snd_soc_component *component,
-				 const struct snd_soc_component_driver *driver,
-				 struct device *dev)
+static int soc_component_initialize(struct snd_soc_component *component,
+				    const struct snd_soc_component_driver *driver,
+				    struct device *dev)
 {
 	component->dapm = snd_soc_dapm_alloc(dev);
 	if (!component->dapm)
@@ -2730,11 +2730,10 @@ int snd_soc_component_initialize(struct snd_soc_component *component,
 
 	return 0;
 }
-EXPORT_SYMBOL_GPL(snd_soc_component_initialize);
 
-int snd_soc_add_component(struct snd_soc_component *component,
-			  struct snd_soc_dai_driver *dai_drv,
-			  int num_dai)
+static int soc_component_add(struct snd_soc_component *component,
+			     struct snd_soc_dai_driver *dai_drv,
+			     int num_dai)
 {
 	struct snd_soc_card *card, *c;
 	int ret;
@@ -2773,7 +2772,6 @@ int snd_soc_add_component(struct snd_soc_component *component,
 
 	return ret;
 }
-EXPORT_SYMBOL_GPL(snd_soc_add_component);
 
 int snd_soc_register_component_c(struct snd_soc_component *component,
 			const struct snd_soc_component_driver *component_driver,
@@ -2782,11 +2780,11 @@ int snd_soc_register_component_c(struct snd_soc_component *component,
 {
 	int ret;
 
-	ret = snd_soc_component_initialize(component, component_driver, component->dev);
+	ret = soc_component_initialize(component, component_driver, component->dev);
 	if (ret < 0)
 		return ret;
 
-	return snd_soc_add_component(component, dai_drv, num_dai);
+	return soc_component_add(component, dai_drv, num_dai);
 }
 EXPORT_SYMBOL_GPL(snd_soc_register_component_c);
 
-- 
2.53.0


^ permalink raw reply related	[flat|nested] 16+ messages in thread

* [PATCH v3 12/12] ASoC: soc-core: remove dev from soc_component_initialize()
  2026-07-06  2:01 [PATCH v3 00/12] ASoC: add and use new snd_soc_register_component() Kuninori Morimoto
                   ` (10 preceding siblings ...)
  2026-07-06  2:02 ` [PATCH v3 11/12] ASoC: soc-core: makes snd_soc_component_initialize() / snd_soc_add_component() local Kuninori Morimoto
@ 2026-07-06  2:03 ` Kuninori Morimoto
  2026-07-06  9:01 ` [PATCH v3 00/12] ASoC: add and use new snd_soc_register_component() Cezary Rojewski
  12 siblings, 0 replies; 16+ messages in thread
From: Kuninori Morimoto @ 2026-07-06  2:03 UTC (permalink / raw)
  To: Bard Liao, bui duc phuc, Cezary Rojewski, Fabio Estevam,
	Jaroslav Kysela, Kai Vehmanen, Lars-Peter Clausen, Liam Girdwood,
	Mark Brown, Nicolin Chen, Peter Ujfalusi, Pierre-Louis Bossart,
	Shengjiu Wang, Takashi Iwai, Xiubo Li
  Cc: linux-sound

Component already has component->dev. No longer need to set dev
on soc_component_initialize(). Remove it.

Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
---
 sound/soc/soc-core.c | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/sound/soc/soc-core.c b/sound/soc/soc-core.c
index f1368bfe3fa4e..8aaf85db0ea5c 100644
--- a/sound/soc/soc-core.c
+++ b/sound/soc/soc-core.c
@@ -2703,9 +2703,10 @@ static void snd_soc_del_component_unlocked(struct snd_soc_component *component)
 }
 
 static int soc_component_initialize(struct snd_soc_component *component,
-				    const struct snd_soc_component_driver *driver,
-				    struct device *dev)
+				    const struct snd_soc_component_driver *driver)
 {
+	struct device *dev = component->dev;
+
 	component->dapm = snd_soc_dapm_alloc(dev);
 	if (!component->dapm)
 		return -ENOMEM;
@@ -2725,7 +2726,6 @@ static int soc_component_initialize(struct snd_soc_component *component,
 		}
 	}
 
-	component->dev		= dev;
 	component->driver	= driver;
 
 	return 0;
@@ -2780,7 +2780,7 @@ int snd_soc_register_component_c(struct snd_soc_component *component,
 {
 	int ret;
 
-	ret = soc_component_initialize(component, component_driver, component->dev);
+	ret = soc_component_initialize(component, component_driver);
 	if (ret < 0)
 		return ret;
 
-- 
2.53.0


^ permalink raw reply related	[flat|nested] 16+ messages in thread

* Re: [PATCH v3 06/12] ASoC: intel: avs: use snd_soc_register_component()
  2026-07-06  2:02 ` [PATCH v3 06/12] ASoC: intel: avs: use snd_soc_register_component() Kuninori Morimoto
@ 2026-07-06  8:55   ` Cezary Rojewski
  0 siblings, 0 replies; 16+ messages in thread
From: Cezary Rojewski @ 2026-07-06  8:55 UTC (permalink / raw)
  To: Kuninori Morimoto
  Cc: linux-sound, Bard Liao, bui duc phuc, Fabio Estevam,
	Jaroslav Kysela, Kai Vehmanen, Lars-Peter Clausen, Liam Girdwood,
	Mark Brown, Nicolin Chen, Peter Ujfalusi, Pierre-Louis Bossart,
	Shengjiu Wang, Takashi Iwai, Xiubo Li

On 7/6/2026 4:02 AM, Kuninori Morimoto wrote:
> It is calling snd_soc_component_initialize() / snd_soc_add_component().
> We can now use snd_soc_register_component() instead.
> 
> It is using container_of() to get avs_soc_component from component, but
> will not be able to use it when capsuling has done.
> We can now use snd_soc_component_to_priv() instead.

...

> @@ -1387,25 +1387,33 @@ int avs_register_component(struct device *dev, const char *name,
>   			   struct snd_soc_dai_driver *cpu_dais, int num_cpu_dais)
>   {

...

> -	ret = snd_soc_component_initialize(&acomp->base, drv, dev);
> +	snd_soc_component_set_name(acomp->base, comp_name);
> +	snd_soc_component_set_priv(acomp->base, acomp);
> +
> +	ret = snd_soc_register_component(acomp->base, drv, cpu_dais, num_cpu_dais);
>   	if (ret < 0)
>   		return ret;
>   
> -	return snd_soc_add_component(&acomp->base, cpu_dais, num_cpu_dais);
> +	return 0;

Nitpick: you could just:
	return snd_soc_register_component(...);

Note: alone that's not a reason for a resend and v4.  I can do that 
later when doing my quarterly driver reviews/scans.

>   }
>   
>   static struct snd_soc_dai_driver dmic_cpu_dais[] = {


^ permalink raw reply	[flat|nested] 16+ messages in thread

* Re: [PATCH v3 00/12] ASoC: add and use new snd_soc_register_component()
  2026-07-06  2:01 [PATCH v3 00/12] ASoC: add and use new snd_soc_register_component() Kuninori Morimoto
                   ` (11 preceding siblings ...)
  2026-07-06  2:03 ` [PATCH v3 12/12] ASoC: soc-core: remove dev from soc_component_initialize() Kuninori Morimoto
@ 2026-07-06  9:01 ` Cezary Rojewski
  2026-07-06 23:11   ` Kuninori Morimoto
  12 siblings, 1 reply; 16+ messages in thread
From: Cezary Rojewski @ 2026-07-06  9:01 UTC (permalink / raw)
  To: Kuninori Morimoto
  Cc: Amadeusz Sławiński, Bard Liao, bui duc phuc,
	Fabio Estevam, Jaroslav Kysela, Kai Vehmanen, Lars-Peter Clausen,
	Liam Girdwood, linux-sound, Mark Brown, Nicolin Chen,
	Peter Ujfalusi, Pierre-Louis Bossart, Shengjiu Wang, Takashi Iwai,
	Xiubo Li

On 7/6/2026 4:01 AM, Kuninori Morimoto wrote:
> Hi
> 
> Current component has component->name. But snd_soc_register_component()
> user can't setup it, because component itself is alloced in that function.
> 
> So, to setup it, user need to use snd_soc_component_initialize() /
> snd_soc_add_component() directly instead of using
> snd_soc_register_component().
> 
> In the same time, Component will be capsuled soon.
> 
> Let's tidyup around here.
> All strange code can be gone if we have both below style.
> 
> Normal case
> 	snd_soc_register_component(dev, ...);
> 
> Want to setup case
> 	component = snd_soc_component_alloc(...);
> 
> 	snd_soc_component_set_xxx(component, ...);
> 	snd_soc_component_set_xxx(component, ...);
> 
> (A)	snd_soc_register_component(component, ...);
> 
> This patch-set adds new snd_soc_register_component() which allows to use
> component (A).
> 
> Originally, this patch-set was posted as
> 	v1: ASoC: intel: use component_name for Component name
> 	v2: ASoC: add [devm_]snd_soc_register_component_with_name()
> 
> Link: https://lore.kernel.org/r/87fr29esth.wl-kuninori.morimoto.gx@renesas.com
> Link: https://lore.kernel.org/r/87v7ayxk3s.wl-kuninori.morimoto.gx@renesas.com
Thank you for good discussion, addressing some and providing technical 
arguments for those comments we didn't square on.  I've spent quite a 
while analyzing the subject and the outcome is:  Is there something I 
can help with, to make the conversion easier?

And obviously:
Reviewed-by: Cezary Rojewski <cezary.rojewski@intel.com>

^ permalink raw reply	[flat|nested] 16+ messages in thread

* Re: [PATCH v3 00/12] ASoC: add and use new snd_soc_register_component()
  2026-07-06  9:01 ` [PATCH v3 00/12] ASoC: add and use new snd_soc_register_component() Cezary Rojewski
@ 2026-07-06 23:11   ` Kuninori Morimoto
  0 siblings, 0 replies; 16+ messages in thread
From: Kuninori Morimoto @ 2026-07-06 23:11 UTC (permalink / raw)
  To: Cezary Rojewski
  Cc: Amadeusz Sławiński, Bard Liao, bui duc phuc,
	Fabio Estevam, Jaroslav Kysela, Kai Vehmanen, Lars-Peter Clausen,
	Liam Girdwood, linux-sound, Mark Brown, Nicolin Chen,
	Peter Ujfalusi, Pierre-Louis Bossart, Shengjiu Wang, Takashi Iwai,
	Xiubo Li


Hi Cezary

Thank you for your review

> Thank you for good discussion, addressing some and providing technical
> arguments for those comments we didn't square on.

Thank you too.

Actually, I had small concerned point in my original patch-set.
But it is resolved and become more nice patch-set because of discussion
with you. Thanks again.

> I've spent quite a while analyzing the subject and the outcome is:
> Is there something I can help with, to make the conversion easier?

Actually I have been already created full-patch-set (for Component/DAI/Card).
Of course it need to be more replace / brush-up, but remaining is just
posting them to ML.
It will be great help for me if you can review them.

Thank you for your help !!

Best regards
---
Kuninori Morimoto

^ permalink raw reply	[flat|nested] 16+ messages in thread

end of thread, other threads:[~2026-07-06 23:11 UTC | newest]

Thread overview: 16+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-07-06  2:01 [PATCH v3 00/12] ASoC: add and use new snd_soc_register_component() Kuninori Morimoto
2026-07-03  1:19 ` [PATCH v3 01/12] ASoC: soc-component: move soc_component_field_shift() Kuninori Morimoto
2026-07-06  2:02 ` [PATCH v3 02/12] ASoC: soc-component: add snd_soc_component_alloc() Kuninori Morimoto
2026-07-06  2:02 ` [PATCH v3 03/12] ASoC: soc-component: add snd_soc_register_component_{c/d}() Kuninori Morimoto
2026-07-06  2:02 ` [PATCH v3 04/12] ASoC: soc-component: add snd_soc_component_{set_}name() Kuninori Morimoto
2026-07-06  2:02 ` [PATCH v3 05/12] ASoC: soc-component: add snd_soc_component_{set/to}_priv() Kuninori Morimoto
2026-07-06  2:02 ` [PATCH v3 06/12] ASoC: intel: avs: use snd_soc_register_component() Kuninori Morimoto
2026-07-06  8:55   ` Cezary Rojewski
2026-07-06  2:02 ` [PATCH v3 07/12] ASoC: intel: avs: probes: " Kuninori Morimoto
2026-07-06  2:02 ` [PATCH v3 08/12] ASoC: intel: catpt: pcm: " Kuninori Morimoto
2026-07-06  2:02 ` [PATCH v3 09/12] ASoC: soc-generic-dmaengine-pcm: " Kuninori Morimoto
2026-07-06  2:02 ` [PATCH v3 10/12] ASoC: soc-topology-test: " Kuninori Morimoto
2026-07-06  2:02 ` [PATCH v3 11/12] ASoC: soc-core: makes snd_soc_component_initialize() / snd_soc_add_component() local Kuninori Morimoto
2026-07-06  2:03 ` [PATCH v3 12/12] ASoC: soc-core: remove dev from soc_component_initialize() Kuninori Morimoto
2026-07-06  9:01 ` [PATCH v3 00/12] ASoC: add and use new snd_soc_register_component() Cezary Rojewski
2026-07-06 23:11   ` Kuninori Morimoto

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox