[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <adef530c3e1f5acbbdc89cefcc21bb82e3b7bfbf.1630003183.git.joe@perches.com>
Date: Thu, 26 Aug 2021 11:43:03 -0700
From: Joe Perches <joe@...ches.com>
To: Don Brace <don.brace@...rochip.com>,
"James E.J. Bottomley" <jejb@...ux.ibm.com>,
"Martin K. Petersen" <martin.petersen@...cle.com>
Cc: storagedev@...rochip.com, linux-scsi@...r.kernel.org,
linux-kernel@...r.kernel.org
Subject: [PATCH 3/5] scsi: hpsa: Use vsprintf %phNX extension
Reduce object size by using the %phNX extension to format a sysfs output
buffer with identical output.
compiled x86-64 defconfig w/ hpsa and gcc 10.3.0
$ size drivers/scsi/hpsa.o*
text data bss dec hex filename
84041 2181 20 86242 150e2 drivers/scsi/hpsa.o.new
84226 2181 20 86427 1519b drivers/scsi/hpsa.o.old
Signed-off-by: Joe Perches <joe@...ches.com>
---
drivers/scsi/hpsa.c | 8 +-------
1 file changed, 1 insertion(+), 7 deletions(-)
diff --git a/drivers/scsi/hpsa.c b/drivers/scsi/hpsa.c
index 3faa87fa296a2..c56871e8ce1b7 100644
--- a/drivers/scsi/hpsa.c
+++ b/drivers/scsi/hpsa.c
@@ -743,13 +743,7 @@ static ssize_t unique_id_show(struct device *dev,
}
memcpy(sn, hdev->device_id, sizeof(sn));
spin_unlock_irqrestore(&h->lock, flags);
- return snprintf(buf, 16 * 2 + 2,
- "%02X%02X%02X%02X%02X%02X%02X%02X"
- "%02X%02X%02X%02X%02X%02X%02X%02X\n",
- sn[0], sn[1], sn[2], sn[3],
- sn[4], sn[5], sn[6], sn[7],
- sn[8], sn[9], sn[10], sn[11],
- sn[12], sn[13], sn[14], sn[15]);
+ return snprintf(buf, 16 * 2 + 2, "%16phNX\n", sn);
}
static ssize_t sas_address_show(struct device *dev,
--
2.30.0
Powered by blists - more mailing lists