kernel-janitors.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] rsi: make array fsm_state static const, makes object smaller
@ 2021-08-19 12:50 Colin King
  2021-08-21  6:38 ` Joe Perches
  2021-08-29  8:32 ` Kalle Valo
  0 siblings, 2 replies; 3+ messages in thread
From: Colin King @ 2021-08-19 12:50 UTC (permalink / raw)
  To: Amitkumar Karwar, Siva Rebbagondla, Kalle Valo, David S . Miller,
	Jakub Kicinski, linux-wireless, netdev
  Cc: kernel-janitors, linux-kernel

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

Don't populate the array fsm_state on the stack but instead it
static const. Makes the object code smaller by 154 bytes:

Before:
   text	   data	    bss	    dec	    hex	filename
   9213	   3904	      0	  13117	   333d	.../wireless/rsi/rsi_91x_debugfs.o

After:
   text	   data	    bss	    dec	    hex	filename
   8995	   3968	      0	  12963	   32a3	.../wireless/rsi/rsi_91x_debugfs.o

(gcc version 10.3.0)

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

diff --git a/drivers/net/wireless/rsi/rsi_91x_debugfs.c b/drivers/net/wireless/rsi/rsi_91x_debugfs.c
index 24a417ea2ae7..f404ca4c38e8 100644
--- a/drivers/net/wireless/rsi/rsi_91x_debugfs.c
+++ b/drivers/net/wireless/rsi/rsi_91x_debugfs.c
@@ -117,7 +117,7 @@ static int rsi_stats_read(struct seq_file *seq, void *data)
 {
 	struct rsi_common *common = seq->private;
 
-	unsigned char fsm_state[][32] = {
+	static const unsigned char fsm_state[][32] = {
 		"FSM_FW_NOT_LOADED",
 		"FSM_CARD_NOT_READY",
 		"FSM_COMMON_DEV_PARAMS_SENT",
-- 
2.32.0


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

* Re: [PATCH] rsi: make array fsm_state static const, makes object smaller
  2021-08-19 12:50 [PATCH] rsi: make array fsm_state static const, makes object smaller Colin King
@ 2021-08-21  6:38 ` Joe Perches
  2021-08-29  8:32 ` Kalle Valo
  1 sibling, 0 replies; 3+ messages in thread
From: Joe Perches @ 2021-08-21  6:38 UTC (permalink / raw)
  To: Colin King, Amitkumar Karwar, Siva Rebbagondla, Kalle Valo,
	David S . Miller, Jakub Kicinski, linux-wireless, netdev
  Cc: kernel-janitors, linux-kernel

On Thu, 2021-08-19 at 13:50 +0100, Colin King wrote:
> From: Colin Ian King <colin.king@canonical.com>
> 
> Don't populate the array fsm_state on the stack but instead it
> static const. Makes the object code smaller by 154 bytes:
[]
> diff --git a/drivers/net/wireless/rsi/rsi_91x_debugfs.c b/drivers/net/wireless/rsi/rsi_91x_debugfs.c
[]
> @@ -117,7 +117,7 @@ static int rsi_stats_read(struct seq_file *seq, void *data)
>  {
>  	struct rsi_common *common = seq->private;
>  
> -	unsigned char fsm_state[][32] = {
> +	static const unsigned char fsm_state[][32] = {

why not the even smaller with a defconfig

	static const char * const fsm_state[] = {

>  		"FSM_FW_NOT_LOADED",
>  		"FSM_CARD_NOT_READY",
>  		"FSM_COMMON_DEV_PARAMS_SENT",



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

* Re: [PATCH] rsi: make array fsm_state static const, makes object smaller
  2021-08-19 12:50 [PATCH] rsi: make array fsm_state static const, makes object smaller Colin King
  2021-08-21  6:38 ` Joe Perches
@ 2021-08-29  8:32 ` Kalle Valo
  1 sibling, 0 replies; 3+ messages in thread
From: Kalle Valo @ 2021-08-29  8:32 UTC (permalink / raw)
  To: Colin King
  Cc: Amitkumar Karwar, Siva Rebbagondla, David S . Miller,
	Jakub Kicinski, linux-wireless, netdev, kernel-janitors,
	linux-kernel

Colin King <colin.king@canonical.com> wrote:

> From: Colin Ian King <colin.king@canonical.com>
> 
> Don't populate the array fsm_state on the stack but instead it
> static const. Makes the object code smaller by 154 bytes:
> 
> Before:
>    text	   data	    bss	    dec	    hex	filename
>    9213	   3904	      0	  13117	   333d	.../wireless/rsi/rsi_91x_debugfs.o
> 
> After:
>    text	   data	    bss	    dec	    hex	filename
>    8995	   3968	      0	  12963	   32a3	.../wireless/rsi/rsi_91x_debugfs.o
> 
> (gcc version 10.3.0)
> 
> Signed-off-by: Colin Ian King <colin.king@canonical.com>

Patch applied to wireless-drivers-next.git, thanks.

f4c813641897 rsi: make array fsm_state static const, makes object smaller

-- 
https://patchwork.kernel.org/project/linux-wireless/patch/20210819125018.8577-1-colin.king@canonical.com/

https://wireless.wiki.kernel.org/en/developers/documentation/submittingpatches


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

end of thread, other threads:[~2021-08-29  8:32 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-08-19 12:50 [PATCH] rsi: make array fsm_state static const, makes object smaller Colin King
2021-08-21  6:38 ` Joe Perches
2021-08-29  8:32 ` Kalle Valo

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).