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 6/7] ASoC: Intel: avs: Switch to snd_snd_component_new()
Date: Wed,  7 Oct 2026 15:33:52 +0200	[thread overview]
Message-ID: <20261007133353.455185-7-cezary.rojewski@intel.com> (raw)
In-Reply-To: <20261007133353.455185-1-cezary.rojewski@intel.com>

snd_soc_component_alloc() leaves the component object in uninitialized
state. Switch to the constructor function to retrieve and operate on
object in sane state.

Signed-off-by: Cezary Rojewski <cezary.rojewski@intel.com>
---
 sound/soc/intel/avs/pcm.c    | 11 +++++------
 sound/soc/intel/avs/probes.c | 12 ++++--------
 2 files changed, 9 insertions(+), 14 deletions(-)

diff --git a/sound/soc/intel/avs/pcm.c b/sound/soc/intel/avs/pcm.c
index 2d7ced953fde..6dd2b938baaa 100644
--- a/sound/soc/intel/avs/pcm.c
+++ b/sound/soc/intel/avs/pcm.c
@@ -1399,10 +1399,6 @@ int avs_register_component(struct device *dev, const char *name,
 	if (!acomp)
 		return -ENOMEM;
 
-	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;
@@ -1411,10 +1407,13 @@ int avs_register_component(struct device *dev, const char *name,
 
 	drv->use_dai_pcm_id = !obsolete_card_names;
 
-	snd_soc_component_set_name(acomp->base, comp_name);
+	acomp->base = snd_soc_component_new(dev, comp_name, drv);
+	if (IS_ERR(acomp->base))
+		return PTR_ERR(acomp->base);
+
 	snd_soc_component_set_priv(acomp->base, acomp);
 
-	return snd_soc_register_component(acomp->base, drv, cpu_dais, num_cpu_dais);
+	return snd_soc_component_register(acomp->base, cpu_dais, num_cpu_dais);
 }
 
 static struct snd_soc_dai_driver dmic_cpu_dais[] = {
diff --git a/sound/soc/intel/avs/probes.c b/sound/soc/intel/avs/probes.c
index 2e4063b743ba..483e151dfd66 100644
--- a/sound/soc/intel/avs/probes.c
+++ b/sound/soc/intel/avs/probes.c
@@ -298,17 +298,13 @@ int avs_register_probe_component(struct avs_dev *adev, const char *name)
 	struct snd_soc_component *component;
 	const char *comp_name;
 
-	component = snd_soc_component_alloc(adev->dev);
-	if (!component)
-		return -ENOMEM;
-
 	comp_name = devm_kstrdup(adev->dev, name, GFP_KERNEL);
 	if (!comp_name)
 		return -ENOMEM;
 
-	snd_soc_component_set_name(component, comp_name);
+	component = snd_soc_component_new(adev->dev, comp_name, &avs_probe_component_driver);
+	if (IS_ERR(component))
+		return PTR_ERR(component);
 
-	return snd_soc_register_component(component,
-					  &avs_probe_component_driver,
-					  probe_cpu_dais, ARRAY_SIZE(probe_cpu_dais));
+	return snd_soc_component_register(component, probe_cpu_dais, ARRAY_SIZE(probe_cpu_dais));
 }
-- 
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 ` Cezary Rojewski [this message]
2026-10-07 13:33 ` [PATCH 7/7] ASoC: core: Remove unused component-register members Cezary Rojewski

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-7-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