summary refs log tree commit diff
path: root/sound/core/pcm_lib.c
diff options
context:
space:
mode:
authorLars-Peter Clausen <lars@metafoo.de>2014-12-29 18:43:36 +0100
committerTakashi Iwai <tiwai@suse.de>2014-12-30 16:27:37 +0100
commit19f52fae5adb7f2fd5b75251f9bd761f43a36476 (patch)
treeed97d3d1fde49781acad092b934ad780c76494f2 /sound/core/pcm_lib.c
parent97bf6af1f928216fd6c5a66e8a57bfa95a659672 (diff)
downloadlinux-19f52fae5adb7f2fd5b75251f9bd761f43a36476.tar.gz
ALSA: Fix handling of multiple msbits constraints on the same runtime
If the sound card is made up of discrete components, each with their own
driver (e.g. like in the ASoC case), we might end up with multiple msbits
constraint rules installed. Currently this will result in msbits being set
to whatever the last rule set it to.

This patch updates the behavior of the rule to choose the minimum (other
than zero) of all the installed rules.

Signed-off-by: Lars-Peter Clausen <lars@metafoo.de>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
Diffstat (limited to 'sound/core/pcm_lib.c')
-rw-r--r--sound/core/pcm_lib.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/sound/core/pcm_lib.c b/sound/core/pcm_lib.c
index ec9e7866177f..b0c153534a29 100644
--- a/sound/core/pcm_lib.c
+++ b/sound/core/pcm_lib.c
@@ -1300,7 +1300,7 @@ static int snd_pcm_hw_rule_msbits(struct snd_pcm_hw_params *params,
 	unsigned int msbits = l >> 16;
 	struct snd_interval *i = hw_param_interval(params, SNDRV_PCM_HW_PARAM_SAMPLE_BITS);
 	if (snd_interval_single(i) && snd_interval_value(i) == width)
-		params->msbits = msbits;
+		params->msbits = min_not_zero(params->msbits, msbits);
 	return 0;
 }