kernel-janitors.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] scsi: wd719x: make card_types static const, shrinks object size
@ 2017-11-28 18:12 Colin King
  2017-11-29  5:12 ` Martin K. Petersen
  0 siblings, 1 reply; 2+ messages in thread
From: Colin King @ 2017-11-28 18:12 UTC (permalink / raw)
  To: James E . J . Bottomley, Martin K . Petersen, linux-scsi
  Cc: kernel-janitors, linux-kernel

From: Colin Ian King <colin.king@canonical.com>

Don't populate the read-only array card_types on the stack but instead
make it static and constify it. Makes the object code smaller by over
110 bytes:

Before:
   text	   data	    bss	    dec	    hex	filename
  25625	   5752	      0	  31377	   7a91	drivers/scsi/wd719x.o

After:
   text	   data	    bss	    dec	    hex	filename
  25447	   5816	      0	  31263	   7a1f	drivers/scsi/wd719x.o

(gcc version 7.2.0 x86_64)

Signed-off-by: Colin Ian King <colin.king@canonical.com>
---
 drivers/scsi/wd719x.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/drivers/scsi/wd719x.c b/drivers/scsi/wd719x.c
index 2a9da2e0ea6b..2ba2b7b47f41 100644
--- a/drivers/scsi/wd719x.c
+++ b/drivers/scsi/wd719x.c
@@ -803,7 +803,9 @@ static enum wd719x_card_type wd719x_detect_type(struct wd719x *wd)
 static int wd719x_board_found(struct Scsi_Host *sh)
 {
 	struct wd719x *wd = shost_priv(sh);
-	char *card_types[] = { "Unknown card", "WD7193", "WD7197", "WD7296" };
+	static const char * const card_types[] = {
+		"Unknown card", "WD7193", "WD7197", "WD7296"
+	};
 	int ret;
 
 	INIT_LIST_HEAD(&wd->active_scbs);
-- 
2.14.1


^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [PATCH] scsi: wd719x: make card_types static const, shrinks object size
  2017-11-28 18:12 [PATCH] scsi: wd719x: make card_types static const, shrinks object size Colin King
@ 2017-11-29  5:12 ` Martin K. Petersen
  0 siblings, 0 replies; 2+ messages in thread
From: Martin K. Petersen @ 2017-11-29  5:12 UTC (permalink / raw)
  To: Colin King
  Cc: James E . J . Bottomley, Martin K . Petersen, linux-scsi,
	kernel-janitors, linux-kernel


Colin,

> Don't populate the read-only array card_types on the stack but instead
> make it static and constify it. Makes the object code smaller by over
> 110 bytes:

Applied to 4.16/scsi-queue. Thanks!

-- 
Martin K. Petersen	Oracle Linux Engineering

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2017-11-29  5:12 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2017-11-28 18:12 [PATCH] scsi: wd719x: make card_types static const, shrinks object size Colin King
2017-11-29  5:12 ` Martin K. Petersen

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).