linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Joe Perches <joe@perches.com>
To: Don Brace <don.brace@microchip.com>
Cc: "James E.J. Bottomley" <jejb@linux.ibm.com>,
	"Martin K. Petersen" <martin.petersen@oracle.com>,
	storagedev@microchip.com, linux-scsi@vger.kernel.org,
	linux-kernel@vger.kernel.org
Subject: [PATCH 4/5] scsi: smartpqi: Use vsprintf %phNX extension
Date: Thu, 26 Aug 2021 11:43:04 -0700	[thread overview]
Message-ID: <31db4db01d24e5178188f48adc5acba6c8047316.1630003183.git.joe@perches.com> (raw)
In-Reply-To: <cover.1630003183.git.joe@perches.com>

Reduce object size by using the %phNX extension to format a sysfs output
buffer with identical output.

compiled x86-64 defconfig w/ smartpqi and gcc 10.3.0

$ size drivers/scsi/smartpqi/smartpqi_init.o*
   text	   data	    bss	    dec	    hex	filename
  69791	   2205	     48	  72044	  1196c	drivers/scsi/smartpqi/smartpqi_init.o.new
  69950	   2205	     48	  72203	  11a0b	drivers/scsi/smartpqi/smartpqi_init.o.old

Signed-off-by: Joe Perches <joe@perches.com>
---
 drivers/scsi/smartpqi/smartpqi_init.c | 8 +-------
 1 file changed, 1 insertion(+), 7 deletions(-)

diff --git a/drivers/scsi/smartpqi/smartpqi_init.c b/drivers/scsi/smartpqi/smartpqi_init.c
index ecb2af3f43ca3..eb39490b196cc 100644
--- a/drivers/scsi/smartpqi/smartpqi_init.c
+++ b/drivers/scsi/smartpqi/smartpqi_init.c
@@ -6674,13 +6674,7 @@ static ssize_t pqi_unique_id_show(struct device *dev,
 
 	spin_unlock_irqrestore(&ctrl_info->scsi_device_list_lock, flags);
 
-	return scnprintf(buffer, PAGE_SIZE,
-		"%02X%02X%02X%02X%02X%02X%02X%02X"
-		"%02X%02X%02X%02X%02X%02X%02X%02X\n",
-		unique_id[0], unique_id[1], unique_id[2], unique_id[3],
-		unique_id[4], unique_id[5], unique_id[6], unique_id[7],
-		unique_id[8], unique_id[9], unique_id[10], unique_id[11],
-		unique_id[12], unique_id[13], unique_id[14], unique_id[15]);
+	return scnprintf(buffer, PAGE_SIZE, "%16phNX\n", unique_id);
 }
 
 static ssize_t pqi_lunid_show(struct device *dev,
-- 
2.30.0


  parent reply	other threads:[~2021-08-26 18:43 UTC|newest]

Thread overview: 20+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-08-26 18:43 [PATCH 0/5] vsprintf and uses: Add upper case output to %*ph extension Joe Perches
2021-08-26 18:43 ` [PATCH 1/5] vsprintf/Documentation: Add X to %*ph extension to output upper case hex Joe Perches
2021-08-27  7:48   ` Andy Shevchenko
2021-08-27  8:08     ` Joe Perches
2021-08-27  8:49       ` Andy Shevchenko
2021-08-27 10:49         ` Petr Mladek
2021-08-28  2:49         ` Joe Perches
2021-08-26 18:43 ` [PATCH 2/5] scsi: aacraid: Use vsprintf %phNX extension Joe Perches
2021-08-26 18:43 ` [PATCH 3/5] scsi: hpsa: " Joe Perches
2021-08-26 18:43 ` Joe Perches [this message]
2021-08-26 18:43 ` [PATCH 5/5] staging: r8188eu: Use vsprintf extension %phCX to format a copy_to_user string Joe Perches
2021-08-27  8:42   ` Greg Kroah-Hartman
2021-08-27 15:23     ` Joe Perches
2021-08-27 15:27       ` Greg Kroah-Hartman
2021-08-27 15:52         ` Joe Perches
2021-08-27  7:51 ` [PATCH 0/5] vsprintf and uses: Add upper case output to %*ph extension Andy Shevchenko
2021-08-27  8:10   ` Joe Perches
2021-08-27  8:46     ` Andy Shevchenko
2021-08-27 10:23       ` Greg KH
2021-08-27 16:09         ` Joe Perches

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=31db4db01d24e5178188f48adc5acba6c8047316.1630003183.git.joe@perches.com \
    --to=joe@perches.com \
    --cc=don.brace@microchip.com \
    --cc=jejb@linux.ibm.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-scsi@vger.kernel.org \
    --cc=martin.petersen@oracle.com \
    --cc=storagedev@microchip.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).