Skip to content

Commit

Permalink
HID: asus: make array 'buf' static const
Browse files Browse the repository at this point in the history
Don't populate the const read-only array 'buf' on the stack but instead
make it static. Makes the object code smaller by 26 bytes:

Before:
   text	   data	    bss	    dec	    hex	filename
  14378	   2384	     64	  16826	   41ba	linux/drivers/hid/hid-asus.o

After:
   text	   data	    bss	    dec	    hex	filename
  14296	   2440	     64	  16800	   41a0	linux/drivers/hid/hid-asus.o

(gcc version 7.2.0 x86_64)

[jkosina@suse.cz: change commit message slightly]
Signed-off-by: Colin Ian King <colin.king@canonical.com>
Signed-off-by: Jiri Kosina <jkosina@suse.cz>
  • Loading branch information
Colin Ian King authored and Jiri Kosina committed Feb 16, 2018
1 parent 183b636 commit b9ec700
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion drivers/hid/hid-asus.c
Original file line number Diff line number Diff line change
Expand Up @@ -570,7 +570,9 @@ static int asus_input_mapping(struct hid_device *hdev,
static int asus_start_multitouch(struct hid_device *hdev)
{
int ret;
const unsigned char buf[] = { FEATURE_REPORT_ID, 0x00, 0x03, 0x01, 0x00 };
static const unsigned char buf[] = {
FEATURE_REPORT_ID, 0x00, 0x03, 0x01, 0x00
};
unsigned char *dmabuf = kmemdup(buf, sizeof(buf), GFP_KERNEL);

if (!dmabuf) {
Expand Down

0 comments on commit b9ec700

Please sign in to comment.