Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753691AbbKWIzD (ORCPT ); Mon, 23 Nov 2015 03:55:03 -0500 Received: from mout.kundenserver.de ([217.72.192.75]:63735 "EHLO mout.kundenserver.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753552AbbKWIzA (ORCPT ); Mon, 23 Nov 2015 03:55:00 -0500 From: Arnd Bergmann To: zhangfei Cc: alsa-devel@alsa-project.org, broonie@kernel.org, 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 Date: Mon, 23 Nov 2015 09:54:22 +0100 Message-ID: <4678926.Vc1QsAaFQ0@wuerfel> User-Agent: KMail/4.11.5 (Linux/3.16.0-10-generic; KDE/4.11.5; x86_64; ; ) In-Reply-To: <5652CA09.5080101@linaro.org> References: <7580645.enu4DmUPIv@wuerfel> <5652CA09.5080101@linaro.org> MIME-Version: 1.0 Content-Transfer-Encoding: 7Bit Content-Type: text/plain; charset="us-ascii" X-Provags-ID: V03:K0:BeD9MucV6JE/sPcqtcfHTdC7jzUc0jc+cQuOubI3XzoqPvO+pic QruuA4pWZAGvUpQWQA1Ct1MNaPMikceShqO5l+D3i5pCwvO6F9q4Np7pxpzGHn8hmpvR2gh lcb5/j94rkBWDfRRfa3ULEEamtPussV90lwy4KDiws3ub5rOGBHS6rnbFJ5ULblHGmvcMpF 6kAoDBbnK5DW0dagdHV9w== X-UI-Out-Filterresults: notjunk:1;V01:K0:5Pcgxd+MvFE=:qBRN5Ucq9Y4IkvUwM9mEPE S+Gx1V5KSiMWJ3ugVicW017EiOZUJuPzDqSi+QGTygYmRYaYgdZh8p6w7FTGlwNalHyrFKK4L /ZTUN5unYMt8/2QlPbrUXuwR1l9lYpnJOj+GYic9RYHblatmreDWlabfRQOSxJdyZ+EouUKDK AkuVF/YDDM6EEtiRBbEUHaAMBvuob+yXViZF6B8vDyqJx3cGx0wgn2cHExL/qg4dz6Ex4M/9y 8ErTeGdUDtzbewmOVSZPv3XdKDwhw9OKYtTzr+gmzn6OSRqkWwTTZfR8+AX4keyYUh9TjTSkn eCncOsLLHPLm3vabTtQ1MgOGr41ktQqcI+YJ85/Kxao1TJdva7qD998ha5XZnyUqHJse3OYUj Evcl2Zdd4VnDuLXWrI4WE9cxgEaCJTC6jjkWyQvxQAyKmn44oJyWwL3SelGkhUfslu+TxA4H1 /BRowcGOPugA3g7tYFl8lfGFcRxtYmiTimXKG8JLGmA5GiRfem3daWvsUzzP60ApMoKlYQzpD EJSrUR5zJp3IoL7fgLm2EZZd/l9Pv1kWmdXrdZzLo8V4msM1M6pe50gazMhV53cWFV9VCZ0YC IR+0DfuGV2wPbJtPSktUsRyHXuUq1brh7KR2NoDZGoq6oF6n5MTbnxB4iH2rqkPXjSzCAFWtq GfWsyoaX5ms9LNR4j6lFee6sQKRR02LaMcdP7SpkRue5Fey2C+eMmj/qYEN4OymM0wJoAML/f 0dVGrx3JRPomHK0p Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 2586 Lines: 67 On Monday 23 November 2015 16:10:49 zhangfei wrote: > On 11/20/2015 05:32 PM, Arnd Bergmann wrote: > > 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. Good idea. I see that Mark has already applied the original patch, and with my new version, gcc should be smart enough to completely optimize out the division and the unused variable. This means the effect of the patch is very small, but if Mark wants it, he can apply the below. Arnd 8<--- Subject: ASoC: remove unused variable As pointed out by Zhangfei Gao, the sspa_div variable in brownstone_wm8994_hw_params() is completely unused, so as a cleanup following a prior patch, this removes both the variable and the division. Signed-off-by: Arnd Bergmann diff --git a/sound/soc/pxa/brownstone.c b/sound/soc/pxa/brownstone.c index 416ea646c3b1..ec522e94b0e2 100644 --- a/sound/soc/pxa/brownstone.c +++ b/sound/soc/pxa/brownstone.c @@ -52,7 +52,6 @@ static int brownstone_wm8994_hw_params(struct snd_pcm_substream *substream, struct snd_soc_dai *codec_dai = rtd->codec_dai; struct snd_soc_dai *cpu_dai = rtd->cpu_dai; int freq_out, sspa_mclk, sysclk; - int sspa_div; if (params_rate(params) > 11025) { freq_out = params_rate(params) * 512; @@ -63,7 +62,6 @@ 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 / 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); -- 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/