Skip to contentSkip to conversation

pinctrl: rzn1: array reg_drive static, makes object smaller

PATCH In review Colin King 2 participants 2 messages Oct 7, 2019 – Oct 11, 2019

Subsystems (3)
lore
Share & tools
lore

Colin King

author
#0 lore raw

PATCH 1/1 pinctrl: rzn1: array reg_drive static, makes object smaller

From: Colin Ian King <[email protected]>

Don't populate the array reg_drive on the stack but instead make it static. Makes the object code smaller by 32 bytes.

Before:
text data bss dec hex filename
31991 15696 0 47687 ba47 drivers/pinctrl/pinctrl-rzn1.o

After:
text data bss dec hex filename
31863 15792 0 47655 ba27 drivers/pinctrl/pinctrl-rzn1.o

(gcc version 9.2.1, amd64)

---
 drivers/pinctrl/pinctrl-rzn1.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/pinctrl/pinctrl-rzn1.c +1 -1
index 0f6f8a10a53a..39538d40dbf3 100644
@@ -487,7 +487,7 @@ static int rzn1_pinconf_get(struct pinctrl_dev *pctldev, unsigned int pin,
 {
 	struct rzn1_pinctrl *ipctl = pinctrl_dev_get_drvdata(pctldev);
 	enum pin_config_param param = pinconf_to_config_param(*config);
-	const u32 reg_drive[4] = { 4, 6, 8, 12 };
+	static const u32 reg_drive[4] = { 4, 6, 8, 12 };
 	u32 pull, drive, l1mux;
 	u32 l1, l2, arg = 0;
 
Signature · 1 line
2.20.1
Reviewed-by on v1 1/1
#1 lore raw

Hi Colin,

Quoted 9 lines · Colin King

From: Colin Ian King <[email protected]>

Don't populate the array reg_drive on the stack but instead make it static. Makes the object code smaller by 32 bytes.

Before:
text data bss dec hex filename
31991 15696 0 47687 ba47 drivers/pinctrl/pinctrl-rzn1.o

Quoted 7 lines

After:
text data bss dec hex filename
31863 15792 0 47655 ba27 drivers/pinctrl/pinctrl-rzn1.o

(gcc version 9.2.1, amd64)

Thanks for your patch!

i.e. will queue in sh-pfc-for-v5.5.

FTR, on arm32, it saves 64 bytes:

   8594     148       0    8742    2226 drivers/pinctrl/pinctrl-rzn1.o.before
   8530     148       0    8678    21e6 drivers/pinctrl/pinctrl-rzn1.o.after

BTW, what debug options do you have enabled, to get a binary that's more than 5x as large? Amd64 code generation can't be that bad...

Gr{oetje,eeting}s,

Geert

Signature · 5 lines
Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- [email protected]

In personal conversations with technical people, I call myself a hacker. But
when I'm talking to journalists I just say "programmer" or something like that.
                                -- Linus Torvalds