linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] watchdog: asm9260_wdt: make array mode_name static, shrinks object size
@ 2018-11-29 23:25 Colin King
  2018-11-29 23:40 ` Guenter Roeck
  0 siblings, 1 reply; 2+ messages in thread
From: Colin King @ 2018-11-29 23:25 UTC (permalink / raw)
  To: Wim Van Sebroeck, Guenter Roeck, linux-watchdog
  Cc: kernel-janitors, linux-kernel

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

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

Before:
   text	   data	    bss	    dec	    hex	filename
   7699	   1872	      0	   9571	   2563	drivers/watchdog/asm9260_wdt.o

After:
   text	   data	    bss	    dec	    hex	filename
   7594	   1936	      0	   9530	   253a	drivers/watchdog/asm9260_wdt.o

(gcc version 8.2.0 x86_64)

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

diff --git a/drivers/watchdog/asm9260_wdt.c b/drivers/watchdog/asm9260_wdt.c
index 2cf56b459d84..9768e44ffeb8 100644
--- a/drivers/watchdog/asm9260_wdt.c
+++ b/drivers/watchdog/asm9260_wdt.c
@@ -278,7 +278,7 @@ static int asm9260_wdt_probe(struct platform_device *pdev)
 	struct watchdog_device *wdd;
 	struct resource *res;
 	int ret;
-	const char * const mode_name[] = { "hw", "sw", "debug", };
+	static const char * const mode_name[] = { "hw", "sw", "debug", };
 
 	priv = devm_kzalloc(&pdev->dev, sizeof(struct asm9260_wdt_priv),
 			    GFP_KERNEL);
-- 
2.19.1


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

* Re: [PATCH] watchdog: asm9260_wdt: make array mode_name static, shrinks object size
  2018-11-29 23:25 [PATCH] watchdog: asm9260_wdt: make array mode_name static, shrinks object size Colin King
@ 2018-11-29 23:40 ` Guenter Roeck
  0 siblings, 0 replies; 2+ messages in thread
From: Guenter Roeck @ 2018-11-29 23:40 UTC (permalink / raw)
  To: Colin King
  Cc: Wim Van Sebroeck, linux-watchdog, kernel-janitors, linux-kernel

On Thu, Nov 29, 2018 at 11:25:00PM +0000, Colin King wrote:
> From: Colin Ian King <colin.king@canonical.com>
> 
> Don't populate the const array mode_name on the stack but instead
> make it static. Makes the object code smaller by 41 bytes:
> 
> Before:
>    text	   data	    bss	    dec	    hex	filename
>    7699	   1872	      0	   9571	   2563	drivers/watchdog/asm9260_wdt.o
> 
> After:
>    text	   data	    bss	    dec	    hex	filename
>    7594	   1936	      0	   9530	   253a	drivers/watchdog/asm9260_wdt.o
> 
> (gcc version 8.2.0 x86_64)
> 
> Signed-off-by: Colin Ian King <colin.king@canonical.com>

Reviewed-by: Guenter Roeck <linux@roeck-us.net>

> ---
>  drivers/watchdog/asm9260_wdt.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/drivers/watchdog/asm9260_wdt.c b/drivers/watchdog/asm9260_wdt.c
> index 2cf56b459d84..9768e44ffeb8 100644
> --- a/drivers/watchdog/asm9260_wdt.c
> +++ b/drivers/watchdog/asm9260_wdt.c
> @@ -278,7 +278,7 @@ static int asm9260_wdt_probe(struct platform_device *pdev)
>  	struct watchdog_device *wdd;
>  	struct resource *res;
>  	int ret;
> -	const char * const mode_name[] = { "hw", "sw", "debug", };
> +	static const char * const mode_name[] = { "hw", "sw", "debug", };
>  
>  	priv = devm_kzalloc(&pdev->dev, sizeof(struct asm9260_wdt_priv),
>  			    GFP_KERNEL);
> -- 
> 2.19.1
> 

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

end of thread, other threads:[~2018-11-29 23:40 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-11-29 23:25 [PATCH] watchdog: asm9260_wdt: make array mode_name static, shrinks object size Colin King
2018-11-29 23:40 ` Guenter Roeck

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