[PATCH] fsi: core: use sysfs_emit() instead of sprintf()

zhangheng posted 1 patch 2 weeks, 3 days ago
drivers/fsi/fsi-core.c | 6 +++---
1 file changed, 3 insertions(+), 3 deletions(-)
[PATCH] fsi: core: use sysfs_emit() instead of sprintf()
Posted by zhangheng 2 weeks, 3 days ago
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: zhangheng <zhangheng@kylinos.cn>
---
 drivers/fsi/fsi-core.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/drivers/fsi/fsi-core.c b/drivers/fsi/fsi-core.c
index e2e1e9df6115..2fdc866345ab 100644
--- a/drivers/fsi/fsi-core.c
+++ b/drivers/fsi/fsi-core.c
@@ -784,7 +784,7 @@ static ssize_t slave_send_echo_show(struct device *dev,
 {
 	struct fsi_slave *slave = to_fsi_slave(dev);
 
-	return sprintf(buf, "%u\n", slave->t_send_delay);
+	return sysfs_emit(buf, "%u\n", slave->t_send_delay);
 }
 
 static ssize_t slave_send_echo_store(struct device *dev,
@@ -828,7 +828,7 @@ static ssize_t chip_id_show(struct device *dev,
 {
 	struct fsi_slave *slave = to_fsi_slave(dev);
 
-	return sprintf(buf, "%d\n", slave->chip_id);
+	return sysfs_emit(buf, "%d\n", slave->chip_id);
 }
 
 static DEVICE_ATTR_RO(chip_id);
@@ -839,7 +839,7 @@ static ssize_t cfam_id_show(struct device *dev,
 {
 	struct fsi_slave *slave = to_fsi_slave(dev);
 
-	return sprintf(buf, "0x%x\n", slave->cfam_id);
+	return sysfs_emit(buf, "0x%x\n", slave->cfam_id);
 }
 
 static DEVICE_ATTR_RO(cfam_id);
-- 
2.45.2