From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1756532Ab3LSQGg (ORCPT ); Thu, 19 Dec 2013 11:06:36 -0500 Received: from cantor2.suse.de ([195.135.220.15]:59783 "EHLO mx2.suse.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753870Ab3LSQGZ (ORCPT ); Thu, 19 Dec 2013 11:06:25 -0500 Date: Thu, 19 Dec 2013 17:06:23 +0100 Message-ID: From: Takashi Iwai To: Lee Jones Cc: linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, linus.walleij@linaro.org, broonie@kernel.org, alsa-devel@alsa-project.org Subject: Re: [PATCH 02/11] ASoC: ab8500: Revert back to find_next_bit() In-Reply-To: <1387468508-12286-3-git-send-email-lee.jones@linaro.org> References: <1387468508-12286-1-git-send-email-lee.jones@linaro.org> <1387468508-12286-3-git-send-email-lee.jones@linaro.org> User-Agent: Wanderlust/2.15.9 (Almost Unreal) SEMI/1.14.6 (Maruoka) FLIM/1.14.9 (=?UTF-8?B?R29qxY0=?=) APEL/10.8 Emacs/24.3 (x86_64-suse-linux-gnu) MULE/6.0 (HANACHIRUSATO) MIME-Version: 1.0 (generated by SEMI 1.14.6 - "Maruoka") Content-Type: text/plain; charset=US-ASCII Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org At Thu, 19 Dec 2013 15:54:59 +0000, Lee Jones wrote: > > Commit '166a34d ASoC: ab8500: Fix invalid cast to long pointer' > rather carelessly converts find_next_bit() to fls() (find last > bit set), which are not the same. Does it break on the real machines? fls() behaves differently from find_next_bit(), of course, but in this case, it should work same in the end, since there are at most two bits. Takashi > Although this implementation may not be portable, the alternative > breaks audio on anything using the AB8500 CODEC, which is a much > greater evil. Besides, this driver will never run on anything > else. > > Cc: Takashi Iwai > Signed-off-by: Lee Jones > --- > sound/soc/codecs/ab8500-codec.c | 4 ++-- > 1 file changed, 2 insertions(+), 2 deletions(-) > > diff --git a/sound/soc/codecs/ab8500-codec.c b/sound/soc/codecs/ab8500-codec.c > index 1ad92cb..51ae3e9 100644 > --- a/sound/soc/codecs/ab8500-codec.c > +++ b/sound/soc/codecs/ab8500-codec.c > @@ -2322,7 +2322,7 @@ static int ab8500_codec_set_dai_tdm_slot(struct snd_soc_dai *dai, > slot = ffs(tx_mask); > snd_soc_update_bits(codec, AB8500_DASLOTCONF1, mask, slot); > snd_soc_update_bits(codec, AB8500_DASLOTCONF3, mask, slot); > - slot = fls(tx_mask); > + slot = find_next_bit((unsigned long *)&tx_mask, 32, slot + 1); > snd_soc_update_bits(codec, AB8500_DASLOTCONF2, mask, slot); > snd_soc_update_bits(codec, AB8500_DASLOTCONF4, mask, slot); > break; > @@ -2364,7 +2364,7 @@ static int ab8500_codec_set_dai_tdm_slot(struct snd_soc_dai *dai, > AB8500_ADSLOTSEL(slot), > AB8500_MASK_SLOT(slot), > AB8500_ADSLOTSELX_AD_OUT_TO_SLOT(AB8500_AD_OUT3, slot)); > - slot = fls(rx_mask); > + slot = find_next_bit((unsigned long *)&rx_mask, 32, slot + 1); > snd_soc_update_bits(codec, > AB8500_ADSLOTSEL(slot), > AB8500_MASK_SLOT(slot), > -- > 1.8.3.2 >