From patchwork Tue Sep 19 21:50:00 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Colin King X-Patchwork-Id: 9960387 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id 1209B601E9 for ; Tue, 19 Sep 2017 22:00:18 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 0493828F0E for ; Tue, 19 Sep 2017 22:00:18 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id ED4C128F0F; Tue, 19 Sep 2017 22:00:17 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-1.9 required=2.0 tests=BAYES_00, RCVD_IN_DNSWL_NONE autolearn=ham version=3.3.1 Received: from alsa0.perex.cz (alsa0.perex.cz [77.48.224.243]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 5506F28F18 for ; Tue, 19 Sep 2017 22:00:15 +0000 (UTC) Received: from alsa0.perex.cz (localhost [127.0.0.1]) by alsa0.perex.cz (Postfix) with ESMTP id EB3C0267218; Tue, 19 Sep 2017 23:50:39 +0200 (CEST) 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 48E3A267219; Tue, 19 Sep 2017 23:50:38 +0200 (CEST) Received: from youngberry.canonical.com (youngberry.canonical.com [91.189.89.112]) by alsa0.perex.cz (Postfix) with ESMTP id BDB4F2671F3 for ; Tue, 19 Sep 2017 23:50:36 +0200 (CEST) Received: from 1.general.cking.uk.vpn ([10.172.193.212] helo=localhost) by youngberry.canonical.com with esmtpsa (TLS1.0:RSA_AES_256_CBC_SHA1:32) (Exim 4.76) (envelope-from ) id 1duQP2-0000U8-Ej; Tue, 19 Sep 2017 21:50:00 +0000 From: Colin King To: Liam Girdwood , Mark Brown , Jaroslav Kysela , Takashi Iwai , Bard Liao , alsa-devel@alsa-project.org Date: Tue, 19 Sep 2017 22:50:00 +0100 Message-Id: <20170919215000.32040-1-colin.king@canonical.com> X-Mailer: git-send-email 2.14.1 MIME-Version: 1.0 Cc: kernel-janitors@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [alsa-devel] [PATCH] ASoC: rl6231: make arrays div and pd static const, reduces object code size 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 From: Colin Ian King Don't populate the read-only arrays div and pd on the stack, instead make them static const. Makes the object code smaller by 210 bytes: Before: text data bss dec hex filename 2869 720 0 3589 e05 sound/soc/codecs/rl6231.o After: text data bss dec hex filename 2495 880 0 3375 d2f sound/soc/codecs/rl6231.o Signed-off-by: Colin Ian King --- sound/soc/codecs/rl6231.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/sound/soc/codecs/rl6231.c b/sound/soc/codecs/rl6231.c index 7b447d0b173a..974a9040651d 100644 --- a/sound/soc/codecs/rl6231.c +++ b/sound/soc/codecs/rl6231.c @@ -71,7 +71,7 @@ EXPORT_SYMBOL_GPL(rl6231_get_pre_div); */ int rl6231_calc_dmic_clk(int rate) { - int div[] = {2, 3, 4, 6, 8, 12}; + static const int div[] = {2, 3, 4, 6, 8, 12}; int i; if (rate < 1000000 * div[0]) { @@ -189,7 +189,8 @@ EXPORT_SYMBOL_GPL(rl6231_pll_calc); int rl6231_get_clk_info(int sclk, int rate) { - int i, pd[] = {1, 2, 3, 4, 6, 8, 12, 16}; + int i; + static const int pd[] = {1, 2, 3, 4, 6, 8, 12, 16}; if (sclk <= 0 || rate <= 0) return -EINVAL;