All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] HID: lg-g15: make a const array static, makes object smaller
@ 2021-02-04 17:27 ` Colin King
  0 siblings, 0 replies; 4+ messages in thread
From: Colin King @ 2021-02-04 17:27 UTC (permalink / raw)
  To: Hans de Goede, Jiri Kosina, Benjamin Tissoires, linux-input
  Cc: kernel-janitors, linux-kernel

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

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

Before:
   text	   data	    bss	    dec	    hex	filename
  19686	   7952	    256	  27894	   6cf6	drivers/hid/hid-lg-g15.o

After:
   text	   data	    bss	    dec	    hex	filename
  19543	   8016	    256	  27815	   6ca7	drivers/hid/hid-lg-g15.o

(gcc version 10.2.0)

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

diff --git a/drivers/hid/hid-lg-g15.c b/drivers/hid/hid-lg-g15.c
index fcaf8466e627..bfbba0d41933 100644
--- a/drivers/hid/hid-lg-g15.c
+++ b/drivers/hid/hid-lg-g15.c
@@ -647,7 +647,7 @@ static void lg_g15_input_close(struct input_dev *dev)
 
 static int lg_g15_register_led(struct lg_g15_data *g15, int i)
 {
-	const char * const led_names[] = {
+	static const char * const led_names[] = {
 		"g15::kbd_backlight",
 		"g15::lcd_backlight",
 		"g15::macro_preset1",
-- 
2.29.2


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

* [PATCH] HID: lg-g15: make a const array static, makes object smaller
@ 2021-02-04 17:27 ` Colin King
  0 siblings, 0 replies; 4+ messages in thread
From: Colin King @ 2021-02-04 17:27 UTC (permalink / raw)
  To: Hans de Goede, Jiri Kosina, Benjamin Tissoires, linux-input
  Cc: kernel-janitors, linux-kernel

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

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

Before:
   text	   data	    bss	    dec	    hex	filename
  19686	   7952	    256	  27894	   6cf6	drivers/hid/hid-lg-g15.o

After:
   text	   data	    bss	    dec	    hex	filename
  19543	   8016	    256	  27815	   6ca7	drivers/hid/hid-lg-g15.o

(gcc version 10.2.0)

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

diff --git a/drivers/hid/hid-lg-g15.c b/drivers/hid/hid-lg-g15.c
index fcaf8466e627..bfbba0d41933 100644
--- a/drivers/hid/hid-lg-g15.c
+++ b/drivers/hid/hid-lg-g15.c
@@ -647,7 +647,7 @@ static void lg_g15_input_close(struct input_dev *dev)
 
 static int lg_g15_register_led(struct lg_g15_data *g15, int i)
 {
-	const char * const led_names[] = {
+	static const char * const led_names[] = {
 		"g15::kbd_backlight",
 		"g15::lcd_backlight",
 		"g15::macro_preset1",
-- 
2.29.2

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

* Re: [PATCH] HID: lg-g15: make a const array static, makes object smaller
  2021-02-04 17:27 ` Colin King
@ 2021-02-05  9:13   ` Jiri Kosina
  -1 siblings, 0 replies; 4+ messages in thread
From: Jiri Kosina @ 2021-02-05  9:13 UTC (permalink / raw)
  To: Colin King
  Cc: Hans de Goede, Benjamin Tissoires, linux-input, kernel-janitors,
	linux-kernel

On Thu, 4 Feb 2021, Colin King wrote:

> From: Colin Ian King <colin.king@canonical.com>
> 
> Don't populate the const array led_names on the stack but instead make
> it static. Makes the object code smaller by 79 bytes:
> 
> Before:
>    text	   data	    bss	    dec	    hex	filename
>   19686	   7952	    256	  27894	   6cf6	drivers/hid/hid-lg-g15.o
> 
> After:
>    text	   data	    bss	    dec	    hex	filename
>   19543	   8016	    256	  27815	   6ca7	drivers/hid/hid-lg-g15.o
> 
> (gcc version 10.2.0)
> 
> Signed-off-by: Colin Ian King <colin.king@canonical.com>

Applied.

-- 
Jiri Kosina
SUSE Labs


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

* Re: [PATCH] HID: lg-g15: make a const array static, makes object smaller
@ 2021-02-05  9:13   ` Jiri Kosina
  0 siblings, 0 replies; 4+ messages in thread
From: Jiri Kosina @ 2021-02-05  9:13 UTC (permalink / raw)
  To: Colin King
  Cc: Hans de Goede, Benjamin Tissoires, linux-input, kernel-janitors,
	linux-kernel

On Thu, 4 Feb 2021, Colin King wrote:

> From: Colin Ian King <colin.king@canonical.com>
> 
> Don't populate the const array led_names on the stack but instead make
> it static. Makes the object code smaller by 79 bytes:
> 
> Before:
>    text	   data	    bss	    dec	    hex	filename
>   19686	   7952	    256	  27894	   6cf6	drivers/hid/hid-lg-g15.o
> 
> After:
>    text	   data	    bss	    dec	    hex	filename
>   19543	   8016	    256	  27815	   6ca7	drivers/hid/hid-lg-g15.o
> 
> (gcc version 10.2.0)
> 
> Signed-off-by: Colin Ian King <colin.king@canonical.com>

Applied.

-- 
Jiri Kosina
SUSE Labs

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

end of thread, other threads:[~2021-02-05  9:18 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-02-04 17:27 [PATCH] HID: lg-g15: make a const array static, makes object smaller Colin King
2021-02-04 17:27 ` Colin King
2021-02-05  9:13 ` Jiri Kosina
2021-02-05  9:13   ` Jiri Kosina

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.