linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] pinctrl: rzn1: array reg_drive static, makes object smaller
@ 2019-10-07 14:05 Colin King
  2019-10-11 11:46 ` Geert Uytterhoeven
  0 siblings, 1 reply; 2+ messages in thread
From: Colin King @ 2019-10-07 14:05 UTC (permalink / raw)
  To: Geert Uytterhoeven, Linus Walleij, linux-renesas-soc, linux-gpio
  Cc: kernel-janitors, linux-kernel

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

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)

Signed-off-by: Colin Ian King <colin.king@canonical.com>
---
 drivers/pinctrl/pinctrl-rzn1.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/pinctrl/pinctrl-rzn1.c b/drivers/pinctrl/pinctrl-rzn1.c
index 0f6f8a10a53a..39538d40dbf3 100644
--- a/drivers/pinctrl/pinctrl-rzn1.c
+++ b/drivers/pinctrl/pinctrl-rzn1.c
@@ -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;
 
-- 
2.20.1


^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [PATCH] pinctrl: rzn1: array reg_drive static, makes object smaller
  2019-10-07 14:05 [PATCH] pinctrl: rzn1: array reg_drive static, makes object smaller Colin King
@ 2019-10-11 11:46 ` Geert Uytterhoeven
  0 siblings, 0 replies; 2+ messages in thread
From: Geert Uytterhoeven @ 2019-10-11 11:46 UTC (permalink / raw)
  To: Colin King
  Cc: Linus Walleij, Linux-Renesas, open list:GPIO SUBSYSTEM,
	kernel-janitors, Linux Kernel Mailing List

Hi Colin,

On Mon, Oct 7, 2019 at 4:06 PM Colin King <colin.king@canonical.com> wrote:
> From: Colin Ian King <colin.king@canonical.com>
>
> 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)
>
> Signed-off-by: Colin Ian King <colin.king@canonical.com>

Thanks for your patch!

Reviewed-by: Geert Uytterhoeven <geert+renesas@glider.be>
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

-- 
Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- geert@linux-m68k.org

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

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2019-10-11 11:46 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-10-07 14:05 [PATCH] pinctrl: rzn1: array reg_drive static, makes object smaller Colin King
2019-10-11 11:46 ` Geert Uytterhoeven

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).