* [PATCH][V3] libata: make static arrays const, reduces object code size
@ 2017-09-19 8:39 Colin King
2017-09-19 18:54 ` Tejun Heo
0 siblings, 1 reply; 2+ messages in thread
From: Colin King @ 2017-09-19 8:39 UTC (permalink / raw)
To: Tejun Heo, linux-ide; +Cc: kernel-janitors, linux-kernel
From: Colin Ian King <colin.king@canonical.com>
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: Colin Ian King <colin.king@canonical.com>
---
drivers/ata/libata-scsi.c | 10 +++++-----
1 file changed, 5 insertions(+), 5 deletions(-)
diff --git a/drivers/ata/libata-scsi.c b/drivers/ata/libata-scsi.c
index 44ba292f2cd7..c3c483fc2145 100644
--- a/drivers/ata/libata-scsi.c
+++ b/drivers/ata/libata-scsi.c
@@ -2145,7 +2145,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)
{
- const u8 versions[] = {
+ static const u8 versions[] = {
0x00,
0x60, /* SAM-3 (no version claimed) */
@@ -2155,7 +2155,7 @@ static unsigned int ata_scsiop_inq_std(struct ata_scsi_args *args, u8 *rbuf)
0x03,
0x00 /* SPC-3 (no version claimed) */
};
- const u8 versions_zbc[] = {
+ static const u8 versions_zbc[] = {
0x00,
0xA0, /* SAM-5 (no version claimed) */
@@ -2227,7 +2227,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)
{
int num_pages;
- const u8 pages[] = {
+ static const u8 pages[] = {
0x00, /* page 0x00, this page */
0x80, /* page 0x80, unit serial no page */
0x83, /* page 0x83, device ident page */
@@ -2258,7 +2258,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)
{
- const u8 hdr[] = {
+ static const u8 hdr[] = {
0,
0x80, /* this page code */
0,
@@ -2580,7 +2580,7 @@ static unsigned int ata_scsiop_mode_sense(struct ata_scsi_args *args, u8 *rbuf)
{
struct ata_device *dev = args->dev;
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, 0x2, 0x0 /* block length: 512 bytes */
--
2.14.1
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: [PATCH][V3] libata: make static arrays const, reduces object code size
2017-09-19 8:39 [PATCH][V3] libata: make static arrays const, reduces object code size Colin King
@ 2017-09-19 18:54 ` Tejun Heo
0 siblings, 0 replies; 2+ messages in thread
From: Tejun Heo @ 2017-09-19 18:54 UTC (permalink / raw)
To: Colin King; +Cc: linux-ide, kernel-janitors, linux-kernel
On Tue, Sep 19, 2017 at 09:39:52AM +0100, Colin King wrote:
> From: Colin Ian King <colin.king@canonical.com>
>
> 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: Colin Ian King <colin.king@canonical.com>
Applied to libata/for-4.15.
Thanks.
--
tejun
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2017-09-19 18:54 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2017-09-19 8:39 [PATCH][V3] libata: make static arrays const, reduces object code size Colin King
2017-09-19 18:54 ` Tejun Heo
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).