linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] HID: logitech-dj: make const array template static
@ 2019-05-10 13:10 Colin King
  2019-05-22 11:19 ` Jiri Kosina
  0 siblings, 1 reply; 2+ messages in thread
From: Colin King @ 2019-05-10 13:10 UTC (permalink / raw)
  To: Jiri Kosina, Benjamin Tissoires, linux-input
  Cc: kernel-janitors, linux-kernel

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

Don't populate the array template  on the stack but instead make it
static. Makes the object code smaller by 10 bytes. Also reformat
the declaration.

Before:
   text	   data	    bss	    dec	    hex	filename
  29376	   9360	    128	  38864	   97d0	drivers/hid/hid-logitech-dj.o

After:
   text	   data	    bss	    dec	    hex	filename
  29270	   9456	    128	  38854	   97c6	drivers/hid/hid-logitech-dj.o

(gcc version 8.3.0, amd64)

Signed-off-by: Colin Ian King <colin.king@canonical.com>
---
 drivers/hid/hid-logitech-dj.c | 14 ++++++++------
 1 file changed, 8 insertions(+), 6 deletions(-)

diff --git a/drivers/hid/hid-logitech-dj.c b/drivers/hid/hid-logitech-dj.c
index b1e894618eed..72d0ab05401f 100644
--- a/drivers/hid/hid-logitech-dj.c
+++ b/drivers/hid/hid-logitech-dj.c
@@ -1111,12 +1111,14 @@ static int logi_dj_recv_send_report(struct dj_receiver_dev *djrcv_dev,
 
 static int logi_dj_recv_query_hidpp_devices(struct dj_receiver_dev *djrcv_dev)
 {
-	const u8 template[] = {REPORT_ID_HIDPP_SHORT,
-			       HIDPP_RECEIVER_INDEX,
-			       HIDPP_SET_REGISTER,
-			       HIDPP_REG_CONNECTION_STATE,
-			       HIDPP_FAKE_DEVICE_ARRIVAL,
-			       0x00, 0x00};
+	static const u8 template[] = {
+		REPORT_ID_HIDPP_SHORT,
+		HIDPP_RECEIVER_INDEX,
+		HIDPP_SET_REGISTER,
+		HIDPP_REG_CONNECTION_STATE,
+		HIDPP_FAKE_DEVICE_ARRIVAL,
+		0x00, 0x00
+	};
 	u8 *hidpp_report;
 	int retval;
 
-- 
2.20.1


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

* Re: [PATCH] HID: logitech-dj: make const array template static
  2019-05-10 13:10 [PATCH] HID: logitech-dj: make const array template static Colin King
@ 2019-05-22 11:19 ` Jiri Kosina
  0 siblings, 0 replies; 2+ messages in thread
From: Jiri Kosina @ 2019-05-22 11:19 UTC (permalink / raw)
  To: Colin King; +Cc: Benjamin Tissoires, linux-input, kernel-janitors, linux-kernel

On Fri, 10 May 2019, Colin King wrote:

> From: Colin Ian King <colin.king@canonical.com>
> 
> Don't populate the array template  on the stack but instead make it
> static. Makes the object code smaller by 10 bytes. Also reformat
> the declaration.
> 
> Before:
>    text	   data	    bss	    dec	    hex	filename
>   29376	   9360	    128	  38864	   97d0	drivers/hid/hid-logitech-dj.o
> 
> After:
>    text	   data	    bss	    dec	    hex	filename
>   29270	   9456	    128	  38854	   97c6	drivers/hid/hid-logitech-dj.o
> 
> (gcc version 8.3.0, amd64)
> 
> Signed-off-by: Colin Ian King <colin.king@canonical.com>
> ---
>  drivers/hid/hid-logitech-dj.c | 14 ++++++++------
>  1 file changed, 8 insertions(+), 6 deletions(-)
> 
> diff --git a/drivers/hid/hid-logitech-dj.c b/drivers/hid/hid-logitech-dj.c
> index b1e894618eed..72d0ab05401f 100644
> --- a/drivers/hid/hid-logitech-dj.c
> +++ b/drivers/hid/hid-logitech-dj.c
> @@ -1111,12 +1111,14 @@ static int logi_dj_recv_send_report(struct dj_receiver_dev *djrcv_dev,
>  
>  static int logi_dj_recv_query_hidpp_devices(struct dj_receiver_dev *djrcv_dev)
>  {
> -	const u8 template[] = {REPORT_ID_HIDPP_SHORT,
> -			       HIDPP_RECEIVER_INDEX,
> -			       HIDPP_SET_REGISTER,
> -			       HIDPP_REG_CONNECTION_STATE,
> -			       HIDPP_FAKE_DEVICE_ARRIVAL,
> -			       0x00, 0x00};
> +	static const u8 template[] = {
> +		REPORT_ID_HIDPP_SHORT,
> +		HIDPP_RECEIVER_INDEX,
> +		HIDPP_SET_REGISTER,
> +		HIDPP_REG_CONNECTION_STATE,
> +		HIDPP_FAKE_DEVICE_ARRIVAL,
> +		0x00, 0x00
> +	};

Applied.

-- 
Jiri Kosina
SUSE Labs


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

end of thread, other threads:[~2019-05-22 11:19 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-05-10 13:10 [PATCH] HID: logitech-dj: make const array template static Colin King
2019-05-22 11:19 ` Jiri Kosina

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