From de182d84b3a73f93fbd524843bcf6987bae76120 Mon Sep 17 00:00:00 2001 From: Kuninori Morimoto Date: Thu, 23 Jul 2026 06:34:24 +0000 Subject: [PATCH] ASoC: soc-component: add snd_soc_component_alloc() 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 Reviewed-by: Cezary Rojewski Link: https://patch.msgid.link/87v7a6rz80.wl-kuninori.morimoto.gx@renesas.com Signed-off-by: Mark Brown --- 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 4b7d7954953d..874559458bd5 100644 --- a/include/sound/soc-component.h +++ b/include/sound/soc-component.h @@ -283,6 +283,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 7fbd6a711ed8..60531e9f9f9a 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.