Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

HID: prodikeys: make array keys static const, makes object smaller

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 <colin.king@canonical.com>
Signed-off-by: Jiri Kosina <jkosina@suse.cz>

authored by

Colin Ian King and committed by
Jiri Kosina
fe2199cf b3a81c77

+2 -2
+2 -2
drivers/hid/hid-prodikeys.c
··· 516 516 MY PICTURES => KEY_WORDPROCESSOR 517 517 MY MUSIC=> KEY_SPREADSHEET 518 518 */ 519 - unsigned int keys[] = { 519 + static const unsigned int keys[] = { 520 520 KEY_FN, 521 521 KEY_MESSENGER, KEY_CALENDAR, 522 522 KEY_ADDRESSBOOK, KEY_DOCUMENTS, ··· 532 532 0 533 533 }; 534 534 535 - unsigned int *pkeys = &keys[0]; 535 + const unsigned int *pkeys = &keys[0]; 536 536 unsigned short i; 537 537 538 538 if (pm->ifnum != 1) /* only set up ONCE for interace 1 */