[alsa-devel] [PATCH] ASoC: soc-pcm: Only do snd_soc_dai_digital_mute() in hw_free()

Mark Brown broonie at kernel.org
Tue Dec 3 16:04:23 CET 2013


On Tue, Dec 03, 2013 at 05:16:06PM +0800, Nicolin Chen wrote:

> @@ -689,7 +684,7 @@ static int soc_pcm_hw_free(struct snd_pcm_substream *substream)
>  	struct snd_soc_platform *platform = rtd->platform;
>  	struct snd_soc_dai *cpu_dai = rtd->cpu_dai;
>  	struct snd_soc_dai *codec_dai = rtd->codec_dai;
> -	struct snd_soc_codec *codec = rtd->codec;
> +	bool playback = substream->stream == SNDRV_PCM_STREAM_PLAYBACK ? 1 : 0;

Please don't use the ternery operator, you could've just used the result
of the comparison directly here.

>  	mutex_lock_nested(&rtd->pcm_mutex, rtd->pcm_subclass);
>  
> @@ -707,7 +702,8 @@ static int soc_pcm_hw_free(struct snd_pcm_substream *substream)
>  	}
>  
>  	/* apply codec digital mute */
> -	if (!codec->active)
> +	if ((playback && codec_dai->playback_active == 1) ||
> +			(!playback && codec_dai->capture_active == 1))
>  		snd_soc_dai_digital_mute(codec_dai, 1, substream->stream);

This is a bit confusing to read due to the strange indentation (the
second line is massively indented with respect to the first line for
some reason).  This hunk also ought to be split out as a separate patch
since it's a bug fix.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 836 bytes
Desc: Digital signature
URL: <http://mailman.alsa-project.org/pipermail/alsa-devel/attachments/20131203/2df1efce/attachment.sig>


More information about the Alsa-devel mailing list