From: Lars-Peter Clausen Date: Wed, 27 Nov 2013 08:58:17 +0000 (+0100) Subject: ASoC: pcm: Fix rate_max calculation X-Git-Tag: v3.13-rc3~12^2~1^2~2^2~3 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=17b6c19b34b43a6a8dd5936b3cdbc63d7d1ae186;p=kernel%2Fkernel-generic.git ASoC: pcm: Fix rate_max calculation In order to make sure that the sample rate is in the supported range of both components the maximum rate of the card should be the minimum of the maximum rate of each components. There is one special case to consider though, if max_rate is set to 0 this means there is no maximum specified, so use min_not_zero() macro which will give use the desired result. Signed-off-by: Lars-Peter Clausen Acked-by: Takashi iwai Signed-off-by: Mark Brown --- diff --git a/sound/soc/soc-pcm.c b/sound/soc/soc-pcm.c index 42782c0..9441e17 100644 --- a/sound/soc/soc-pcm.c +++ b/sound/soc/soc-pcm.c @@ -153,7 +153,7 @@ static void soc_pcm_init_runtime_hw(struct snd_pcm_hardware *hw, struct snd_soc_pcm_stream *cpu_stream) { hw->rate_min = max(codec_stream->rate_min, cpu_stream->rate_min); - hw->rate_max = max(codec_stream->rate_max, cpu_stream->rate_max); + hw->rate_max = min_not_zero(codec_stream->rate_max, cpu_stream->rate_max); hw->channels_min = max(codec_stream->channels_min, cpu_stream->channels_min); hw->channels_max = min(codec_stream->channels_max,