From patchwork Mon Nov 23 08:54:22 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Arnd Bergmann X-Patchwork-Id: 7678061 Return-Path: X-Original-To: patchwork-alsa-devel@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork2.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.136]) by patchwork2.web.kernel.org (Postfix) with ESMTP id D53BDBF90C for ; Mon, 23 Nov 2015 08:54:51 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 0128720628 for ; Mon, 23 Nov 2015 08:54:51 +0000 (UTC) Received: from alsa0.perex.cz (alsa0.perex.cz [77.48.224.243]) by mail.kernel.org (Postfix) with ESMTP id B988720623 for ; Mon, 23 Nov 2015 08:54:49 +0000 (UTC) Received: by alsa0.perex.cz (Postfix, from userid 1000) id C284A2652AA; Mon, 23 Nov 2015 09:54:48 +0100 (CET) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Spam-Level: X-Spam-Status: No, score=-2.6 required=5.0 tests=BAYES_00,NO_DNS_FOR_FROM, RCVD_IN_DNSWL_LOW,UNPARSEABLE_RELAY autolearn=ham version=3.3.1 Received: from alsa0.perex.cz (localhost [127.0.0.1]) by alsa0.perex.cz (Postfix) with ESMTP id 34A792651ED; Mon, 23 Nov 2015 09:54:41 +0100 (CET) X-Original-To: alsa-devel@alsa-project.org Delivered-To: alsa-devel@alsa-project.org Received: by alsa0.perex.cz (Postfix, from userid 1000) id CCE44265205; Mon, 23 Nov 2015 09:54:39 +0100 (CET) Received: from mout.kundenserver.de (mout.kundenserver.de [217.72.192.75]) by alsa0.perex.cz (Postfix) with ESMTP id B8B5A2651CB for ; Mon, 23 Nov 2015 09:54:32 +0100 (CET) Received: from wuerfel.localnet ([134.3.118.24]) by mrelayeu.kundenserver.de (mreue104) with ESMTPSA (Nemesis) id 0MGi7V-1a5Trm0OzB-00DVe1; Mon, 23 Nov 2015 09:54:27 +0100 From: Arnd Bergmann To: zhangfei 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 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 Cc: alsa-devel@alsa-project.org, Leo Yan , Liam Girdwood , Haojian Zhuang , linux-kernel@vger.kernel.org, broonie@kernel.org, linux-arm-kernel@lists.infradead.org, Robert Jarzmik , Daniel Mack Subject: Re: [alsa-devel] [PATCH] ASoC: pxa: remove incorrect do_div() call X-BeenThere: alsa-devel@alsa-project.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: "Alsa-devel mailing list for ALSA developers - http://www.alsa-project.org" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: alsa-devel-bounces@alsa-project.org Sender: alsa-devel-bounces@alsa-project.org X-Virus-Scanned: ClamAV using ClamSMTP 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);