Re: [PATCH 1/1] ASoC: soc-compress: lock pcm_mutex to resolve lockdep error

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hello,

On 30-03-20, 20:01, �̰��� wrote:
> snd_soc_runtime_activate() and snd_soc_runtime_deactivate()
> require locked pcm_mutex.
> 
> Signed-off-by: Gyeongtaek Lee <gt82.lee@xxxxxxxxxxx>
> ---
>  sound/soc/soc-compress.c | 4 ++++
>  1 file changed, 4 insertions(+)
> 
> diff --git a/sound/soc/soc-compress.c b/sound/soc/soc-compress.c
> index 392a1c5b15d3..42d416ac7e9b 100644
> --- a/sound/soc/soc-compress.c
> +++ b/sound/soc/soc-compress.c
> @@ -207,7 +207,9 @@ static int soc_compr_open_fe(struct snd_compr_stream
> *cstream)
>  	fe->dpcm[stream].state = SND_SOC_DPCM_STATE_OPEN;
>  	fe->dpcm[stream].runtime_update = SND_SOC_DPCM_UPDATE_NO;
>  
> +	mutex_lock_nested(&fe->pcm_mutex, fe->pcm_subclass);
>  	snd_soc_runtime_activate(fe, stream);
> +	mutex_unlock(&fe->pcm_mutex);

Can you please explain why you need the lock here, as
>  
>  	mutex_unlock(&fe->card->mutex);

we already have a lock here..

> @@ -285,7 +287,9 @@ static int soc_compr_free_fe(struct snd_compr_stream
> *cstream)
>  	else
>  		stream = SNDRV_PCM_STREAM_CAPTURE;
>  
> +	mutex_lock_nested(&fe->pcm_mutex, fe->pcm_subclass);
>  	snd_soc_runtime_deactivate(fe, stream);
> +	mutex_unlock(&fe->pcm_mutex);

And this instance is also using fe->card->mutex.. so I think double lock
may not serve any purpose here..

Can you explain why we need the extra lock?

Thanks
-- 
~Vinod



[Index of Archives]     [ALSA User]     [Linux Audio Users]     [Pulse Audio]     [Kernel Archive]     [Asterisk PBX]     [Photo Sharing]     [Linux Sound]     [Video 4 Linux]     [Gimp]     [Yosemite News]

  Powered by Linux