pinctrl: rzn1: array reg_drive static, makes object smaller
diff mbox series

Message ID 20191007140559.11840-1-colin.king@canonical.com
State New
Headers show
Series
  • pinctrl: rzn1: array reg_drive static, makes object smaller
Related show

Commit Message

Colin King Oct. 7, 2019, 2:05 p.m. UTC
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(-)

Comments

Geert Uytterhoeven Oct. 11, 2019, 11:46 a.m. UTC | #1
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

Patch
diff mbox series

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;