Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1730825

[PATCH] pinctrl: uniphier: make arrays static, reduces object code size

Path csiph.com!news.mixmin.net!news.unit0.net!news.panservice.it!bofh.it!news.nic.it!robomod
From Colin King <colin.king@canonical.com>
Newsgroups linux.kernel
Subject [PATCH] pinctrl: uniphier: make arrays static, reduces object code size
Date Tue, 12 Sep 2017 13:30:01 +0200
Message-ID <uoRy9-Ch-7@gated-at.bofh.it> (permalink)
X-Mailer git-send-email 2.14.1
MIME-Version 1.0
Content-Type text/plain; charset="utf-8"
Content-Transfer-Encoding 8bit
Sender robomod@news.nic.it
List-ID <linux-kernel.vger.kernel.org>
X-Mailing-List linux-kernel@vger.kernel.org
Approved robomod@news.nic.it
Lines 53
Organization linux.* mail to news gateway
X-Original-Cc kernel-janitors@vger.kernel.org, linux-kernel@vger.kernel.org
X-Original-Date Tue, 12 Sep 2017 12:21:24 +0100
X-Original-Message-ID <20170912112124.1143-1-colin.king@canonical.com>
X-Original-Sender linux-kernel-owner@vger.kernel.org
Xref csiph.com linux.kernel:1730825

Show key headers only | View raw


From: Colin Ian King <colin.king@canonical.com>

Don't populate const arrays on the stack, instead make them
static.  Makes the object code smaller nearly 1000 bytes. Also
line break wide lines to avoid checkpatch warnings.

Before:
   text	   data	    bss	    dec	    hex	filename
  13112	   1996	      0	  15108	   3b04	pinctrl-uniphier-core.o

After:
   text	   data	    bss	    dec	    hex	filename
  11642	   2476	      0	  14118	   3726	pinctrl-uniphier-core.o

Signed-off-by: Colin Ian King <colin.king@canonical.com>
---
 drivers/pinctrl/uniphier/pinctrl-uniphier-core.c | 14 ++++++++------
 1 file changed, 8 insertions(+), 6 deletions(-)

diff --git a/drivers/pinctrl/uniphier/pinctrl-uniphier-core.c b/drivers/pinctrl/uniphier/pinctrl-uniphier-core.c
index f9267fabe6b0..26fda5c53e65 100644
--- a/drivers/pinctrl/uniphier/pinctrl-uniphier-core.c
+++ b/drivers/pinctrl/uniphier/pinctrl-uniphier-core.c
@@ -204,9 +204,10 @@ static int uniphier_conf_pin_drive_get(struct pinctrl_dev *pctldev,
 	const struct pin_desc *desc = pin_desc_get(pctldev, pin);
 	enum uniphier_pin_drv_type type =
 				uniphier_pin_get_drv_type(desc->drv_data);
-	const unsigned int strength_1bit[] = {4, 8};
-	const unsigned int strength_2bit[] = {8, 12, 16, 20};
-	const unsigned int strength_3bit[] = {4, 5, 7, 9, 11, 12, 14, 16};
+	static const unsigned int strength_1bit[] = {4, 8};
+	static const unsigned int strength_2bit[] = {8, 12, 16, 20};
+	static const unsigned int strength_3bit[] = {4, 5, 7, 9, 11, 12,
+						     14, 16};
 	const unsigned int *supported_strength;
 	unsigned int drvctrl, reg, shift, mask, width, val;
 	int ret;
@@ -399,9 +400,10 @@ static int uniphier_conf_pin_drive_set(struct pinctrl_dev *pctldev,
 	const struct pin_desc *desc = pin_desc_get(pctldev, pin);
 	enum uniphier_pin_drv_type type =
 				uniphier_pin_get_drv_type(desc->drv_data);
-	const unsigned int strength_1bit[] = {4, 8, -1};
-	const unsigned int strength_2bit[] = {8, 12, 16, 20, -1};
-	const unsigned int strength_3bit[] = {4, 5, 7, 9, 11, 12, 14, 16, -1};
+	static const unsigned int strength_1bit[] = {4, 8, -1};
+	static const unsigned int strength_2bit[] = {8, 12, 16, 20, -1};
+	static const unsigned int strength_3bit[] = {4, 5, 7, 9, 11, 12, 14,
+						     16, -1};
 	const unsigned int *supported_strength;
 	unsigned int drvctrl, reg, shift, mask, width, val;
 
-- 
2.14.1

Back to linux.kernel | Previous | NextNext in thread | Find similar | Unroll thread


Thread

[PATCH] pinctrl: uniphier: make arrays static, reduces object code size Colin King <colin.king@canonical.com> - 2017-09-12 13:30 +0200
  Re: [PATCH] pinctrl: uniphier: make arrays static, reduces object  code size Masahiro Yamada <yamada.masahiro@socionext.com> - 2017-09-12 15:40 +0200
  Re: [PATCH] pinctrl: uniphier: make arrays static, reduces object  code size Linus Walleij <linus.walleij@linaro.org> - 2017-09-12 16:20 +0200

csiph-web