aboutsummaryrefslogtreecommitdiffstats
path: root/sound/soc/codecs/ssm2518.c
diff options
context:
space:
mode:
authorTakashi Iwai <tiwai@suse.de>2013-12-23 05:42:55 -0500
committerMark Brown <broonie@linaro.org>2014-01-02 06:54:15 -0500
commitf60e5473e6788f93849a61198bec4e02fea31e51 (patch)
treecf211455da24d174f6187dd4a6d40ef24925ad36 /sound/soc/codecs/ssm2518.c
parent6ce4eac1f600b34f2f7f58f9cd8f0503d79e42ae (diff)
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: Takashi Iwai <tiwai@suse.de> Acked-by: Lars-Peter Clausen <lars@metafoo.de> Signed-off-by: Mark Brown <broonie@linaro.org>
Diffstat (limited to 'sound/soc/codecs/ssm2518.c')
-rw-r--r--sound/soc/codecs/ssm2518.c8
1 files changed, 4 insertions, 4 deletions
diff --git a/sound/soc/codecs/ssm2518.c b/sound/soc/codecs/ssm2518.c
index 95aed552139a..cc8debce752f 100644
--- a/sound/soc/codecs/ssm2518.c
+++ b/sound/soc/codecs/ssm2518.c
@@ -549,13 +549,13 @@ static int ssm2518_set_tdm_slot(struct snd_soc_dai *dai, unsigned int tx_mask,
549 right_slot = 0; 549 right_slot = 0;
550 } else { 550 } else {
551 /* We assume the left channel < right channel */ 551 /* We assume the left channel < right channel */
552 left_slot = ffs(tx_mask); 552 left_slot = __ffs(tx_mask);
553 tx_mask &= ~(1 << tx_mask); 553 tx_mask &= ~(1 << left_slot);
554 if (tx_mask == 0) { 554 if (tx_mask == 0) {
555 right_slot = left_slot; 555 right_slot = left_slot;
556 } else { 556 } else {
557 right_slot = ffs(tx_mask); 557 right_slot = __ffs(tx_mask);
558 tx_mask &= ~(1 << tx_mask); 558 tx_mask &= ~(1 << right_slot);
559 } 559 }
560 } 560 }
561 561