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 <kuninori.morimoto.gx@renesas.com>
Reviewed-by: Cezary Rojewski <cezary.rojewski@intel.com>
Link: https://patch.msgid.link/87v7a6rz80.wl-kuninori.morimoto.gx@renesas.com
Signed-off-by: Mark Brown <broonie@kernel.org>
This commit is contained in:
Kuninori Morimoto
2026-07-23 06:34:24 +00:00
committed by Mark Brown
parent 23b64e9b9b
commit de182d84b3
2 changed files with 14 additions and 0 deletions

View File

@@ -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);

View File

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