Commit f60e5473 authored by Takashi Iwai's avatar Takashi Iwai Committed by Mark Brown

ASoC: ssm2518: Fix off-by-one error by ffs()

ffs() returns the bit position from 1, while the ssm2158 driver code
assumes it being 0-based.  Also, the bit mask computation of the two
channel slots are incorrect; it must have worked just casually.
Signed-off-by: default avatarTakashi Iwai <tiwai@suse.de>
Acked-by: default avatarLars-Peter Clausen <lars@metafoo.de>
Signed-off-by: default avatarMark Brown <broonie@linaro.org>
parent 6ce4eac1
...@@ -549,13 +549,13 @@ static int ssm2518_set_tdm_slot(struct snd_soc_dai *dai, unsigned int tx_mask, ...@@ -549,13 +549,13 @@ static int ssm2518_set_tdm_slot(struct snd_soc_dai *dai, unsigned int tx_mask,
right_slot = 0; right_slot = 0;
} else { } else {
/* We assume the left channel < right channel */ /* We assume the left channel < right channel */
left_slot = ffs(tx_mask); left_slot = __ffs(tx_mask);
tx_mask &= ~(1 << tx_mask); tx_mask &= ~(1 << left_slot);
if (tx_mask == 0) { if (tx_mask == 0) {
right_slot = left_slot; right_slot = left_slot;
} else { } else {
right_slot = ffs(tx_mask); right_slot = __ffs(tx_mask);
tx_mask &= ~(1 << tx_mask); tx_mask &= ~(1 << right_slot);
} }
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment