Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1727244 > unrolled thread

[PATCH] libata: zpodd: make arrays cdb static, reduces object code size

Started byColin King <colin.king@canonical.com>
First post2017-09-06 11:00 +0200
Last post2017-09-06 16:50 +0200
Articles 2 — 2 participants

Back to article view | Back to linux.kernel


Contents

  [PATCH] libata: zpodd: make arrays cdb static, reduces object code size Colin King <colin.king@canonical.com> - 2017-09-06 11:00 +0200
    Re: [PATCH] libata: zpodd: make arrays cdb static, reduces object  code size Tejun Heo <tj@kernel.org> - 2017-09-06 16:50 +0200

#1727244 — [PATCH] libata: zpodd: make arrays cdb static, reduces object code size

FromColin King <colin.king@canonical.com>
Date2017-09-06 11:00 +0200
Subject[PATCH] libata: zpodd: make arrays cdb static, reduces object code size
Message-ID<umElH-7Em-5@gated-at.bofh.it>
From: Colin Ian King <colin.king@canonical.com>

Don't populate the arrays cdb on the stack, instead make them static.
Makes the object code smaller by 230 bytes:

Before:
   text	   data	    bss	    dec	    hex	filename
   3797	    240	      0	   4037	    fc5	drivers/ata/libata-zpodd.o

After:
   text	   data	    bss	    dec	    hex	filename
   3407	    400	      0	   3807	    edf	drivers/ata/libata-zpodd.o

Signed-off-by: Colin Ian King <colin.king@canonical.com>
---
 drivers/ata/libata-zpodd.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/ata/libata-zpodd.c b/drivers/ata/libata-zpodd.c
index 8a01d09ac4db..23a62e4015d0 100644
--- a/drivers/ata/libata-zpodd.c
+++ b/drivers/ata/libata-zpodd.c
@@ -34,7 +34,7 @@ struct zpodd {
 static int eject_tray(struct ata_device *dev)
 {
 	struct ata_taskfile tf;
-	const char cdb[] = {  GPCMD_START_STOP_UNIT,
+	static const char cdb[] = {  GPCMD_START_STOP_UNIT,
 		0, 0, 0,
 		0x02,     /* LoEj */
 		0, 0, 0, 0, 0, 0, 0,
@@ -55,7 +55,7 @@ static enum odd_mech_type zpodd_get_mech_type(struct ata_device *dev)
 	unsigned int ret;
 	struct rm_feature_desc *desc = (void *)(buf + 8);
 	struct ata_taskfile tf;
-	char cdb[] = {  GPCMD_GET_CONFIGURATION,
+	static const char cdb[] = {  GPCMD_GET_CONFIGURATION,
 			2,      /* only 1 feature descriptor requested */
 			0, 3,   /* 3, removable medium feature */
 			0, 0, 0,/* reserved */
-- 
2.14.1

[toc] | [next] | [standalone]


#1727555 — Re: [PATCH] libata: zpodd: make arrays cdb static, reduces object code size

FromTejun Heo <tj@kernel.org>
Date2017-09-06 16:50 +0200
SubjectRe: [PATCH] libata: zpodd: make arrays cdb static, reduces object code size
Message-ID<umJOp-36w-1@gated-at.bofh.it>
In reply to#1727244
On Wed, Sep 06, 2017 at 09:56:29AM +0100, Colin King wrote:
> From: Colin Ian King <colin.king@canonical.com>
> 
> Don't populate the arrays cdb on the stack, instead make them static.
> Makes the object code smaller by 230 bytes:
> 
> Before:
>    text	   data	    bss	    dec	    hex	filename
>    3797	    240	      0	   4037	    fc5	drivers/ata/libata-zpodd.o
> 
> After:
>    text	   data	    bss	    dec	    hex	filename
>    3407	    400	      0	   3807	    edf	drivers/ata/libata-zpodd.o
> 
> Signed-off-by: Colin Ian King <colin.king@canonical.com>

Applied to libata/for-4.14.

Thanks.

-- 
tejun

[toc] | [prev] | [standalone]


Back to top | Article view | linux.kernel


csiph-web