public inbox for linux-kernel-mentees@lists.linux-foundation.org
 help / color / mirror / Atom feed
From: Khaled Elnaggar <khaledelnaggarlinux@gmail.com>
To: liyihang9@huawei.com, James.Bottomley@HansenPartnership.com,
	martin.petersen@oracle.com
Cc: Khaled Elnaggar <khaledelnaggarlinux@gmail.com>,
	linux-kernel-mentees@lists.linux.dev, shuah@kernel.org,
	linux-scsi@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: [PATCH] scsi: hisi_sas: use sysfs_emit() in v3 hw show() functions
Date: Sat, 12 Jul 2025 17:28:03 +0300	[thread overview]
Message-ID: <20250712142804.339241-1-khaledelnaggarlinux@gmail.com> (raw)

Replace scnprintf() with sysfs_emit() in several sysfs show()
callbacks in hisi_sas_v3_hw.c. This is recommended in
Documentation/filesystems/sysfs.rst for formatting values returned to
userspace.

Signed-off-by: Khaled Elnaggar <khaledelnaggarlinux@gmail.com>
---
 drivers/scsi/hisi_sas/hisi_sas_v3_hw.c | 11 ++++-------
 1 file changed, 4 insertions(+), 7 deletions(-)

diff --git a/drivers/scsi/hisi_sas/hisi_sas_v3_hw.c b/drivers/scsi/hisi_sas/hisi_sas_v3_hw.c
index bc5d5356dd00..84bc02f7da27 100644
--- a/drivers/scsi/hisi_sas/hisi_sas_v3_hw.c
+++ b/drivers/scsi/hisi_sas/hisi_sas_v3_hw.c
@@ -2849,7 +2849,7 @@ static void wait_cmds_complete_timeout_v3_hw(struct hisi_hba *hisi_hba,
 static ssize_t intr_conv_v3_hw_show(struct device *dev,
 				    struct device_attribute *attr, char *buf)
 {
-	return scnprintf(buf, PAGE_SIZE, "%u\n", hisi_sas_intr_conv);
+	return sysfs_emit(buf, "%u\n", hisi_sas_intr_conv);
 }
 static DEVICE_ATTR_RO(intr_conv_v3_hw);
 
@@ -2881,8 +2881,7 @@ static ssize_t intr_coal_ticks_v3_hw_show(struct device *dev,
 	struct Scsi_Host *shost = class_to_shost(dev);
 	struct hisi_hba *hisi_hba = shost_priv(shost);
 
-	return scnprintf(buf, PAGE_SIZE, "%u\n",
-			 hisi_hba->intr_coal_ticks);
+	return sysfs_emit(buf, "%u\n", hisi_hba->intr_coal_ticks);
 }
 
 static ssize_t intr_coal_ticks_v3_hw_store(struct device *dev,
@@ -2920,8 +2919,7 @@ static ssize_t intr_coal_count_v3_hw_show(struct device *dev,
 	struct Scsi_Host *shost = class_to_shost(dev);
 	struct hisi_hba *hisi_hba = shost_priv(shost);
 
-	return scnprintf(buf, PAGE_SIZE, "%u\n",
-			 hisi_hba->intr_coal_count);
+	return sysfs_emit(buf, "%u\n", hisi_hba->intr_coal_count);
 }
 
 static ssize_t intr_coal_count_v3_hw_store(struct device *dev,
@@ -2959,8 +2957,7 @@ static ssize_t iopoll_q_cnt_v3_hw_show(struct device *dev,
 	struct Scsi_Host *shost = class_to_shost(dev);
 	struct hisi_hba *hisi_hba = shost_priv(shost);
 
-	return scnprintf(buf, PAGE_SIZE, "%u\n",
-			 hisi_hba->iopoll_q_cnt);
+	return sysfs_emit(buf, "%u\n", hisi_hba->iopoll_q_cnt);
 }
 static DEVICE_ATTR_RO(iopoll_q_cnt_v3_hw);
 
-- 
2.47.2


             reply	other threads:[~2025-07-12 14:28 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-07-12 14:28 Khaled Elnaggar [this message]
2025-07-12 14:43 ` [PATCH] scsi: hisi_sas: use sysfs_emit() in v3 hw show() functions Greg KH
2025-07-12 15:17   ` Khaled Elnaggar
2025-07-13 17:58   ` Bart Van Assche
2025-07-14  5:32     ` Greg KH

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=20250712142804.339241-1-khaledelnaggarlinux@gmail.com \
    --to=khaledelnaggarlinux@gmail.com \
    --cc=James.Bottomley@HansenPartnership.com \
    --cc=linux-kernel-mentees@lists.linux.dev \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-scsi@vger.kernel.org \
    --cc=liyihang9@huawei.com \
    --cc=martin.petersen@oracle.com \
    --cc=shuah@kernel.org \
    /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