[<prev] [next>] [day] [month] [year] [list]
Message-ID: <20250317154657278tVMfwXa9KMOtZ6c_FfHJ9@zte.com.cn>
Date: Mon, 17 Mar 2025 15:46:57 +0800 (CST)
From: <tang.dongxing@....com.cn>
To: <alexander.shishkin@...ux.intel.com>
Cc: <linux-kernel@...r.kernel.org>, <yang.guang5@....com.cn>,
<yang.yang29@....com.cn>, <xu.xin16@....com.cn>,
<ye.xingchen@....com.cn>
Subject: [PATCH] intel_th: msu: use sysfs_emit_at() instead of scnprintf()
From: TangDongxing <tang.dongxing@....com.cn>
Follow the advice in Documentation/filesystems/sysfs.rst:
show() should only use sysfs_emit() or sysfs_emit_at() when formatting
the value to be returned to user space.
Signed-off-by: TangDongxing <tang.dongxing@....com.cn>
---
drivers/hwtracing/intel_th/msu.c | 6 +++---
1 file changed, 3 insertions(+), 3 deletions(-)
diff --git a/drivers/hwtracing/intel_th/msu.c b/drivers/hwtracing/intel_th/msu.c
index bf99d79a4192..eb474e9a9645 100644
--- a/drivers/hwtracing/intel_th/msu.c
+++ b/drivers/hwtracing/intel_th/msu.c
@@ -1983,15 +1983,15 @@ nr_pages_show(struct device *dev, struct device_attribute *attr, char *buf)
mutex_lock(&msc->buf_mutex);
if (msc->mode == MSC_MODE_SINGLE)
- count = scnprintf(buf, PAGE_SIZE, "%ld\n", msc->nr_pages);
+ count = sysfs_emit(buf, "%ld\n", msc->nr_pages);
else if (msc->mode == MSC_MODE_MULTI) {
list_for_each_entry(win, &msc->win_list, entry) {
- count += scnprintf(buf + count, PAGE_SIZE - count,
+ count += sysfs_emit_at(buf, count,
"%d%c", win->nr_blocks,
msc_is_last_win(win) ? '\n' : ',');
}
} else {
- count = scnprintf(buf, PAGE_SIZE, "unsupported\n");
+ count = sysfs_emit(buf, "unsupported\n");
}
mutex_unlock(&msc->buf_mutex);
--
2.25.1
Powered by blists - more mailing lists