[<prev] [next>] [day] [month] [year] [list]
Message-Id: <20251211093217.308309-1-chenzhang@kylinos.cn>
Date: Thu, 11 Dec 2025 17:32:17 +0800
From: chen zhang <chenzhang@...inos.cn>
To: hdegoede@...hat.com,
ilpo.jarvinen@...ux.intel.com
Cc: linux-kernel@...r.kernel.org,
chenzhang_0901@....com,
chen zhang <chenzhang@...inos.cn>
Subject: [PATCH] platform/x86: ibm_rtl: 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: chen zhang <chenzhang@...inos.cn>
---
drivers/platform/x86/ibm_rtl.c | 5 +++--
1 file changed, 3 insertions(+), 2 deletions(-)
diff --git a/drivers/platform/x86/ibm_rtl.c b/drivers/platform/x86/ibm_rtl.c
index 231b37909801..c533b240534f 100644
--- a/drivers/platform/x86/ibm_rtl.c
+++ b/drivers/platform/x86/ibm_rtl.c
@@ -13,6 +13,7 @@
#include <linux/kernel.h>
#include <linux/delay.h>
#include <linux/module.h>
+#include <linux/sysfs.h>
#include <linux/io.h>
#include <linux/dmi.h>
#include <linux/efi.h>
@@ -144,14 +145,14 @@ static ssize_t rtl_show_version(struct device *dev,
struct device_attribute *attr,
char *buf)
{
- return sprintf(buf, "%d\n", (int)ioread8(&rtl_table->version));
+ return sysfs_emit(buf, "%d\n", (int)ioread8(&rtl_table->version));
}
static ssize_t rtl_show_state(struct device *dev,
struct device_attribute *attr,
char *buf)
{
- return sprintf(buf, "%d\n", ioread8(&rtl_table->rt_status));
+ return sysfs_emit(buf, "%d\n", ioread8(&rtl_table->rt_status));
}
static ssize_t rtl_set_state(struct device *dev,
--
2.25.1
Powered by blists - more mailing lists