ASoC: add new Component functions
Subsystems (3)
cover ASoC: add new Component functions
Hi Mark
I'm now posting ASoC Capsuling patches.
Current status, and this patch-set postion is below. This patch-set moves Card related functions to soc-card.c
x: done
o: This patch-set
[x] move DAI functions
[x] add new DAI functions
[x] move Component functions
[x] move Card functions
[o] add new Component functions
[ ] rename DAI/Component list
[ ] move Card functions v2
[ ] add new Card functions
[ ] adjust Test
[ ] use new Card register
[ ] use new functions on all drivers
[ ] Capsule DAI/Component/Card
Kuninori Morimoto (20):
ASoC: soc-generic-dmaengine-pcm: move devm_snd_dmaengine_pcm_register()
ASoC: soc-component: rename snd_soc_component_{init/exit}_regmap() to snd_soc_component_regmap_{init/exit}()
ASoC: soc-component: move snd_soc_register_[un]component() to soc-component.c
ASoC: soc-component: move devm_snd_soc_component_register()
ASoC: soc-component: move snd_soc_of_xlate_dai_name() to soc-component.c
ASoC: soc-component: makes regmap function to inline macro
ASoC: soc-component: add snd_soc_component_name_prefix()
ASoC: soc-component: add snd_soc_component_to_dev()
ASoC: soc-component: add snd_soc_component_to_driver()
ASoC: soc-component: add snd_soc_component_to_card()
ASoC: soc-component: add snd_soc_component_to_debugfs_root()
ASoC: soc-component: add snd_soc_component_to_regmap()
ASoC: soc-component: add snd_soc_component_regcache_mark_dirty()
ASoC: soc-component: add snd_soc_component_regcache_cache_only()
ASoC: soc-component: add snd_soc_component_regcache_cache_bypass()
ASoC: soc-component: add snd_soc_component_regmap_multi_reg_write_bypassed()
ASoC: soc-component: add snd_soc_component_num_dai()
ASoC: soc-component: add snd_soc_component_connect_dai()
ASoC: soc-component: add snd_soc_component_active_update()
ASoC: soc-component: add snd_soc_component_device_link_{add/del}()
include/sound/soc-component.h | 118 ++++++- include/sound/soc.h | 14 - sound/soc/soc-card.c | 22 +- sound/soc/soc-component.c | 432 ++++++++++++++++++++++---- sound/soc/soc-core.c | 245 --------------- sound/soc/soc-dai.c | 5 +- sound/soc/soc-devres.c | 80 ----- sound/soc/soc-generic-dmaengine-pcm.c | 36 +++ sound/soc/soc-internal.h | 4 + sound/soc/soc-pcm.c | 2 +- 10 files changed, 530 insertions(+), 428 deletions(-)
Signature · 1 line
2.53.0
PATCH 1/20 ASoC: soc-generic-dmaengine-pcm: move devm_snd_dmaengine_pcm_register()
We don't need to have dmaengine related function in soc-devres.c. Let's move it.
--- sound/soc/soc-devres.c | 40 --------------------------- sound/soc/soc-generic-dmaengine-pcm.c | 36 ++++++++++++++++++++++++ 2 files changed, 36 insertions(+), 40 deletions(-)
sound/soc/soc-devres.c +0 -40
@@ -63,43 +63,3 @@ int devm_snd_soc_register_card(struct device *dev, struct snd_soc_card *card)return snd_soc_register_card (card); }EXPORT_SYMBOL_GPL (devm_snd_soc_register_card); - -#ifdef CONFIG_SND_SOC_GENERIC_DMAENGINE_PCM - -static void devm_dmaengine_pcm_release (struct device *dev,void *res) -{ -snd_dmaengine_pcm_unregister (*(struct device **)res); -} - -/** -* devm_snd_dmaengine_pcm_register - resource managed dmaengine PCM registration -* @dev: The parent device for the PCM device -* @config: Platform specific PCM configuration -* @flags: Platform specific quirks -* -* Register a dmaengine based PCM device with automatic unregistration when the -* device is unregistered. -*/ -int devm_snd_dmaengine_pcm_register (struct device *dev, -const struct snd_dmaengine_pcm_config *config,unsigned int flags) -{ -struct device **ptr; -int ret; - - ptr =devres_alloc (devm_dmaengine_pcm_release,sizeof (*ptr),GFP_KERNEL ); -if (!ptr) -return -ENOMEM ; - - ret =snd_dmaengine_pcm_register (dev, config, flags); -if (ret ==0 ) { - *ptr = dev; -devres_add (dev, ptr); - }else { -devres_free (ptr); - } - -return ret; -} -EXPORT_SYMBOL_GPL (devm_snd_dmaengine_pcm_register); - -#endif
sound/soc/soc-generic-dmaengine-pcm.c +36 -0
@@ -520,5 +520,41 @@ void snd_dmaengine_pcm_unregister(struct device *dev) }EXPORT_SYMBOL_GPL (snd_dmaengine_pcm_unregister); +static void devm_dmaengine_pcm_release (struct device *dev,void *res) +{ +snd_dmaengine_pcm_unregister (*(struct device **)res); +} + +/** +* devm_snd_dmaengine_pcm_register - resource managed dmaengine PCM registration +* @dev: The parent device for the PCM device +* @config: Platform specific PCM configuration +* @flags: Platform specific quirks +* +* Register a dmaengine based PCM device with automatic unregistration when the +* device is unregistered. +*/ +int devm_snd_dmaengine_pcm_register (struct device *dev, +const struct snd_dmaengine_pcm_config *config,unsigned int flags) +{ +struct device **ptr; +int ret; + + ptr =devres_alloc (devm_dmaengine_pcm_release,sizeof (*ptr),GFP_KERNEL ); +if (!ptr) +return -ENOMEM ; + + ret =snd_dmaengine_pcm_register (dev, config, flags); +if (ret ==0 ) { + *ptr = dev; +devres_add (dev, ptr); + }else { +devres_free (ptr); + } + +return ret; +} +EXPORT_SYMBOL_GPL (devm_snd_dmaengine_pcm_register); +MODULE_DESCRIPTION ("ASoC helpers for generic PCM dmaengine API" );MODULE_LICENSE ("GPL" );
Signature · 1 line
2.53.0
Re: [PATCH 01/20] ASoC: soc-generic-dmaengine-pcm: move devm_snd_dmaengine_pcm_register()
Quoted 4 lines · Kuninori Morimoto
We don't need to have dmaengine related function in
soc-devres.c. Let's move it.Signed-off-by Kuninori Morimoto <[email protected]>
Quoted 4 lines
--- sound/soc/soc-devres.c | 40 --------------------------- sound/soc/soc-generic-dmaengine-pcm.c | 36 ++++++++++++++++++++++++ 2 files changed, 36 insertions(+), 40 deletions(-)
PATCH 2/20 ASoC: soc-component: rename snd_soc_component_{init/exit}_regmap() to snd_soc_component_regmap_{init/exit}()
In reply to Kuninori Morimotostruct snd_soc_component will be capsuled soon, its member will not be able to access from non soc-component.c.
We already have snd_soc_component_regmap_xxx() functions. Let's standardize the function names.
- snd_soc_component_{init/exit}_regmap()
+ snd_soc_component_regmap_{init/exit}()
And no need to have CONFIG_REGMAP, remove #if-#endif
--- include/sound/soc-component.h | 10 +++++----- sound/soc/soc-component.c | 16 ++++++---------- 2 files changed, 11 insertions(+), 15 deletions(-)
include/sound/soc-component.h +5 -5
@@ -333,14 +333,12 @@ int snd_soc_component_stream_event(struct snd_soc_component *component,int snd_soc_component_set_bias_level (struct snd_soc_component *component,enum snd_soc_bias_level level); +void snd_soc_component_regmap_init (struct snd_soc_component *component, +struct regmap *regmap); +void snd_soc_component_regmap_exit (struct snd_soc_component *component);int snd_soc_component_regmap_val_bytes (struct snd_soc_component *component);int snd_soc_component_regmap_cache_sync (struct snd_soc_component *component);void snd_soc_component_regmap_async_complete (struct snd_soc_component *component); -#ifdef CONFIG_REGMAP -void snd_soc_component_init_regmap (struct snd_soc_component *component, -struct regmap *regmap); -void snd_soc_component_exit_regmap (struct snd_soc_component *component); -#endif int snd_soc_component_fixup_controls (struct snd_soc_component *component); int snd_soc_component_add_controls(struct snd_soc_component *component,
@@ -445,6 +443,8 @@ void snd_soc_pcm_component_delay(struct snd_pcm_substream *substream, snd_pcm_sframes_t *cpu_delay, snd_pcm_sframes_t *codec_delay);/* REMOVE ME */ +#define snd_soc_component_init_regmap snd_soc_component_regmap_init +#define snd_soc_component_exit_regmap snd_soc_component_regmap_exit#define snd_soc_component_cache_sync snd_soc_component_regmap_cache_sync#define snd_soc_component_async_complete snd_soc_component_regmap_async_complete#define snd_soc_lookup_component_nolocked snd_soc_component_lookup_nolock
sound/soc/soc-component.c +6 -10
@@ -432,10 +432,8 @@ void snd_soc_component_regmap_async_complete(struct snd_soc_component *component }EXPORT_SYMBOL_GPL (snd_soc_component_regmap_async_complete); -#ifdef CONFIG_REGMAP -/** -* snd_soc_component_init_regmap() - Initialize regmap instance for the +* snd_soc_component_regmap_init() - Initialize regmap instance for the * component * @component: The component for which to initialize the regmap instance * @regmap: The regmap instance that should be used by the component
@@ -445,15 +443,15 @@ EXPORT_SYMBOL_GPL(snd_soc_component_regmap_async_complete);* yet ready when the component is registered. The function must also be called * before the first IO attempt of the component. */ -void snd_soc_component_init_regmap (struct snd_soc_component *component, +void snd_soc_component_regmap_init (struct snd_soc_component *component,struct regmap *regmap) { component->regmap = regmap; } -EXPORT_SYMBOL_GPL (snd_soc_component_init_regmap); +EXPORT_SYMBOL_GPL (snd_soc_component_regmap_init);/** -* snd_soc_component_exit_regmap() - De-initialize regmap instance for the +* snd_soc_component_regmap_exit() - De-initialize regmap instance for the * component * @component: The component for which to de-initialize the regmap instance *
@@ -463,14 +461,12 @@ EXPORT_SYMBOL_GPL(snd_soc_component_init_regmap);* This function should only be used if snd_soc_component_init_regmap() was used * to initialize the regmap instance. */ -void snd_soc_component_exit_regmap (struct snd_soc_component *component) +void snd_soc_component_regmap_exit (struct snd_soc_component *component) {regmap_exit (component->regmap); component->regmap =NULL ; } -EXPORT_SYMBOL_GPL (snd_soc_component_exit_regmap); - -#endif +EXPORT_SYMBOL_GPL (snd_soc_component_regmap_exit);int snd_soc_component_compr_open (struct snd_soc_component *component,struct snd_compr_stream *cstream)
Signature · 1 line
2.53.0
[email protected]
AI reviewRe: [PATCH 02/20] ASoC: soc-component: rename snd_soc_component_{init/exit}_regmap() to snd_soc_component_regmap_{init/exit}()
Thank you for your contribution! Sashiko AI review found 1 potential issue to consider: - [Medium] ASoC: soc-component: build failure in snd_soc_component_regmap_exit() when !CONFIG_REGMAP --
Thank you for your contribution! Sashiko AI review found 1 potential issue to consider:
- [Medium] ASoC: soc-component: build failure in snd_soc_component_regmap_exit() when !CONFIG_REGMAP
--
commit b2a7793f33b0c23793a100c7c2aba1692324766a
Author: Kuninori Morimoto <[email protected]>
ASoC: soc-component: rename snd_soc_component_{init/exit}_regmap() to snd_soc_component_regmap_{init/exit}()
This commit renames snd_soc_component_{init,exit}_regmap() to snd_soc_component_regmap_{init,exit}(), provides compatibility macros for the old names, and removes the #ifdef CONFIG_REGMAP guards around them.
Quoted 39 lines
sound/soc/soc-component.c +4
-6@@ -432,10 +432,8 @@ void snd_soc_component_regmap_async_complete(struct snd_soc_component *component }EXPORT_SYMBOL_GPL (snd_soc_component_regmap_async_complete); -#ifdef CONFIG_REGMAP -/** -* snd_soc_component_init_regmap() - Initialize regmap instance for the +* snd_soc_component_regmap_init() - Initialize regmap instance for the * component * @component: The component for which to initialize the regmap instance * @regmap: The regmap instance that should be used by the component @@ -445,15 +443,15 @@ EXPORT_SYMBOL_GPL(snd_soc_component_regmap_async_complete);* yet ready when the component is registered. The function must also be called * before the first IO attempt of the component. */ -void snd_soc_component_init_regmap (struct snd_soc_component *component, +void snd_soc_component_regmap_init (struct snd_soc_component *component,struct regmap *regmap) { component->regmap = regmap; } -EXPORT_SYMBOL_GPL (snd_soc_component_init_regmap); +EXPORT_SYMBOL_GPL (snd_soc_component_regmap_init);/** -* snd_soc_component_exit_regmap() - De-initialize regmap instance for the +* snd_soc_component_regmap_exit() - De-initialize regmap instance for the * component * @component: The component for which to de-initialize the regmap instance * @@ -463,14 +461,12 @@ EXPORT_SYMBOL_GPL(snd_soc_component_init_regmap);* This function should only be used if snd_soc_component_init_regmap() was used * to initialize the regmap instance. */
sound/soc/soc-component.c EXPORT_SYMBOL_GPL(snd_soc_component_init_regmap); · line 469
Quoted 10 lines
sound/soc/soc-component.c +2
-4-void snd_soc_component_exit_regmap (struct snd_soc_component *component) +void snd_soc_component_regmap_exit (struct snd_soc_component *component) {regmap_exit (component->regmap); component->regmap =NULL ; } -EXPORT_SYMBOL_GPL (snd_soc_component_exit_regmap); - -#endif +EXPORT_SYMBOL_GPL (snd_soc_component_regmap_exit);
[Severity: Medium]
Does removing the #ifdef CONFIG_REGMAP guard around snd_soc_component_regmap_exit() break builds when CONFIG_SND_SOC is enabled and CONFIG_REGMAP is disabled?
In sound/soc/Kconfig, SND_SOC only selects REGMAP_I2C if I2C and REGMAP_SPI if SPI_MASTER, so CONFIG_REGMAP can remain unset. Unlike regmap_get_val_bytes(), regcache_sync(), and regmap_async_complete(), regmap_exit() is only declared inside the #ifdef CONFIG_REGMAP block in include/linux/regmap.h and has no stub when CONFIG_REGMAP is disabled, causing an implicit function declaration error here.
Signature · 1 line
Sashiko AI review · https://sashiko.dev/#/patchset/[email protected]?part=2
PATCH 3/20 ASoC: soc-component: move snd_soc_register_[un]component() to soc-component.c
In reply to Kuninori Morimotostruct snd_soc_component will be capsuled soon, its member will not be able to access from non soc-component.c.
move snd_soc_register_[un]component() to soc-component.c
--- include/sound/soc-component.h | 10 ++ include/sound/soc.h | 11 -- sound/soc/soc-component.c | 214 ++++++++++++++++++++++++++++++++++ sound/soc/soc-core.c | 212 --------------------------------- 4 files changed, 224 insertions(+), 223 deletions(-)
include/sound/soc-component.h +10 -0
@@ -278,6 +278,16 @@ struct snd_soc_component *snd_soc_component_new(struct device *dev, const char *int snd_soc_component_register (struct snd_soc_component *component,struct snd_soc_dai_driver *dai_drv,int num_dai); +int snd_soc_register_component (struct device *dev, +const struct snd_soc_component_driver *component_driver, +struct snd_soc_dai_driver *dai_drv,int num_dai); + +int devm_snd_soc_register_component (struct device *dev, +const struct snd_soc_component_driver *component_driver, +struct snd_soc_dai_driver *dai_drv,int num_dai); +#define snd_soc_unregister_component (dev) snd_soc_unregister_component_by_driver(dev, NULL) +void snd_soc_unregister_component_by_driver (struct device *dev, +const struct snd_soc_component_driver *component_driver);const char *snd_soc_component_name (struct snd_soc_component *component);
include/sound/soc.h +0 -11
@@ -447,17 +447,6 @@ static inline int snd_soc_resume(struct device *dev) }#endif int snd_soc_poweroff (struct device *dev); -int snd_soc_register_component (struct device *dev, -const struct snd_soc_component_driver *component_driver, -struct snd_soc_dai_driver *dai_drv,int num_dai); - -int devm_snd_soc_register_component (struct device *dev, -const struct snd_soc_component_driver *component_driver, -struct snd_soc_dai_driver *dai_drv,int num_dai); -#define snd_soc_unregister_component (dev) snd_soc_unregister_component_by_driver(dev, NULL) -void snd_soc_unregister_component_by_driver (struct device *dev, -const struct snd_soc_component_driver *component_driver); -int soc_new_pcm (struct snd_soc_pcm_runtime *rtd);#ifdef CONFIG_SND_SOC_COMPRESS int snd_soc_new_compress (struct snd_soc_pcm_runtime *rtd);
sound/soc/soc-component.c +214 -0
217 lines not on this page · raw message
sound/soc/soc-core.c +0 -212
218 lines not on this page · raw message
Signature · 1 line
2.53.0
[email protected]
AI reviewRe: [PATCH 03/20] ASoC: soc-component: move snd_soc_register_[un]component() to soc-component.c
Thank you for your contribution! Sashiko AI review found no new issues in this patch, but noticed 1 related pre-existing issue it does not introduce: - [Medium] ASoC: dmaengine: memory leak in…
Thank you for your contribution! Sashiko AI review found no new issues in this patch, but noticed 1 related pre-existing issue it does not introduce:
- [Medium] ASoC: dmaengine: memory leak in snd_dmaengine_pcm_unregister() [1]
--
commit a5f7b09ef3fb2f0bb4b4617d3a6ce6f9faafae80
Author: Kuninori Morimoto <[email protected]>
ASoC: soc-component: move snd_soc_register_[un]component() to soc-component.c
This commit moves component registration and unregistration functions and their declarations from soc-core.c and soc.h to soc-component.c and soc-component.h.
Quoted 5 lines
sound/soc/soc-component.c +0
-0@@ -1549,3 +1549,217 @@ struct snd_soc_component *snd_soc_component_lookup_by_name(const char *component
[ ... ]
Quoted 10 lines
sound/soc/soc-component.c +10
-0+void snd_soc_unregister_component_by_driver (struct device *dev, +const struct snd_soc_component_driver *component_driver) +{ +const char *driver_name =NULL ; + +if (component_driver) + driver_name = component_driver->name; + +guard (mutex)(&client_mutex); +
sound/soc/soc-component.c struct snd_soc_component *snd_soc_component_lookup_by_name(const char *component · line 1764
Quoted 10 lines
sound/soc/soc-component.c +10
-0+while (1 ) { +struct snd_soc_component *component; + + component =snd_soc_lookup_component_nolocked (dev, driver_name); +if (!component) +break ; + +snd_soc_del_component_unlocked (component); + } +}
[Severity: Medium]
This problem wasn't introduced by this patch, but can this loop cause snd_dmaengine_pcm_unregister() to leak dmaengine_pcm structures and DMA channels [1] when a device registers multiple dmaengine PCMs?
sound/soc/soc-generic-dmaengine-pcm.c:snd_dmaengine_pcm_unregister() {
component = snd_soc_lookup_component(dev, SND_DMAENGINE_PCM_DRV_NAME);
if (!component)
return;
pcm = snd_soc_component_to_priv(component);
snd_soc_unregister_component_by_driver(dev, component->driver);
dmaengine_pcm_release_chan(pcm);
kfree(pcm);
}When devres releases multiple PCMs registered via devm_snd_dmaengine_pcm_register() on the same device, the first call to snd_dmaengine_pcm_unregister() removes all components matching SND_DMAENGINE_PCM_DRV_NAME. Subsequent release callbacks then get NULL from snd_soc_lookup_component() and return early without releasing their DMA channels or freeing their pcm structures.
[1] https://sashiko.dev/#/bug/linux-259df7eb-71d4-4d88-9686-fca9af84a4de
Signature · 1 line
Sashiko AI review · https://sashiko.dev/#/patchset/[email protected]?part=3
Re: [PATCH 03/20] ASoC: soc-component: move snd_soc_register_[un]component() to soc-component.c
Hi ALSA ML
Quoted 17 lines
[Severity: Medium]
This problem wasn't introduced by this patch, but can this loop causesnd_dmaengine_pcm_unregister()to leakdmaengine_pcmstructures and DMA channels [1] when a device registers multiple dmaengine PCMs?sound/soc/soc-generic-dmaengine-pcm.c:snd_dmaengine_pcm_unregister() { component = snd_soc_lookup_component(dev, SND_DMAENGINE_PCM_DRV_NAME); if (!component) return; pcm = snd_soc_component_to_priv(component); snd_soc_unregister_component_by_driver(dev, component->driver); dmaengine_pcm_release_chan(pcm); kfree(pcm); }
Quoted 6 lines
When devres releases multiple PCMs registered via
devm_snd_dmaengine_pcm_register()on the same device, the first call tosnd_dmaengine_pcm_unregister()removes all components matchingSND_DMAENGINE_PCM_DRV_NAME. Subsequent release callbacks then get NULL fromsnd_soc_lookup_component()and return early without releasing their DMA channels or freeing their pcm structures.
This is not related to this patch, but indeed issue. I will solve this issue too in v2 patch.
Thank you for your help !!
Best regards
---
Kuninori Morimoto
Re: [PATCH 03/20] ASoC: soc-component: move snd_soc_register_[un]component() to soc-component.c
In reply to Kuninori MorimotoQuoted 6 lines · Kuninori Morimoto
struct
snd_soc_componentwill be capsuled soon, its member will not be able to access from nonsoc-component.c.move snd_soc_register_[un]component() to
soc-component.cSigned-off-by Kuninori Morimoto <[email protected]>
Quoted 6 lines
--- include/sound/soc-component.h | 10 ++ include/sound/soc.h | 11 -- sound/soc/soc-component.c | 214 ++++++++++++++++++++++++++++++++++ sound/soc/soc-core.c | 212 --------------------------------- 4 files changed, 224 insertions(+), 223 deletions(-)
PATCH 4/20 ASoC: soc-component: move devm_snd_soc_component_register()
In reply to Kuninori MorimotoWe don't need to have component related function in soc-devres.c. Let's move it.
--- sound/soc/soc-component.c | 40 +++++++++++++++++++++++++++++++++++++++ sound/soc/soc-devres.c | 40 --------------------------------------- 2 files changed, 40 insertions(+), 40 deletions(-)
sound/soc/soc-component.c +40 -0
@@ -1763,3 +1763,43 @@ void snd_soc_unregister_component_by_driver(struct device *dev, } }EXPORT_SYMBOL_GPL (snd_soc_unregister_component_by_driver); + +static void devm_component_release (struct device *dev,void *res) +{ +const struct snd_soc_component_driver **cmpnt_drv = res; + +snd_soc_unregister_component_by_driver (dev, *cmpnt_drv); +} + +/** +* devm_snd_soc_register_component - resource managed component registration +* @dev: Device used to manage component +* @cmpnt_drv: Component driver +* @dai_drv: DAI driver +* @num_dai: Number of DAIs to register +* +* Register a component with automatic unregistration when the device is +* unregistered. +*/ +int devm_snd_soc_register_component (struct device *dev, +const struct snd_soc_component_driver *cmpnt_drv, +struct snd_soc_dai_driver *dai_drv,int num_dai) +{ +const struct snd_soc_component_driver **ptr; +int ret; + + ptr =devres_alloc (devm_component_release,sizeof (*ptr),GFP_KERNEL ); +if (!ptr) +return -ENOMEM ; + + ret =snd_soc_register_component (dev, cmpnt_drv, dai_drv, num_dai); +if (ret ==0 ) { + *ptr = cmpnt_drv; +devres_add (dev, ptr); + }else { +devres_free (ptr); + } + +return ret; +} +EXPORT_SYMBOL_GPL (devm_snd_soc_register_component);
sound/soc/soc-devres.c +0 -40
@@ -9,46 +9,6 @@#include <sound/soc.h> #include <sound/dmaengine_pcm.h> -static void devm_component_release (struct device *dev,void *res) -{ -const struct snd_soc_component_driver **cmpnt_drv = res; - -snd_soc_unregister_component_by_driver (dev, *cmpnt_drv); -} - -/** -* devm_snd_soc_register_component - resource managed component registration -* @dev: Device used to manage component -* @cmpnt_drv: Component driver -* @dai_drv: DAI driver -* @num_dai: Number of DAIs to register -* -* Register a component with automatic unregistration when the device is -* unregistered. -*/ -int devm_snd_soc_register_component (struct device *dev, -const struct snd_soc_component_driver *cmpnt_drv, -struct snd_soc_dai_driver *dai_drv,int num_dai) -{ -const struct snd_soc_component_driver **ptr; -int ret; - - ptr =devres_alloc (devm_component_release,sizeof (*ptr),GFP_KERNEL ); -if (!ptr) -return -ENOMEM ; - - ret =snd_soc_register_component (dev, cmpnt_drv, dai_drv, num_dai); -if (ret ==0 ) { - *ptr = cmpnt_drv; -devres_add (dev, ptr); - }else { -devres_free (ptr); - } - -return ret; -} -EXPORT_SYMBOL_GPL (devm_snd_soc_register_component); -/** * devm_snd_soc_register_card - resource managed card registration * @dev: Device used to manage card
Signature · 1 line
2.53.0
Re: [PATCH 04/20] ASoC: soc-component: move devm_snd_soc_component_register()
Quoted 4 lines · Kuninori Morimoto
We don't need to have component related function in
soc-devres.c. Let's move it.Signed-off-by Kuninori Morimoto <[email protected]>
Quoted 4 lines
--- sound/soc/soc-component.c | 40 +++++++++++++++++++++++++++++++++++++++ sound/soc/soc-devres.c | 40 --------------------------------------- 2 files changed, 40 insertions(+), 40 deletions(-)
PATCH 5/20 ASoC: soc-component: move snd_soc_of_xlate_dai_name() to soc-component.c
In reply to Kuninori Morimotostruct snd_soc_component will be capsuled soon, its member will not be able to access from non soc-component.c.
move snd_soc_of_xlate_dai_name() to soc-component.c
--- include/sound/soc-component.h | 5 ++++- include/sound/soc.h | 3 --- sound/soc/soc-component.c | 33 +++++++++++++++++++++++++++++++++ sound/soc/soc-core.c | 33 --------------------------------- 4 files changed, 37 insertions(+), 37 deletions(-)
include/sound/soc-component.h +4 -1
@@ -400,6 +400,9 @@ int snd_soc_component_of_xlate_dai_id(struct snd_soc_component *component,int snd_soc_component_of_xlate_dai_name (struct snd_soc_component *component,const struct of_phandle_args *args,const char **dai_name); +int snd_soc_component_of_simple_xlate_dai_name (struct snd_soc_component *component, +const struct of_phandle_args *args, +const char **dai_name);int snd_soc_component_compr_open (struct snd_soc_component *component,struct snd_compr_stream *cstream); void snd_soc_component_compr_free(struct snd_soc_component *component,
@@ -460,5 +463,5 @@ void snd_soc_pcm_component_delay(struct snd_pcm_substream *substream,#define snd_soc_lookup_component_nolocked snd_soc_component_lookup_nolock#define snd_soc_lookup_component snd_soc_component_lookup#define snd_soc_lookup_component_by_name snd_soc_component_lookup_by_name - +#define snd_soc_of_xlate_dai_name snd_soc_component_of_simple_xlate_dai_name#endif /* __SOC_COMPONENT_H */
include/sound/soc.h +0 -3
@@ -1303,9 +1303,6 @@ int snd_soc_of_parse_tdm_slot(struct device_node *np,unsigned int *rx_mask, unsigned int *slots, unsigned int *slot_width); -int snd_soc_of_xlate_dai_name (struct snd_soc_component *component, -const struct of_phandle_args *args, -const char **dai_name); void snd_soc_of_parse_node_prefix(struct device_node *np, struct snd_soc_codec_conf *codec_conf, struct device_node *of_node,
sound/soc/soc-component.c +33 -0
@@ -1803,3 +1803,36 @@ int devm_snd_soc_register_component(struct device *dev,return ret; }EXPORT_SYMBOL_GPL (devm_snd_soc_register_component); + +/** +* snd_soc_component_of_simple_xlate_dai_name - Resolve a sound-dai phandle argument to a +* DAI name by searching the component DAI list. +* @component: ASoC component to search. +* @args: Phandle arguments from the sound-dai property; args[0] is the +* DAI ID. +* @dai_name: Output pointer set to the matched DAI name on success. +* +* Return: 0 on success, -EINVAL if args_count != 1 or no match is found. +*/ +int snd_soc_component_of_simple_xlate_dai_name (struct snd_soc_component *component, +const struct of_phandle_args *args, +const char **dai_name) +{ +struct snd_soc_dai *dai; +int id; + +if (args->args_count !=1 ) +return -EINVAL ; + + id = args->args[0 ]; + +for_each_component_dais (component, dai) { +if (dai->driver->id == id) { + *dai_name =snd_soc_dai_name (dai); +return 0 ; + } + } + +return -EINVAL ; +} +EXPORT_SYMBOL_GPL (snd_soc_component_of_simple_xlate_dai_name);
sound/soc/soc-core.c +0 -33
@@ -1593,39 +1593,6 @@ int snd_soc_of_parse_tdm_slot(struct device_node *np, }EXPORT_SYMBOL_GPL (snd_soc_of_parse_tdm_slot); -/** -* snd_soc_of_xlate_dai_name - Resolve a sound-dai phandle argument to a -* DAI name by searching the component DAI list. -* @component: ASoC component to search. -* @args: Phandle arguments from the sound-dai property; args[0] is the -* DAI ID. -* @dai_name: Output pointer set to the matched DAI name on success. -* -* Return: 0 on success, -EINVAL if args_count != 1 or no match is found. -*/ -int snd_soc_of_xlate_dai_name (struct snd_soc_component *component, -const struct of_phandle_args *args, -const char **dai_name) -{ -struct snd_soc_dai *dai; -int id; - -if (args->args_count !=1 ) -return -EINVAL ; - - id = args->args[0 ]; - -for_each_component_dais (component, dai) { -if (dai->driver->id == id) { - *dai_name =snd_soc_dai_name (dai); -return 0 ; - } - } - -return -EINVAL ; -} -EXPORT_SYMBOL_GPL (snd_soc_of_xlate_dai_name); -void snd_soc_dlc_use_cpu_as_platform (struct snd_soc_dai_link_component *platforms,struct snd_soc_dai_link_component *cpus) {
Signature · 1 line
2.53.0
Re: [PATCH 05/20] ASoC: soc-component: move snd_soc_of_xlate_dai_name() to soc-component.c
Quoted 6 lines · Kuninori Morimoto
struct
snd_soc_componentwill be capsuled soon, its member will not be able to access from nonsoc-component.c.move
snd_soc_of_xlate_dai_name()tosoc-component.cSigned-off-by Kuninori Morimoto <[email protected]>
Quoted 6 lines
--- include/sound/soc-component.h | 5 ++++- include/sound/soc.h | 3 --- sound/soc/soc-component.c | 33 +++++++++++++++++++++++++++++++++ sound/soc/soc-core.c | 33 --------------------------------- 4 files changed, 37 insertions(+), 37 deletions(-)
PATCH 6/20 ASoC: soc-component: makes regmap function to inline macro
In reply to Kuninori Morimotostruct snd_soc_component will be capsuled soon, its member will not be able to access from non soc-component.c.
Component regmap related function is almost rapper, thus very redundant. No need to makes it as function, but inline macro is very enough.
Let's standardize inline function naming conventions.
snd_soc_component_${regmap_func}(...);--- include/sound/soc-component.h | 52 +++++++++++++++++++++++++++++------ sound/soc/soc-component.c | 46 ------------------------------- 2 files changed, 44 insertions(+), 54 deletions(-)
include/sound/soc-component.h +44 -8
@@ -343,13 +343,6 @@ int snd_soc_component_stream_event(struct snd_soc_component *component,int snd_soc_component_set_bias_level (struct snd_soc_component *component,enum snd_soc_bias_level level); -void snd_soc_component_regmap_init (struct snd_soc_component *component, -struct regmap *regmap); -void snd_soc_component_regmap_exit (struct snd_soc_component *component); -int snd_soc_component_regmap_val_bytes (struct snd_soc_component *component); -int snd_soc_component_regmap_cache_sync (struct snd_soc_component *component); -void snd_soc_component_regmap_async_complete (struct snd_soc_component *component); -int snd_soc_component_fixup_controls (struct snd_soc_component *component);int snd_soc_component_add_controls (struct snd_soc_component *component,const struct snd_kcontrol_new *controls,unsigned int num_controls);
@@ -455,10 +448,53 @@ int snd_soc_pcm_component_ack(struct snd_pcm_substream *substream);void snd_soc_pcm_component_delay (struct snd_pcm_substream *substream,snd_pcm_sframes_t *cpu_delay,snd_pcm_sframes_t *codec_delay); +/* +* regmap +*/ +void snd_soc_component_regmap_init (struct snd_soc_component *component, +struct regmap *regmap); +void snd_soc_component_regmap_exit (struct snd_soc_component *component); + +static inline int snd_soc_component_regmap_get_val_bytes (struct snd_soc_component *component) +{ +struct regmap *regmap =snd_soc_component_to_regmap (component); +int val_bytes; + +/* Errors are legitimate for non-integer byte multiples */ + +if (!regmap) +return 0 ; + + val_bytes =regmap_get_val_bytes (regmap); +if (val_bytes <0 ) +return 0 ; + +return val_bytes; +} + +static inline int snd_soc_component_regcache_sync (struct snd_soc_component *component) +{ +struct regmap *regmap =snd_soc_component_to_regmap (component); + +if (!regmap) +return 0 ; + +return regcache_sync (regmap); +} + +static inline void snd_soc_component_regmap_async_complete (struct snd_soc_component *component) +{ +struct regmap *regmap =snd_soc_component_to_regmap (component); + +if (regmap) +regmap_async_complete (regmap); +} +/* REMOVE ME */ #define snd_soc_component_init_regmap snd_soc_component_regmap_init#define snd_soc_component_exit_regmap snd_soc_component_regmap_exit -#define snd_soc_component_cache_sync snd_soc_component_regmap_cache_sync +#define snd_soc_component_regmap_val_bytes snd_soc_component_regmap_get_val_bytes +#define snd_soc_component_cache_sync snd_soc_component_regcache_sync#define snd_soc_component_async_complete snd_soc_component_regmap_async_complete#define snd_soc_lookup_component_nolocked snd_soc_component_lookup_nolock#define snd_soc_lookup_component snd_soc_component_lookup
sound/soc/soc-component.c +0 -46
52 lines not on this page · raw message
Signature · 1 line
2.53.0
[email protected]
AI reviewRe: [PATCH 06/20] ASoC: soc-component: makes regmap function to inline macro
Thank you for your contribution! Sashiko AI review found 1 potential issue to consider: - [High] ASoC: soc-component: undeclared snd_soc_component_to_regmap() breaks build --
Thank you for your contribution! Sashiko AI review found 1 potential issue to consider:
- [High] ASoC: soc-component: undeclared snd_soc_component_to_regmap() breaks build
--
commit f289bf9367f01f6ee0716c3f431535b8a1efc6e9
Author: Kuninori Morimoto <[email protected]>
ASoC: soc-component: makes regmap function to inline macro
This commit moves snd_soc_component_regmap_val_bytes(), snd_soc_component_regmap_cache_sync(), and snd_soc_component_regmap_async_complete() from sound/soc/soc-component.c to static inline helpers in include/sound/soc-component.h.
Quoted 4 lines
include/sound/soc-component.h +0
-0
[ ... ]
Quoted 35 lines
include/sound/soc-component.h +31
-0@@ -455,10 +448,53 @@ int snd_soc_pcm_component_ack(struct snd_pcm_substream *substream);void snd_soc_pcm_component_delay (struct snd_pcm_substream *substream,snd_pcm_sframes_t *cpu_delay,snd_pcm_sframes_t *codec_delay); +/* +* regmap +*/ +void snd_soc_component_regmap_init (struct snd_soc_component *component, +struct regmap *regmap); +void snd_soc_component_regmap_exit (struct snd_soc_component *component); + +static inline int snd_soc_component_regmap_get_val_bytes (struct snd_soc_component *component) +{ +struct regmap *regmap =snd_soc_component_to_regmap (component); +int val_bytes; + +/* Errors are legitimate for non-integer byte multiples */ + +if (!regmap) +return 0 ; + + val_bytes =regmap_get_val_bytes (regmap); +if (val_bytes <0 ) +return 0 ; + +return val_bytes; +} + +static inline int snd_soc_component_regcache_sync (struct snd_soc_component *component) +{ +struct regmap *regmap =snd_soc_component_to_regmap (component); + +if (!regmap) +return 0 ; +
include/sound/soc-component.h int snd_soc_pcm_component_ack(struct snd_pcm_substream *substream); · line 491
Quoted 10 lines
include/sound/soc-component.h +10
-0+return regcache_sync (regmap); +} + +static inline void snd_soc_component_regmap_async_complete (struct snd_soc_component *component) +{ +struct regmap *regmap =snd_soc_component_to_regmap (component); + +if (regmap) +regmap_async_complete (regmap); +}
[Severity: High]
Does calling snd_soc_component_to_regmap() in these three static inline functions break compilation at this commit?
snd_soc_component_to_regmap() is not declared or defined until a later patch in the series, commit "ASoC: soc-component: add snd_soc_component_to_regmap()". Because these helpers are static inline functions rather than macros, every translation unit that includes include/sound/soc-component.h fails to compile with an implicit function declaration error until that patch is applied, breaking git bisect across the intermediate commits. Ordering commit "ASoC: soc-component: add snd_soc_component_to_regmap()" before this patch would keep the series bisectable.
Signature · 1 line
Sashiko AI review · https://sashiko.dev/#/patchset/[email protected]?part=6
Re: [PATCH 06/20] ASoC: soc-component: makes regmap function to inline macro
In reply to Kuninori MorimotoQuoted 11 lines · Kuninori Morimoto
struct
snd_soc_componentwill be capsuled soon, its member will not be able to access from nonsoc-component.c.Component regmap related function is almost rapper, thus very redundant. No need to makes it as function, but inline macro is very enough.
Let's standardize inline function naming conventions.
snd_soc_component_${regmap_func}(...);Signed-off-by Kuninori Morimoto <[email protected]>
sashiko is right about the order, but the patch itself is fine
Quoted 4 lines
--- include/sound/soc-component.h | 52 +++++++++++++++++++++++++++++------ sound/soc/soc-component.c | 46 ------------------------------- 2 files changed, 44 insertions(+), 54 deletions(-)
PATCH 7/20 ASoC: soc-component: add snd_soc_component_name_prefix()
In reply to Kuninori Morimotostruct snd_soc_component will be capsuled soon, its member will not be able to access from non soc-component.c.
Add snd_soc_component_name_prefix() to soc-component.c
--- include/sound/soc-component.h | 1 + sound/soc/soc-component.c | 6 ++++++ 2 files changed, 7 insertions(+)
include/sound/soc-component.h +1 -0
@@ -290,6 +290,7 @@ void snd_soc_unregister_component_by_driver(struct device *dev, const struct snd_soc_component_driver *component_driver);const char *snd_soc_component_name (struct snd_soc_component *component); +const char *snd_soc_component_name_prefix (struct snd_soc_component *component);void snd_soc_component_set_priv (struct snd_soc_component *component,void *priv);void *snd_soc_component_to_priv (struct snd_soc_component *component);
sound/soc/soc-component.c +6 -0
@@ -43,6 +43,12 @@ const char *snd_soc_component_name(struct snd_soc_component *component) }EXPORT_SYMBOL_GPL (snd_soc_component_name); +const char *snd_soc_component_name_prefix (struct snd_soc_component *component) +{ +return component->name_prefix; +} +EXPORT_SYMBOL_GPL (snd_soc_component_name_prefix); +void snd_soc_component_set_priv (struct snd_soc_component *component,void *priv) { component->priv = priv;
Signature · 1 line
2.53.0
Re: [PATCH 07/20] ASoC: soc-component: add snd_soc_component_name_prefix()
Quoted 6 lines · Kuninori Morimoto
struct
snd_soc_componentwill be capsuled soon, its member will not be able to access from nonsoc-component.c.Add
snd_soc_component_name_prefix()tosoc-component.cSigned-off-by Kuninori Morimoto <[email protected]>
Quoted 4 lines
--- include/sound/soc-component.h | 1 + sound/soc/soc-component.c | 6 ++++++ 2 files changed, 7 insertions(+)
PATCH 8/20 ASoC: soc-component: add snd_soc_component_to_dev()
In reply to Kuninori Morimotostruct snd_soc_component will be capsuled soon, its member will not be able to access from non soc-component.c.
Add snd_soc_component_to_dev() to soc-component.c
--- include/sound/soc-component.h | 1 + sound/soc/soc-component.c | 6 ++++++ 2 files changed, 7 insertions(+)
include/sound/soc-component.h +1 -0
@@ -272,6 +272,7 @@ struct snd_soc_component {snd_soc_dai_to_list (dai) != &(component)->dai_list; \ dai = _dai, _dai = snd_soc_dai_from_list(snd_soc_dai_to_list(_dai)->next)) +struct device *snd_soc_component_to_dev (struct snd_soc_component *component);struct snd_soc_dapm_context *snd_soc_component_to_dapm (struct snd_soc_component *component);struct snd_soc_component *snd_soc_component_new (struct device *dev,const char *name,const struct snd_soc_component_driver *driver);
sound/soc/soc-component.c +6 -0
@@ -61,6 +61,12 @@ void *snd_soc_component_to_priv(struct snd_soc_component *component) }EXPORT_SYMBOL_GPL (snd_soc_component_to_priv); +struct device *snd_soc_component_to_dev (struct snd_soc_component *component) +{ +return component->dev; +} +EXPORT_SYMBOL_GPL (snd_soc_component_to_dev); +struct snd_soc_dapm_context *snd_soc_component_to_dapm (struct snd_soc_component *component) {return component->dapm;
Signature · 1 line
2.53.0
Re: [PATCH 08/20] ASoC: soc-component: add snd_soc_component_to_dev()
Quoted 6 lines · Kuninori Morimoto
struct
snd_soc_componentwill be capsuled soon, its member will not be able to access from nonsoc-component.c.Add
snd_soc_component_to_dev()tosoc-component.cSigned-off-by Kuninori Morimoto <[email protected]>
Quoted 4 lines
--- include/sound/soc-component.h | 1 + sound/soc/soc-component.c | 6 ++++++ 2 files changed, 7 insertions(+)
PATCH 9/20 ASoC: soc-component: add snd_soc_component_to_driver()
In reply to Kuninori Morimotostruct snd_soc_component will be capsuled soon, its member will not be able to access from non soc-component.c.
Add snd_soc_component_to_driver() to soc-component.c
--- include/sound/soc-component.h | 2 ++ sound/soc/soc-component.c | 7 +++++++ 2 files changed, 9 insertions(+)
include/sound/soc-component.h +2 -0
@@ -274,6 +274,8 @@ struct snd_soc_component {struct device *snd_soc_component_to_dev (struct snd_soc_component *component);struct snd_soc_dapm_context *snd_soc_component_to_dapm (struct snd_soc_component *component); +const struct snd_soc_component_driver +*snd_soc_component_to_driver (struct snd_soc_component *component);struct snd_soc_component *snd_soc_component_new (struct device *dev,const char *name,const struct snd_soc_component_driver *driver); int snd_soc_component_register(struct snd_soc_component *component,
sound/soc/soc-component.c +7 -0
@@ -73,6 +73,13 @@ struct snd_soc_dapm_context *snd_soc_component_to_dapm(struct snd_soc_component }EXPORT_SYMBOL_GPL (snd_soc_component_to_dapm); +const struct snd_soc_component_driver * +snd_soc_component_to_driver (struct snd_soc_component *component) +{ +return component->driver; +} +EXPORT_SYMBOL_GPL (snd_soc_component_to_driver); +unsigned int snd_soc_component_active (struct snd_soc_component *component) {return component->active;
Signature · 1 line
2.53.0
Re: [PATCH 09/20] ASoC: soc-component: add snd_soc_component_to_driver()
Quoted 6 lines · Kuninori Morimoto
struct
snd_soc_componentwill be capsuled soon, its member will not be able to access from nonsoc-component.c.Add
snd_soc_component_to_driver()tosoc-component.cSigned-off-by Kuninori Morimoto <[email protected]>
Quoted 4 lines
--- include/sound/soc-component.h | 2 ++ sound/soc/soc-component.c | 7 +++++++ 2 files changed, 9 insertions(+)
PATCH 10/20 ASoC: soc-component: add snd_soc_component_to_card()
In reply to Kuninori Morimotostruct snd_soc_component will be capsuled soon, its member will not be able to access from non soc-component.c.
Add snd_soc_component_to_card() to soc-component.c
--- include/sound/soc-component.h | 1 + sound/soc/soc-component.c | 6 ++++++ 2 files changed, 7 insertions(+)
include/sound/soc-component.h +1 -0
@@ -276,6 +276,7 @@ struct device *snd_soc_component_to_dev(struct snd_soc_component *component);struct snd_soc_dapm_context *snd_soc_component_to_dapm (struct snd_soc_component *component);const struct snd_soc_component_driver *snd_soc_component_to_driver (struct snd_soc_component *component); +struct snd_soc_card *snd_soc_component_to_card (struct snd_soc_component *component);struct snd_soc_component *snd_soc_component_new (struct device *dev,const char *name,const struct snd_soc_component_driver *driver); int snd_soc_component_register(struct snd_soc_component *component,
sound/soc/soc-component.c +6 -0
@@ -80,6 +80,12 @@ snd_soc_component_to_driver(struct snd_soc_component *component) }EXPORT_SYMBOL_GPL (snd_soc_component_to_driver); +struct snd_soc_card *snd_soc_component_to_card (struct snd_soc_component *component) +{ +return component->card; +} +EXPORT_SYMBOL_GPL (snd_soc_component_to_card); +unsigned int snd_soc_component_active (struct snd_soc_component *component) {return component->active;
Signature · 1 line
2.53.0
Re: [PATCH 10/20] ASoC: soc-component: add snd_soc_component_to_card()
Quoted 6 lines · Kuninori Morimoto
struct
snd_soc_componentwill be capsuled soon, its member will not be able to access from nonsoc-component.c.Add
snd_soc_component_to_card()tosoc-component.cSigned-off-by Kuninori Morimoto <[email protected]>
Quoted 4 lines
--- include/sound/soc-component.h | 1 + sound/soc/soc-component.c | 6 ++++++ 2 files changed, 7 insertions(+)
PATCH 11/20 ASoC: soc-component: add snd_soc_component_to_debugfs_root()
In reply to Kuninori Morimotostruct snd_soc_component will be capsuled soon, its member will not be able to access from non soc-component.c.
This patch adds snd_soc_component_debugfs_root() to get component->debugfs_root.
--- include/sound/soc-component.h | 1 + sound/soc/soc-component.c | 6 ++++++ 2 files changed, 7 insertions(+)
include/sound/soc-component.h +1 -0
@@ -277,6 +277,7 @@ struct snd_soc_dapm_context *snd_soc_component_to_dapm(struct snd_soc_componentconst struct snd_soc_component_driver *snd_soc_component_to_driver (struct snd_soc_component *component);struct snd_soc_card *snd_soc_component_to_card (struct snd_soc_component *component); +struct dentry *snd_soc_component_to_debugfs_root (struct snd_soc_component *component);struct snd_soc_component *snd_soc_component_new (struct device *dev,const char *name,const struct snd_soc_component_driver *driver); int snd_soc_component_register(struct snd_soc_component *component,
sound/soc/soc-component.c +6 -0
@@ -86,6 +86,12 @@ struct snd_soc_card *snd_soc_component_to_card(struct snd_soc_component *compone }EXPORT_SYMBOL_GPL (snd_soc_component_to_card); +struct dentry *snd_soc_component_to_debugfs_root (struct snd_soc_component *component) +{ +return component->debugfs_root; +} +EXPORT_SYMBOL_GPL (snd_soc_component_to_debugfs_root); +unsigned int snd_soc_component_active (struct snd_soc_component *component) {return component->active;
Signature · 1 line
2.53.0
Re: [PATCH 11/20] ASoC: soc-component: add snd_soc_component_to_debugfs_root()
Quoted 7 lines · Kuninori Morimoto
struct
snd_soc_componentwill be capsuled soon, its member will not be able to access from nonsoc-component.c.This patch adds
snd_soc_component_debugfs_root()to getcomponent->debugfs_root.Signed-off-by Kuninori Morimoto <[email protected]>
Quoted 4 lines
--- include/sound/soc-component.h | 1 + sound/soc/soc-component.c | 6 ++++++ 2 files changed, 7 insertions(+)
PATCH 12/20 ASoC: soc-component: add snd_soc_component_to_regmap()
In reply to Kuninori Morimotostruct snd_soc_component will be capsuled soon, its member will not be able to access from non soc-component.c.
Add snd_soc_component_to_regmap() to soc-component.c
--- include/sound/soc-component.h | 1 + sound/soc/soc-component.c | 6 ++++++ 2 files changed, 7 insertions(+)
include/sound/soc-component.h +1 -0
@@ -278,6 +278,7 @@ const struct snd_soc_component_driver *snd_soc_component_to_driver(struct snd_soc_component *component);struct snd_soc_card *snd_soc_component_to_card (struct snd_soc_component *component);struct dentry *snd_soc_component_to_debugfs_root (struct snd_soc_component *component); +struct regmap *snd_soc_component_to_regmap (struct snd_soc_component *component);struct snd_soc_component *snd_soc_component_new (struct device *dev,const char *name,const struct snd_soc_component_driver *driver); int snd_soc_component_register(struct snd_soc_component *component,
sound/soc/soc-component.c +6 -0
@@ -92,6 +92,12 @@ struct dentry *snd_soc_component_to_debugfs_root(struct snd_soc_component *compo }EXPORT_SYMBOL_GPL (snd_soc_component_to_debugfs_root); +struct regmap *snd_soc_component_to_regmap (struct snd_soc_component *component) +{ +return component->regmap; +} +EXPORT_SYMBOL_GPL (snd_soc_component_to_regmap); +unsigned int snd_soc_component_active (struct snd_soc_component *component) {return component->active;
Signature · 1 line
2.53.0
[email protected]
AI reviewRe: [PATCH 12/20] ASoC: soc-component: add snd_soc_component_to_regmap()
Thank you for your contribution! Sashiko AI review found 1 potential issue to consider: - [Medium] ASoC: soc-component: snd_soc_component_to_regmap() ordered after its callers --
Thank you for your contribution! Sashiko AI review found 1 potential issue to consider:
- [Medium] ASoC: soc-component: snd_soc_component_to_regmap() ordered after its callers
--
commit 1b181762257030814f72c0850502aed04e2f536a
Author: Kuninori Morimoto <[email protected]>
ASoC: soc-component: add snd_soc_component_to_regmap()
This commit adds the snd_soc_component_to_regmap() helper function to retrieve the regmap pointer from struct snd_soc_component.
Quoted 17 lines
include/sound/soc-component.h +1
-0@@ -278,6 +278,7 @@ const struct snd_soc_component_driver *snd_soc_component_to_driver(struct snd_soc_component *component);struct snd_soc_card *snd_soc_component_to_card (struct snd_soc_component *component);struct dentry *snd_soc_component_to_debugfs_root (struct snd_soc_component *component); +struct regmap *snd_soc_component_to_regmap (struct snd_soc_component *component);struct snd_soc_component *snd_soc_component_new (struct device *dev,const char *name,const struct snd_soc_component_driver *driver); int snd_soc_component_register(struct snd_soc_component *component,sound/soc/soc-component.c +0
-0
sound/soc/soc-component.c struct dentry *snd_soc_component_to_debugfs_root(struct snd_soc_component *compo · line 99
Quoted 8 lines
sound/soc/soc-component.c +5
-0@@ -92,6 +92,12 @@ struct dentry *snd_soc_component_to_debugfs_root(struct snd_soc_component *compo }EXPORT_SYMBOL_GPL (snd_soc_component_to_debugfs_root); +struct regmap *snd_soc_component_to_regmap (struct snd_soc_component *component) +{ +return component->regmap; +} +EXPORT_SYMBOL_GPL (snd_soc_component_to_regmap);
[Severity: Medium]
Should this patch be ordered before commit "ASoC: soc-component: makes regmap function to inline macro" in the series?
That earlier commit converts snd_soc_component_regmap_get_val_bytes() and related helpers in include/sound/soc-component.h into static inline functions that call snd_soc_component_to_regmap(), so the six intermediate commits fail to compile with an implicit function declaration error and break git bisect.
Signature · 1 line
Sashiko AI review · https://sashiko.dev/#/patchset/[email protected]?part=12
Re: [PATCH 12/20] ASoC: soc-component: add snd_soc_component_to_regmap()
In reply to Kuninori MorimotoQuoted 6 lines · Kuninori Morimoto
struct
snd_soc_componentwill be capsuled soon, its member will not be able to access from nonsoc-component.c.Add
snd_soc_component_to_regmap()tosoc-component.cSigned-off-by Kuninori Morimoto <[email protected]>
Quoted 4 lines
--- include/sound/soc-component.h | 1 + sound/soc/soc-component.c | 6 ++++++ 2 files changed, 7 insertions(+)
PATCH 13/20 ASoC: soc-component: add snd_soc_component_regcache_mark_dirty()
In reply to Kuninori Morimotostruct snd_soc_component will be capsuled soon, its member will not be able to access from non soc-component.c.
Adds snd_soc_component_regcache_mark_dirty().
--- include/sound/soc-component.h | 9 +++++++++ 1 file changed, 9 insertions(+)
include/sound/soc-component.h +9 -0
@@ -497,6 +497,15 @@ static inline void snd_soc_component_regmap_async_complete(struct snd_soc_componregmap_async_complete (regmap); } +static inline void snd_soc_component_regcache_mark_dirty (struct snd_soc_component *component) +{ +struct regmap *regmap =snd_soc_component_to_regmap (component); + +if (regmap) +regcache_mark_dirty (regmap); +} + +/* REMOVE ME */ #define snd_soc_component_init_regmap snd_soc_component_regmap_init#define snd_soc_component_exit_regmap snd_soc_component_regmap_exit
Signature · 1 line
2.53.0
Re: [PATCH 13/20] ASoC: soc-component: add snd_soc_component_regcache_mark_dirty()
Quoted 6 lines · Kuninori Morimoto
struct
snd_soc_componentwill be capsuled soon, its member will not be able to access from nonsoc-component.c.Adds
snd_soc_component_regcache_mark_dirty().Signed-off-by Kuninori Morimoto <[email protected]>
Quoted 3 lines
--- include/sound/soc-component.h | 9 +++++++++ 1 file changed, 9 insertions(+)
PATCH 14/20 ASoC: soc-component: add snd_soc_component_regcache_cache_only()
In reply to Kuninori Morimotostruct snd_soc_component will be capsuled soon, its member will not be able to access from non soc-component.c.
Adds snd_soc_component_regcache_cache_only().
--- include/sound/soc-component.h | 8 ++++++++ 1 file changed, 8 insertions(+)
include/sound/soc-component.h +8 -0
@@ -505,6 +505,14 @@ static inline void snd_soc_component_regcache_mark_dirty(struct snd_soc_componenregcache_mark_dirty (regmap); } +static inline void snd_soc_component_regcache_cache_only (struct snd_soc_component *component, +bool enable) +{ +struct regmap *regmap =snd_soc_component_to_regmap (component); + +if (regmap) +regcache_cache_only (regmap, enable); +}/* REMOVE ME */ #define snd_soc_component_init_regmap snd_soc_component_regmap_init
Signature · 1 line
2.53.0
Re: [PATCH 14/20] ASoC: soc-component: add snd_soc_component_regcache_cache_only()
Quoted 6 lines · Kuninori Morimoto
struct
snd_soc_componentwill be capsuled soon, its member will not be able to access from nonsoc-component.c.Adds
snd_soc_component_regcache_cache_only().Signed-off-by Kuninori Morimoto <[email protected]>
Quoted 3 lines
--- include/sound/soc-component.h | 8 ++++++++ 1 file changed, 8 insertions(+)
PATCH 15/20 ASoC: soc-component: add snd_soc_component_regcache_cache_bypass()
In reply to Kuninori Morimotostruct snd_soc_component will be capsuled soon, its member will not be able to access from non soc-component.c.
Adds snd_soc_component_regcache_cache_bypass().
--- include/sound/soc-component.h | 9 +++++++++ 1 file changed, 9 insertions(+)
include/sound/soc-component.h +9 -0
@@ -514,6 +514,15 @@ static inline void snd_soc_component_regcache_cache_only(struct snd_soc_componenregcache_cache_only (regmap, enable); } +static inline void snd_soc_component_regcache_cache_bypass (struct snd_soc_component *component, +bool enable) +{ +struct regmap *regmap =snd_soc_component_to_regmap (component); + +if (regmap) +regcache_cache_bypass (regmap, enable); +} +/* REMOVE ME */ #define snd_soc_component_init_regmap snd_soc_component_regmap_init#define snd_soc_component_exit_regmap snd_soc_component_regmap_exit
Signature · 1 line
2.53.0
Re: [PATCH 15/20] ASoC: soc-component: add snd_soc_component_regcache_cache_bypass()
Quoted 6 lines · Kuninori Morimoto
struct
snd_soc_componentwill be capsuled soon, its member will not be able to access from nonsoc-component.c.Adds
snd_soc_component_regcache_cache_bypass().Signed-off-by Kuninori Morimoto <[email protected]>
Quoted 3 lines
--- include/sound/soc-component.h | 9 +++++++++ 1 file changed, 9 insertions(+)
PATCH 16/20 ASoC: soc-component: add snd_soc_component_regmap_multi_reg_write_bypassed()
In reply to Kuninori Morimotostruct snd_soc_component will be capsuled soon, its member will not be able to access from non soc-component.c.
Adds snd_soc_component_regmap_multi_reg_write_bypassed().
--- include/sound/soc-component.h | 13 +++++++++++++ 1 file changed, 13 insertions(+)
include/sound/soc-component.h +13 -0
@@ -489,6 +489,19 @@ static inline int snd_soc_component_regcache_sync(struct snd_soc_component *compreturn regcache_sync (regmap); } +static inline int +snd_soc_component_regmap_multi_reg_write_bypassed (struct snd_soc_component *component, +const struct reg_sequence *regs, +int num_regs) +{ +struct regmap *regmap =snd_soc_component_to_regmap (component); + +if (!regmap) +return 0 ; + +return regmap_multi_reg_write_bypassed (regmap, regs, num_regs); +} +static inline void snd_soc_component_regmap_async_complete (struct snd_soc_component *component) {struct regmap *regmap =snd_soc_component_to_regmap (component);
Signature · 1 line
2.53.0
[email protected]
AI reviewRe: [PATCH 16/20] ASoC: soc-component: add snd_soc_component_regmap_multi_reg_write_bypassed()
Thank you for your contribution! Sashiko AI review found 1 potential issue to consider: - [High] ASoC: build failure in snd_soc_component_regmap_multi_reg_write_bypassed() --
Thank you for your contribution! Sashiko AI review found 1 potential issue to consider:
- [High] ASoC: build failure in snd_soc_component_regmap_multi_reg_write_bypassed()
--
commit 57b5a81c5a120fd92608fae86a8fb5b252d6cb73
Author: Kuninori Morimoto <[email protected]>
ASoC: soc-component: add snd_soc_component_regmap_multi_reg_write_bypassed()
This commit adds the snd_soc_component_regmap_multi_reg_write_bypassed() static inline helper to wrap regmap_multi_reg_write_bypassed() on a component's regmap.
Quoted 10 lines
include/sound/soc-component.h +2
-0@@ -489,6 +489,19 @@ static inline int snd_soc_component_regcache_sync(struct snd_soc_component *compreturn regcache_sync (regmap); } +static inline int +snd_soc_component_regmap_multi_reg_write_bypassed(struct snd_soc_component *component,
include/sound/soc-component.h static inline int snd_soc_component_regcache_sync(struct snd_soc_component *comp · line 503
Quoted 10 lines
include/sound/soc-component.h +10
-0+ const struct reg_sequence *regs, + int num_regs) +{ +struct regmap *regmap =snd_soc_component_to_regmap (component); + +if (!regmap) +return 0 ; + +return regmap_multi_reg_write_bypassed (regmap, regs, num_regs); +}
[Severity: High]
Does calling regmap_multi_reg_write_bypassed() from a static inline helper break the build when regmap support is disabled?
Unlike regcache_sync() and the other helpers in this header, include/linux/regmap.h only declares regmap_multi_reg_write_bypassed() inside its #ifdef CONFIG_REGMAP block and provides no fallback stub in the #else section. Any translation unit that includes sound/soc-component.h (or sound/soc.h) when regmap is disabled will fail to compile with an implicit function declaration error.
Signature · 1 line
Sashiko AI review · https://sashiko.dev/#/patchset/[email protected]?part=16
PATCH 17/20 ASoC: soc-component: add snd_soc_component_num_dai()
In reply to Kuninori Morimotostruct snd_soc_component will be capsuled soon, its member will not be able to access from non soc-component.c.
This patch adds snd_soc_component_num_dai() to get component->num_dai.
--- include/sound/soc-component.h | 1 + sound/soc/soc-component.c | 6 ++++++ 2 files changed, 7 insertions(+)
include/sound/soc-component.h +1 -0
@@ -379,6 +379,7 @@ static inline void *snd_soc_component_get_drvdata(struct snd_soc_component *c) }unsigned int snd_soc_component_active (struct snd_soc_component *component); +int snd_soc_component_num_dai (struct snd_soc_component *component);/* component controls */ struct snd_kcontrol *snd_soc_component_get_kcontrol(struct snd_soc_component *component,
sound/soc/soc-component.c +6 -0
@@ -104,6 +104,12 @@ unsigned int snd_soc_component_active(struct snd_soc_component *component) }EXPORT_SYMBOL_GPL (snd_soc_component_active); +int snd_soc_component_num_dai (struct snd_soc_component *component) +{ +return component->num_dai; +} +EXPORT_SYMBOL_GPL (snd_soc_component_num_dai); +/* * We might want to check substream by using list. * In such case, we can update these macros.
Signature · 1 line
2.53.0
Re: [PATCH 17/20] ASoC: soc-component: add snd_soc_component_num_dai()
Quoted 6 lines · Kuninori Morimoto
struct
snd_soc_componentwill be capsuled soon, its member will not be able to access from nonsoc-component.c.This patch adds
snd_soc_component_num_dai()to getcomponent->num_dai.Signed-off-by Kuninori Morimoto <[email protected]>
Quoted 4 lines
--- include/sound/soc-component.h | 1 + sound/soc/soc-component.c | 6 ++++++ 2 files changed, 7 insertions(+)
PATCH 18/20 ASoC: soc-component: add snd_soc_component_connect_dai()
In reply to Kuninori Morimotostruct snd_soc_component will be capsuled soon, its member will not be able to access from non soc-component.c.
This patch adds snd_soc_component_connect_dai() to connect DAI to Component.
--- sound/soc/soc-component.c | 7 +++++++ sound/soc/soc-dai.c | 3 +-- sound/soc/soc-internal.h | 1 + 3 files changed, 9 insertions(+), 2 deletions(-)
sound/soc/soc-component.c +7 -0
@@ -110,6 +110,13 @@ int snd_soc_component_num_dai(struct snd_soc_component *component) }EXPORT_SYMBOL_GPL (snd_soc_component_num_dai); +void snd_soc_component_connect_dai (struct snd_soc_component *component,struct snd_soc_dai *dai) +{ +/* dai->list <-> component->dai_list */ +list_add_tail (snd_soc_dai_to_list (dai), &component->dai_list); + component->num_dai++; +} +/* * We might want to check substream by using list. * In such case, we can update these macros.
sound/soc/soc-dai.c +1 -2
@@ -1265,8 +1265,7 @@ struct snd_soc_dai *snd_soc_dai_register(struct snd_soc_component *component, dai->driver = dai_drv;/* see for_each_component_dais */ -list_add_tail (&dai->list, &component->dai_list); - component->num_dai++; +snd_soc_component_connect_dai (component, dai);dev_dbg (dev,"ASoC: Registered DAI '%s'\n" , dai->name);return dai;
sound/soc/soc-internal.h +1 -0
@@ -69,6 +69,7 @@ bool snd_soc_component_matches_dlc(struct snd_soc_component *component,void snd_soc_component_remove (struct snd_soc_component *component,int probed);int snd_soc_component_probe (struct snd_soc_component *component,struct snd_soc_card *card);struct list_head *snd_soc_component_get_list_head (void ); +void snd_soc_component_connect_dai (struct snd_soc_component *component,struct snd_soc_dai *dai);#define for_each_component (component) \ list_for_each_entry(component, snd_soc_component_get_list_head(), list)
Signature · 1 line
2.53.0
Re: [PATCH 18/20] ASoC: soc-component: add snd_soc_component_connect_dai()
Quoted 7 lines · Kuninori Morimoto
struct
snd_soc_componentwill be capsuled soon, its member will not be able to access from nonsoc-component.c.This patch adds
snd_soc_component_connect_dai()to connect DAI to Component.Signed-off-by Kuninori Morimoto <[email protected]>
Quoted 5 lines
--- sound/soc/soc-component.c | 7 +++++++ sound/soc/soc-dai.c | 3 +-- sound/soc/soc-internal.h | 1 + 3 files changed, 9 insertions(+), 2 deletions(-)
PATCH 19/20 ASoC: soc-component: add snd_soc_component_active_update()
In reply to Kuninori Morimotostruct snd_soc_component will be capsuled soon, its member will not be able to access from non soc-component.c.
This patch adds snd_soc_component_active_update() to handle Component acitive count.
--- sound/soc/soc-component.c | 5 +++++ sound/soc/soc-dai.c | 2 +- sound/soc/soc-internal.h | 1 + sound/soc/soc-pcm.c | 2 +- 4 files changed, 8 insertions(+), 2 deletions(-)
sound/soc/soc-component.c +5 -0
@@ -104,6 +104,11 @@ unsigned int snd_soc_component_active(struct snd_soc_component *component) }EXPORT_SYMBOL_GPL (snd_soc_component_active); +void snd_soc_component_active_update (struct snd_soc_component *component,int action) +{ + component->active += action; +} +int snd_soc_component_num_dai (struct snd_soc_component *component) {return component->num_dai;
sound/soc/soc-dai.c +1 -1
@@ -713,7 +713,7 @@ void snd_soc_dai_active_update(struct snd_soc_dai *dai, int stream, int action) dai->stream[stream].active += action;/* see snd_soc_component_active() */ - dai->component->active += action; +snd_soc_component_active_update (dai->component, action); }int snd_soc_dai_active (const struct snd_soc_dai *dai)
sound/soc/soc-internal.h +1 -0
@@ -70,6 +70,7 @@ void snd_soc_component_remove(struct snd_soc_component *component, int probed);int snd_soc_component_probe (struct snd_soc_component *component,struct snd_soc_card *card);struct list_head *snd_soc_component_get_list_head (void );void snd_soc_component_connect_dai (struct snd_soc_component *component,struct snd_soc_dai *dai); +void snd_soc_component_active_update (struct snd_soc_component *component,int action);#define for_each_component (component) \ list_for_each_entry(component, snd_soc_component_get_list_head(), list)
sound/soc/soc-pcm.c +1 -1
@@ -374,7 +374,7 @@ void snd_soc_runtime_action(struct snd_soc_pcm_runtime *rtd,for_each_rtd_components (rtd, i, component) {if (component->num_dai)continue ; - component->active += action; +snd_soc_component_active_update (component, action); } }EXPORT_SYMBOL_GPL (snd_soc_runtime_action);
Signature · 1 line
2.53.0
Re: [PATCH 19/20] ASoC: soc-component: add snd_soc_component_active_update()
Quoted 7 lines · Kuninori Morimoto
struct
snd_soc_componentwill be capsuled soon, its member will not be able to access from nonsoc-component.c.This patch adds
snd_soc_component_active_update()to handle Component acitive count.Signed-off-by Kuninori Morimoto <[email protected]>
Quoted 6 lines
--- sound/soc/soc-component.c | 5 +++++ sound/soc/soc-dai.c | 2 +- sound/soc/soc-internal.h | 1 + sound/soc/soc-pcm.c | 2 +- 4 files changed, 8 insertions(+), 2 deletions(-)
PATCH 20/20 ASoC: soc-component: add snd_soc_component_device_link_{add/del}()
In reply to Kuninori Morimotostruct snd_soc_component will be capsuled soon, its member will not be able to access from non soc-component.c.
This patch adds snd_soc_component_device_link_{add/del}() to handle Component device_link.
--- sound/soc/soc-card.c | 22 ++++------------------ sound/soc/soc-component.c | 28 ++++++++++++++++++++++++++++ sound/soc/soc-internal.h | 2 ++ 3 files changed, 34 insertions(+), 18 deletions(-)
sound/soc/soc-card.c +4 -18
@@ -884,12 +884,8 @@ static void snd_soc_remove_device_links(struct snd_soc_card *card) {struct snd_soc_component *component; -for_each_card_components (card, component) { -if (component->card_device_link) { -device_link_del (component->card_device_link); - component->card_device_link =NULL ; - } - } +for_each_card_components (card, component) +snd_soc_component_device_link_del (component); }void snd_soc_card_unbind (struct snd_soc_card *card,bool reuse)
@@ -1043,18 +1039,8 @@ static int snd_soc_card_bind(struct snd_soc_card *card)* If a driver pair already have a link in the opposite direction * they must manage their own suspend order. */ -for_each_card_components (card, component) { -if (card->dev == component->dev) -continue ; - - component->card_device_link =device_link_add (card->dev, - component->dev, -DL_FLAG_STATELESS ); -if (!component->card_device_link) { -dev_warn (card->dev,"Could not create device link to %s\n" , -dev_name (component->dev)); - } - } +for_each_card_components (card, component) +snd_soc_component_device_link_add (component); ret =snd_soc_card_late_probe (card);if (ret <0 )
sound/soc/soc-component.c +28 -0
@@ -122,6 +122,34 @@ void snd_soc_component_connect_dai(struct snd_soc_component *component, struct s component->num_dai++; } +void snd_soc_component_device_link_del (struct snd_soc_component *component) +{ +if (component->card_device_link) { +device_link_del (component->card_device_link); + component->card_device_link =NULL ; + } +} + +int snd_soc_component_device_link_add (struct snd_soc_component *component) +{ +struct snd_soc_card *card =snd_soc_component_to_card (component); +struct device *card_dev = card->dev; +struct device *component_dev =snd_soc_component_to_dev (component); + +if (card_dev == component_dev) +return 0 ; + + component->card_device_link =device_link_add (card_dev, component_dev, +DL_FLAG_STATELESS ); +if (!component->card_device_link) { +dev_warn (card_dev,"Could not create device link to %s\n" , +dev_name (component_dev)); +return -EINVAL ; + } + +return 0 ; +} +/* * We might want to check substream by using list. * In such case, we can update these macros.
sound/soc/soc-internal.h +2 -0
@@ -71,6 +71,8 @@ int snd_soc_component_probe(struct snd_soc_component *component, struct snd_soc_struct list_head *snd_soc_component_get_list_head (void );void snd_soc_component_connect_dai (struct snd_soc_component *component,struct snd_soc_dai *dai);void snd_soc_component_active_update (struct snd_soc_component *component,int action); +void snd_soc_component_device_link_del (struct snd_soc_component *component); +int snd_soc_component_device_link_add (struct snd_soc_component *component);#define for_each_component (component) \ list_for_each_entry(component, snd_soc_component_get_list_head(), list)
Signature · 1 line
2.53.0
Re: [PATCH 20/20] ASoC: soc-component: add snd_soc_component_device_link_{add/del}()
Quoted 7 lines · Kuninori Morimoto
struct
snd_soc_componentwill be capsuled soon, its member will not be able to access from nonsoc-component.c.This patch adds snd_soc_component_device_link_{add/del}() to handle Component
device_link.Signed-off-by Kuninori Morimoto <[email protected]>
Quoted 5 lines
--- sound/soc/soc-card.c | 22 ++++------------------ sound/soc/soc-component.c | 28 ++++++++++++++++++++++++++++ sound/soc/soc-internal.h | 2 ++ 3 files changed, 34 insertions(+), 18 deletions(-)