HID: prodikeys: make array keys static const, makes object smaller
Subsystems (2)
PATCH 1/1 HID: prodikeys: make array keys static const, makes object smaller
From: Colin Ian King <[email protected]>
Don't populate the array keys on the stack but instead make it static const. Makes the object code smaller by 166 bytes.
Before:
text data bss dec hex filename 18931 5872 480 25283 62c3 drivers/hid/hid-prodikeys.o
After:
text data bss dec hex filename 18669 5968 480 25117 621d drivers/hid/hid-prodikeys.o
(gcc version 9.2.1, amd64)
Signed-off-by Colin Ian King <[email protected]>
--- drivers/hid/hid-prodikeys.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/hid/hid-prodikeys.c +2 -2
@@ -516,7 +516,7 @@ static void pcmidi_setup_extra_keys(MY PICTURES => KEY_WORDPROCESSOR MY MUSIC=> KEY_SPREADSHEET */ -unsigned int keys[] = { +static const unsigned int keys[] = {KEY_FN ,KEY_MESSENGER ,KEY_CALENDAR ,KEY_ADDRESSBOOK ,KEY_DOCUMENTS ,
@@ -532,7 +532,7 @@ static void pcmidi_setup_extra_keys( 0 }; -unsigned int *pkeys = &keys[0 ]; +const unsigned int *pkeys = &keys[0 ];unsigned short i;if (pm->ifnum !=1 )/* only set up ONCE for interace 1 */
Signature · 1 line
2.20.1
Quoted 34 lines · Colin King
From: Colin Ian King <[email protected]>
Don't populate the array keys on the stack but instead make it static const. Makes the object code smaller by 166 bytes.
Before:
text data bss dec hex filename 18931 5872 480 25283 62c3 drivers/hid/hid-prodikeys.oAfter:
text data bss dec hex filename 18669 5968 480 25117 621d drivers/hid/hid-prodikeys.o(gcc version 9.2.1, amd64)
Signed-off-by Colin Ian King <[email protected]>--- drivers/hid/hid-prodikeys.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)drivers/hid/hid-prodikeys.c +1
-1@@ -516,7 +516,7 @@ static void pcmidi_setup_extra_keys(MY PICTURES => KEY_WORDPROCESSOR MY MUSIC=> KEY_SPREADSHEET */ -unsigned int keys[] = { +static const unsigned int keys[] = {KEY_FN ,KEY_MESSENGER ,KEY_CALENDAR ,KEY_ADDRESSBOOK ,KEY_DOCUMENTS ,
drivers/hid/hid-prodikeys.c static void pcmidi_setup_extra_keys( · line 536
Quoted 6 lines
drivers/hid/hid-prodikeys.c +1
-1@@ -532,7 +532,7 @@ static void pcmidi_setup_extra_keys( 0 }; -unsigned int *pkeys = &keys[0 ]; +const unsigned int *pkeys = &keys[0 ];unsigned short i;
Applied, thanks for the fix.
Signature · 2 lines
Jiri Kosina SUSE Labs