summaryrefslogtreecommitdiff
path: root/include
diff options
context:
space:
mode:
authorCezary Rojewski <cezary.rojewski@intel.com>2026-10-07 15:33:47 +0200
committerMark Brown <broonie@kernel.org>2026-10-12 23:55:48 +0100
commit0f2bec6921f0971c2fc2f8bb5a93229b6546dded (patch)
treea2a4118e05cbdf34efc6831bd2252f309d4bfd3c /include
parent995b96380ba5d98131acc162608da3538e1395d8 (diff)
downloadlinux-0f2bec6921f0971c2fc2f8bb5a93229b6546dded.tar.gz
linux-0f2bec6921f0971c2fc2f8bb5a93229b6546dded.zip
ASoC: core: Add component constructor
There is a gap between snd_soc_component_alloc() and snd_soc_register_component(). A driver that obtains a component object through snd_soc_component_alloc() receives an object in uninitialized state. soc_component_initialize() is the function responsible for bringing it into a sane one but it is not accessible by the framework users. The framework shall prevent manipulation of uninitialized components. Introduce snd_soc_component_new() which acts as a constructor: allocates and initializes the component object before returning it to the caller. Cc: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com> Signed-off-by: Cezary Rojewski <cezary.rojewski@intel.com> Link: https://patch.msgid.link/20261007133353.455185-2-cezary.rojewski@intel.com Signed-off-by: Mark Brown <broonie@kernel.org>
Diffstat (limited to 'include')
-rw-r--r--include/sound/soc-component.h2
1 files changed, 2 insertions, 0 deletions
diff --git a/include/sound/soc-component.h b/include/sound/soc-component.h
index 6c1acc984ecb..d51f71e2f334 100644
--- a/include/sound/soc-component.h
+++ b/include/sound/soc-component.h
@@ -292,6 +292,8 @@ static inline int snd_soc_component_cache_sync(
return regcache_sync(component->regmap);
}
+struct snd_soc_component *snd_soc_component_new(struct device *dev, const char *name,
+ const struct snd_soc_component_driver *driver);
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);