[PATCH v5 02/12] ASoC: soc-component: add snd_soc_component_alloc()
Kuninori Morimoto <[email protected]>
| Newsgroups | org.kernel.vger.linux-sound |
|---|---|
| Message-ID | <[email protected]> |
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 <[email protected]> Reviewed-by: Cezary Rojewski <[email protected]> --- 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