[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Message-Id: <20240314052828.186924-1-aichao@kylinos.cn>
Date: Thu, 14 Mar 2024 13:28:28 +0800
From: Ai Chao <aichao@...inos.cn>
To: bleung@...omium.org,
tzungbi@...nel.org,
chrome-platform@...ts.linux.dev,
linux-kernel@...r.kernel.org
Cc: Ai Chao <aichao@...inos.cn>
Subject: [PATCH v1] platform/chrome: use sysfs_emit() instead of sprintf()
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: Ai Chao <aichao@...inos.cn>
---
drivers/platform/chrome/wilco_ec/sysfs.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/drivers/platform/chrome/wilco_ec/sysfs.c b/drivers/platform/chrome/wilco_ec/sysfs.c
index 893c59dde32a..d44c43559621 100644
--- a/drivers/platform/chrome/wilco_ec/sysfs.c
+++ b/drivers/platform/chrome/wilco_ec/sysfs.c
@@ -192,7 +192,7 @@ static ssize_t usb_charge_show(struct device *dev,
if (ret < 0)
return ret;
- return sprintf(buf, "%d\n", rs.val);
+ return sysfs_emit(buf, "%d\n", rs.val);
}
static ssize_t usb_charge_store(struct device *dev,
--
2.25.1
Powered by blists - more mailing lists