diff mbox series

[-next,3/3] scsi: hptiop: Change snprintf() to sysfs_emit()

Message ID 20240904013540.2026972-4-lihongbo22@huawei.com (mailing list archive)
State Deferred
Headers show
Series Use sysfs_emit for reloading sysfs's .show | expand

Commit Message

Hongbo Li Sept. 4, 2024, 1:35 a.m. UTC
sysfs_emit validates assumptions made by sysfs and is the correct
mechanism to format data for sysfs. And this way is also suggested
in Documentation/filesystems/sysfs.rst.

Signed-off-by: Hongbo Li <lihongbo22@huawei.com>
---
 drivers/scsi/hptiop.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
diff mbox series

Patch

diff --git a/drivers/scsi/hptiop.c b/drivers/scsi/hptiop.c
index e889f268601b..5dcc9e18ce23 100644
--- a/drivers/scsi/hptiop.c
+++ b/drivers/scsi/hptiop.c
@@ -1111,7 +1111,7 @@  static int hptiop_adjust_disk_queue_depth(struct scsi_device *sdev,
 static ssize_t hptiop_show_version(struct device *dev,
 				   struct device_attribute *attr, char *buf)
 {
-	return snprintf(buf, PAGE_SIZE, "%s\n", driver_ver);
+	return sysfs_emit(buf, "%s\n", driver_ver);
 }
 
 static ssize_t hptiop_show_fw_version(struct device *dev,
@@ -1120,7 +1120,7 @@  static ssize_t hptiop_show_fw_version(struct device *dev,
 	struct Scsi_Host *host = class_to_shost(dev);
 	struct hptiop_hba *hba = (struct hptiop_hba *)host->hostdata;
 
-	return snprintf(buf, PAGE_SIZE, "%d.%d.%d.%d\n",
+	return sysfs_emit(buf, "%d.%d.%d.%d\n",
 				hba->firmware_version >> 24,
 				(hba->firmware_version >> 16) & 0xff,
 				(hba->firmware_version >> 8) & 0xff,