Skip to content

Commit

Permalink
usb: storage: make const arrays static, reduces object code size
Browse files Browse the repository at this point in the history
Don't populate const arrays on the stack, instead make them
static.  Makes the object code smaller by over 1070 bytes:

Before:
   text	   data	    bss	    dec	    hex	filename
   3505	    880	      0	   4385	   1121	drivers/usb/storage/option_ms.o

After:
   text	   data	    bss	    dec	    hex	filename
   2269	   1040	      0	   3309	    ced	drivers/usb/storage/option_ms.o

Signed-off-by: Colin Ian King <colin.king@canonical.com>
Acked-by: Alan Stern <stern@rowland.harvard.edu>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
  • Loading branch information
Colin Ian King authored and Greg Kroah-Hartman committed Sep 18, 2017
1 parent 4c87b3e commit 38502ef
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions drivers/usb/storage/option_ms.c
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ MODULE_PARM_DESC(option_zero_cd, "ZeroCD mode (1=Force Modem (default),"

static int option_rezero(struct us_data *us)
{
const unsigned char rezero_msg[] = {
static const unsigned char rezero_msg[] = {
0x55, 0x53, 0x42, 0x43, 0x78, 0x56, 0x34, 0x12,
0x01, 0x00, 0x00, 0x00, 0x80, 0x00, 0x06, 0x01,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
Expand Down Expand Up @@ -87,7 +87,7 @@ static int option_rezero(struct us_data *us)

static int option_inquiry(struct us_data *us)
{
const unsigned char inquiry_msg[] = {
static const unsigned char inquiry_msg[] = {
0x55, 0x53, 0x42, 0x43, 0x12, 0x34, 0x56, 0x78,
0x24, 0x00, 0x00, 0x00, 0x80, 0x00, 0x06, 0x12,
0x00, 0x00, 0x00, 0x24, 0x00, 0x00, 0x00, 0x00,
Expand Down

0 comments on commit 38502ef

Please sign in to comment.