* [PATCH][next] HID: asus: make array 'buf' static const, shrinks object size
@ 2018-01-06 15:50 Colin King
2018-02-16 12:35 ` Jiri Kosina
0 siblings, 1 reply; 2+ messages in thread
From: Colin King @ 2018-01-06 15:50 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 const read-only array 'buf' on the stack but instead
make it stati. 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)
Signed-off-by: Colin Ian King <colin.king@canonical.com>
---
drivers/hid/hid-asus.c | 4 +++-
1 file changed, 3 insertions(+), 1 deletion(-)
diff --git a/drivers/hid/hid-asus.c b/drivers/hid/hid-asus.c
index 6d2894b7d8e7..89d29f323366 100644
--- a/drivers/hid/hid-asus.c
+++ b/drivers/hid/hid-asus.c
@@ -561,7 +561,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) {
--
2.15.1
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: [PATCH][next] HID: asus: make array 'buf' static const, shrinks object size
2018-01-06 15:50 [PATCH][next] HID: asus: make array 'buf' static const, shrinks object size Colin King
@ 2018-02-16 12:35 ` Jiri Kosina
0 siblings, 0 replies; 2+ messages in thread
From: Jiri Kosina @ 2018-02-16 12:35 UTC (permalink / raw)
To: Colin King; +Cc: Benjamin Tissoires, linux-input, kernel-janitors, linux-kernel
On Sat, 6 Jan 2018, Colin King wrote:
> From: Colin Ian King <colin.king@canonical.com>
>
> Don't populate the const read-only array 'buf' on the stack but instead
> make it stati. 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)
>
> Signed-off-by: Colin Ian King <colin.king@canonical.com>
Applied to for-4.17/upstream.
--
Jiri Kosina
SUSE Labs
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2018-02-16 12:35 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-01-06 15:50 [PATCH][next] HID: asus: make array 'buf' static const, shrinks object size Colin King
2018-02-16 12:35 ` 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).