All of lore.kernel.org
 help / color / mirror / Atom feed
From: Tony Lindgren <tony@atomide.com>
To: linux-arm-kernel@lists.infradead.org
Subject: Re: [PATCH] pinctrl: single: make two arrays static const, reduces object code size
Date: Tue, 19 Sep 2017 16:26:37 +0000	[thread overview]
Message-ID: <20170919162637.GY5024@atomide.com> (raw)
In-Reply-To: <20170919144218.23607-1-colin.king@canonical.com>

* Colin King <colin.king@canonical.com> [170919 07:43]:
> From: Colin Ian King <colin.king@canonical.com>
> 
> Don't populate the read-only arrays prop2 and prop4 on the stack, instead
> make them static const.  Makes the object code smaller by over 230 bytes:
> 
> Before:
>    text	   data	    bss	    dec	    hex	filename
>   28235	   5820	    192	  34247	   85c7	drivers/pinctrl/pinctrl-single.o
> 
> After:
>    text	   data	    bss	    dec	    hex	filename
>   27839	   5980	    192	  34011	   84db	drivers/pinctrl/pinctrl-single.o
> 
> Signed-off-by: Colin Ian King <colin.king@canonical.com>

Acked-by: Tony Lindgren <tony@atomide.com>

> ---
>  drivers/pinctrl/pinctrl-single.c | 4 ++--
>  1 file changed, 2 insertions(+), 2 deletions(-)
> 
> diff --git a/drivers/pinctrl/pinctrl-single.c b/drivers/pinctrl/pinctrl-single.c
> index b8b3d932cd73..e6cd8de793e2 100644
> --- a/drivers/pinctrl/pinctrl-single.c
> +++ b/drivers/pinctrl/pinctrl-single.c
> @@ -873,13 +873,13 @@ static int pcs_parse_pinconf(struct pcs_device *pcs, struct device_node *np,
>  	int i = 0, nconfs = 0;
>  	unsigned long *settings = NULL, *s = NULL;
>  	struct pcs_conf_vals *conf = NULL;
> -	struct pcs_conf_type prop2[] = {
> +	static const struct pcs_conf_type prop2[] = {
>  		{ "pinctrl-single,drive-strength", PIN_CONFIG_DRIVE_STRENGTH, },
>  		{ "pinctrl-single,slew-rate", PIN_CONFIG_SLEW_RATE, },
>  		{ "pinctrl-single,input-schmitt", PIN_CONFIG_INPUT_SCHMITT, },
>  		{ "pinctrl-single,low-power-mode", PIN_CONFIG_LOW_POWER_MODE, },
>  	};
> -	struct pcs_conf_type prop4[] = {
> +	static const struct pcs_conf_type prop4[] = {
>  		{ "pinctrl-single,bias-pullup", PIN_CONFIG_BIAS_PULL_UP, },
>  		{ "pinctrl-single,bias-pulldown", PIN_CONFIG_BIAS_PULL_DOWN, },
>  		{ "pinctrl-single,input-schmitt-enable",
> -- 
> 2.14.1
> 

WARNING: multiple messages have this Message-ID (diff)
From: Tony Lindgren <tony@atomide.com>
To: Colin King <colin.king@canonical.com>
Cc: Haojian Zhuang <haojian.zhuang@linaro.org>,
	Linus Walleij <linus.walleij@linaro.org>,
	linux-arm-kernel@lists.infradead.org, linux-omap@vger.kernel.org,
	linux-gpio@vger.kernel.org, kernel-janitors@vger.kernel.org,
	linux-kernel@vger.kernel.org
Subject: Re: [PATCH] pinctrl: single: make two arrays static const, reduces object code size
Date: Tue, 19 Sep 2017 09:26:37 -0700	[thread overview]
Message-ID: <20170919162637.GY5024@atomide.com> (raw)
In-Reply-To: <20170919144218.23607-1-colin.king@canonical.com>

* Colin King <colin.king@canonical.com> [170919 07:43]:
> From: Colin Ian King <colin.king@canonical.com>
> 
> Don't populate the read-only arrays prop2 and prop4 on the stack, instead
> make them static const.  Makes the object code smaller by over 230 bytes:
> 
> Before:
>    text	   data	    bss	    dec	    hex	filename
>   28235	   5820	    192	  34247	   85c7	drivers/pinctrl/pinctrl-single.o
> 
> After:
>    text	   data	    bss	    dec	    hex	filename
>   27839	   5980	    192	  34011	   84db	drivers/pinctrl/pinctrl-single.o
> 
> Signed-off-by: Colin Ian King <colin.king@canonical.com>

Acked-by: Tony Lindgren <tony@atomide.com>

> ---
>  drivers/pinctrl/pinctrl-single.c | 4 ++--
>  1 file changed, 2 insertions(+), 2 deletions(-)
> 
> diff --git a/drivers/pinctrl/pinctrl-single.c b/drivers/pinctrl/pinctrl-single.c
> index b8b3d932cd73..e6cd8de793e2 100644
> --- a/drivers/pinctrl/pinctrl-single.c
> +++ b/drivers/pinctrl/pinctrl-single.c
> @@ -873,13 +873,13 @@ static int pcs_parse_pinconf(struct pcs_device *pcs, struct device_node *np,
>  	int i = 0, nconfs = 0;
>  	unsigned long *settings = NULL, *s = NULL;
>  	struct pcs_conf_vals *conf = NULL;
> -	struct pcs_conf_type prop2[] = {
> +	static const struct pcs_conf_type prop2[] = {
>  		{ "pinctrl-single,drive-strength", PIN_CONFIG_DRIVE_STRENGTH, },
>  		{ "pinctrl-single,slew-rate", PIN_CONFIG_SLEW_RATE, },
>  		{ "pinctrl-single,input-schmitt", PIN_CONFIG_INPUT_SCHMITT, },
>  		{ "pinctrl-single,low-power-mode", PIN_CONFIG_LOW_POWER_MODE, },
>  	};
> -	struct pcs_conf_type prop4[] = {
> +	static const struct pcs_conf_type prop4[] = {
>  		{ "pinctrl-single,bias-pullup", PIN_CONFIG_BIAS_PULL_UP, },
>  		{ "pinctrl-single,bias-pulldown", PIN_CONFIG_BIAS_PULL_DOWN, },
>  		{ "pinctrl-single,input-schmitt-enable",
> -- 
> 2.14.1
> 

WARNING: multiple messages have this Message-ID (diff)
From: tony@atomide.com (Tony Lindgren)
To: linux-arm-kernel@lists.infradead.org
Subject: [PATCH] pinctrl: single: make two arrays static const, reduces object code size
Date: Tue, 19 Sep 2017 09:26:37 -0700	[thread overview]
Message-ID: <20170919162637.GY5024@atomide.com> (raw)
In-Reply-To: <20170919144218.23607-1-colin.king@canonical.com>

* Colin King <colin.king@canonical.com> [170919 07:43]:
> From: Colin Ian King <colin.king@canonical.com>
> 
> Don't populate the read-only arrays prop2 and prop4 on the stack, instead
> make them static const.  Makes the object code smaller by over 230 bytes:
> 
> Before:
>    text	   data	    bss	    dec	    hex	filename
>   28235	   5820	    192	  34247	   85c7	drivers/pinctrl/pinctrl-single.o
> 
> After:
>    text	   data	    bss	    dec	    hex	filename
>   27839	   5980	    192	  34011	   84db	drivers/pinctrl/pinctrl-single.o
> 
> Signed-off-by: Colin Ian King <colin.king@canonical.com>

Acked-by: Tony Lindgren <tony@atomide.com>

> ---
>  drivers/pinctrl/pinctrl-single.c | 4 ++--
>  1 file changed, 2 insertions(+), 2 deletions(-)
> 
> diff --git a/drivers/pinctrl/pinctrl-single.c b/drivers/pinctrl/pinctrl-single.c
> index b8b3d932cd73..e6cd8de793e2 100644
> --- a/drivers/pinctrl/pinctrl-single.c
> +++ b/drivers/pinctrl/pinctrl-single.c
> @@ -873,13 +873,13 @@ static int pcs_parse_pinconf(struct pcs_device *pcs, struct device_node *np,
>  	int i = 0, nconfs = 0;
>  	unsigned long *settings = NULL, *s = NULL;
>  	struct pcs_conf_vals *conf = NULL;
> -	struct pcs_conf_type prop2[] = {
> +	static const struct pcs_conf_type prop2[] = {
>  		{ "pinctrl-single,drive-strength", PIN_CONFIG_DRIVE_STRENGTH, },
>  		{ "pinctrl-single,slew-rate", PIN_CONFIG_SLEW_RATE, },
>  		{ "pinctrl-single,input-schmitt", PIN_CONFIG_INPUT_SCHMITT, },
>  		{ "pinctrl-single,low-power-mode", PIN_CONFIG_LOW_POWER_MODE, },
>  	};
> -	struct pcs_conf_type prop4[] = {
> +	static const struct pcs_conf_type prop4[] = {
>  		{ "pinctrl-single,bias-pullup", PIN_CONFIG_BIAS_PULL_UP, },
>  		{ "pinctrl-single,bias-pulldown", PIN_CONFIG_BIAS_PULL_DOWN, },
>  		{ "pinctrl-single,input-schmitt-enable",
> -- 
> 2.14.1
> 

  reply	other threads:[~2017-09-19 16:26 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-09-19 14:42 [PATCH] pinctrl: single: make two arrays static const, reduces object code size Colin King
2017-09-19 14:42 ` Colin King
2017-09-19 14:42 ` Colin King
2017-09-19 16:26 ` Tony Lindgren [this message]
2017-09-19 16:26   ` Tony Lindgren
2017-09-19 16:26   ` Tony Lindgren
2017-09-21 12:10 ` Linus Walleij
2017-09-21 12:10   ` Linus Walleij
2017-09-21 12:10   ` Linus Walleij

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20170919162637.GY5024@atomide.com \
    --to=tony@atomide.com \
    --cc=linux-arm-kernel@lists.infradead.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.