Commit e94f7914 authored by Colin Ian King's avatar Colin Ian King Committed by Tejun Heo

libata: make static arrays const, reduces object code size

Don't populate const arrayis on the stack, instead make them static.
Makes the object code smaller by over 260 bytes:

Before:
   text	   data	    bss	    dec	    hex	filename
  64864	   5948	   4128	  74940	  124bc	drivers/ata/libata-scsi.o

After:
   text	   data	    bss	    dec	    hex	filename
  64183	   6364	   4128	  74675	  123b3	drivers/ata/libata-scsi.o
Signed-off-by: default avatarColin Ian King <colin.king@canonical.com>
Signed-off-by: default avatarTejun Heo <tj@kernel.org>
parent 01bb12e4
...@@ -2146,7 +2146,7 @@ static void ata_scsi_rbuf_fill(struct ata_scsi_args *args, ...@@ -2146,7 +2146,7 @@ static void ata_scsi_rbuf_fill(struct ata_scsi_args *args,
*/ */
static unsigned int ata_scsiop_inq_std(struct ata_scsi_args *args, u8 *rbuf) static unsigned int ata_scsiop_inq_std(struct ata_scsi_args *args, u8 *rbuf)
{ {
const u8 versions[] = { static const u8 versions[] = {
0x00, 0x00,
0x60, /* SAM-3 (no version claimed) */ 0x60, /* SAM-3 (no version claimed) */
...@@ -2156,7 +2156,7 @@ static unsigned int ata_scsiop_inq_std(struct ata_scsi_args *args, u8 *rbuf) ...@@ -2156,7 +2156,7 @@ static unsigned int ata_scsiop_inq_std(struct ata_scsi_args *args, u8 *rbuf)
0x03, 0x03,
0x00 /* SPC-3 (no version claimed) */ 0x00 /* SPC-3 (no version claimed) */
}; };
const u8 versions_zbc[] = { static const u8 versions_zbc[] = {
0x00, 0x00,
0xA0, /* SAM-5 (no version claimed) */ 0xA0, /* SAM-5 (no version claimed) */
...@@ -2228,7 +2228,7 @@ static unsigned int ata_scsiop_inq_std(struct ata_scsi_args *args, u8 *rbuf) ...@@ -2228,7 +2228,7 @@ static unsigned int ata_scsiop_inq_std(struct ata_scsi_args *args, u8 *rbuf)
static unsigned int ata_scsiop_inq_00(struct ata_scsi_args *args, u8 *rbuf) static unsigned int ata_scsiop_inq_00(struct ata_scsi_args *args, u8 *rbuf)
{ {
int num_pages; int num_pages;
const u8 pages[] = { static const u8 pages[] = {
0x00, /* page 0x00, this page */ 0x00, /* page 0x00, this page */
0x80, /* page 0x80, unit serial no page */ 0x80, /* page 0x80, unit serial no page */
0x83, /* page 0x83, device ident page */ 0x83, /* page 0x83, device ident page */
...@@ -2259,7 +2259,7 @@ static unsigned int ata_scsiop_inq_00(struct ata_scsi_args *args, u8 *rbuf) ...@@ -2259,7 +2259,7 @@ static unsigned int ata_scsiop_inq_00(struct ata_scsi_args *args, u8 *rbuf)
*/ */
static unsigned int ata_scsiop_inq_80(struct ata_scsi_args *args, u8 *rbuf) static unsigned int ata_scsiop_inq_80(struct ata_scsi_args *args, u8 *rbuf)
{ {
const u8 hdr[] = { static const u8 hdr[] = {
0, 0,
0x80, /* this page code */ 0x80, /* this page code */
0, 0,
...@@ -2581,7 +2581,7 @@ static unsigned int ata_scsiop_mode_sense(struct ata_scsi_args *args, u8 *rbuf) ...@@ -2581,7 +2581,7 @@ static unsigned int ata_scsiop_mode_sense(struct ata_scsi_args *args, u8 *rbuf)
{ {
struct ata_device *dev = args->dev; struct ata_device *dev = args->dev;
u8 *scsicmd = args->cmd->cmnd, *p = rbuf; u8 *scsicmd = args->cmd->cmnd, *p = rbuf;
const u8 sat_blk_desc[] = { static const u8 sat_blk_desc[] = {
0, 0, 0, 0, /* number of blocks: sat unspecified */ 0, 0, 0, 0, /* number of blocks: sat unspecified */
0, 0,
0, 0x2, 0x0 /* block length: 512 bytes */ 0, 0x2, 0x0 /* block length: 512 bytes */
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment