Skip to content

Commit

Permalink
HID: prodikeys: make array keys static const, makes object smaller
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
Colin Ian King authored and Jiri Kosina committed Oct 1, 2019
1 parent b3a81c7 commit fe2199c
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions drivers/hid/hid-prodikeys.c
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand All @@ -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 */
Expand Down

0 comments on commit fe2199c

Please sign in to comment.