Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753661AbbKWIK7 (ORCPT ); Mon, 23 Nov 2015 03:10:59 -0500 Received: from mail-pa0-f44.google.com ([209.85.220.44]:35410 "EHLO mail-pa0-f44.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753501AbbKWIK5 (ORCPT ); Mon, 23 Nov 2015 03:10:57 -0500 Message-ID: <5652CA09.5080101@linaro.org> Date: Mon, 23 Nov 2015 16:10:49 +0800 From: zhangfei User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:31.0) Gecko/20100101 Thunderbird/31.3.0 MIME-Version: 1.0 To: Arnd Bergmann , alsa-devel@alsa-project.org, broonie@kernel.org CC: Robert Jarzmik , Haojian Zhuang , Daniel Mack , Liam Girdwood , linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, Leo Yan Subject: Re: [PATCH] ASoC: pxa: remove incorrect do_div() call References: <7580645.enu4DmUPIv@wuerfel> In-Reply-To: <7580645.enu4DmUPIv@wuerfel> Content-Type: text/plain; charset=windows-1252; format=flowed Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 2043 Lines: 53 On 11/20/2015 05:32 PM, Arnd Bergmann wrote: > The new optimized do_div implementation (now in asm-generic/next) exposes a > glitch in the brownstone audio driver by producing a compile-time warning: > > sound/soc/pxa/brownstone.c: In function 'brownstone_wm8994_hw_params': > sound/soc/pxa/brownstone.c:67:85: warning: comparison of distinct pointer types lacks a cast > sound/soc/pxa/brownstone.c:67:10125: warning: right shift count >= width of type [-Wshift-count-overflow] > sound/soc/pxa/brownstone.c:67:10254: warning: passing argument 1 of '__div64_32' from incompatible pointer type [-Wincompatible-pointer-types] > > The driver just divides two plain integer values, so it should not > use do_div to start with, but has apparently done so ever since the > code was first merged. This replaces do_div with a simple division > operator. > > Signed-off-by: Arnd Bergmann > --- > I think this one is harmless, so we only need it in 4.5 to avoid the warning, > but not backported to earlier kernels. > > Found today on ARM allmodconfig > > diff --git a/sound/soc/pxa/brownstone.c b/sound/soc/pxa/brownstone.c > index 6147e86e9b0f..416ea646c3b1 100644 > --- a/sound/soc/pxa/brownstone.c > +++ b/sound/soc/pxa/brownstone.c > @@ -63,8 +63,7 @@ static int brownstone_wm8994_hw_params(struct snd_pcm_substream *substream, > sysclk = params_rate(params) * 512; > sspa_mclk = params_rate(params) * 64; > } > - sspa_div = freq_out; > - do_div(sspa_div, sspa_mclk); > + sspa_div = freq_out / sspa_mclk; > > snd_soc_dai_set_sysclk(cpu_dai, MMP_SSPA_CLK_AUDIO, freq_out, 0); > snd_soc_dai_set_pll(cpu_dai, MMP_SYSCLK, 0, freq_out, sysclk); > Thanks Arnd. Looks sspa_div is not used at all. So we can remove sspa_div as well as do_div. What do you think. Thanks -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/