[alsa-devel] [PATCH v3 6/8] ASoC: soc-pcm: call snd_soc_component_open/close() once

Pierre-Louis Bossart pierre-louis.bossart at linux.intel.com
Mon Feb 10 15:41:07 CET 2020


Hi Morimoto-san,

>   #define for_each_component_dais(component, dai)\
> diff --git a/sound/soc/soc-component.c b/sound/soc/soc-component.c
> index 14e175c..ee00c09 100644
> --- a/sound/soc/soc-component.c
> +++ b/sound/soc/soc-component.c
> @@ -297,34 +297,55 @@ EXPORT_SYMBOL_GPL(snd_soc_component_set_jack);
>   int snd_soc_component_module_get(struct snd_soc_component *component,
>   				 int upon_open)
>   {
> +	if (component->module)
> +		return 0;
> +
>   	if (component->driver->module_get_upon_open == !!upon_open &&
>   	    !try_module_get(component->dev->driver->owner))
>   		return -ENODEV;
>   
> +	component->module = 1;
> +

Maybe a red-herring but is there a potential for race conditions here if 
that function is called twice from different places? Don't we need some 
sort of lock for all the new flags introduced here?

Thanks
-Pierre


More information about the Alsa-devel mailing list