[<prev] [next>] [day] [month] [year] [list]
Message-Id: <20251211091453.300768-1-chenzhang@kylinos.cn>
Date: Thu, 11 Dec 2025 17:14:53 +0800
From: chen zhang <chenzhang@...inos.cn>
To: hdegoede@...hat.com,
ilpo.jarvinen@...ux.intel.com,
mjg59@...f.ucam.org,
pali@...nel.org
Cc: linux-kernel@...r.kernel.org,
chenzhang_0901@....com,
chen zhang <chenzhang@...inos.cn>
Subject: [PATCH] platform/x86: dell-laptop: 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/dell/dell-laptop.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/drivers/platform/x86/dell/dell-laptop.c b/drivers/platform/x86/dell/dell-laptop.c
index 57748c3ea24f..bac75769a5f4 100644
--- a/drivers/platform/x86/dell/dell-laptop.c
+++ b/drivers/platform/x86/dell/dell-laptop.c
@@ -1909,7 +1909,7 @@ static ssize_t kbd_led_als_enabled_show(struct device *dev,
return ret;
enabled = kbd_is_als_mode_bit(state.mode_bit);
- return sprintf(buf, "%d\n", enabled ? 1 : 0);
+ return sysfs_emit(buf, "%d\n", enabled ? 1 : 0);
}
static DEVICE_ATTR(als_enabled, S_IRUGO | S_IWUSR,
@@ -1958,7 +1958,7 @@ static ssize_t kbd_led_als_setting_show(struct device *dev,
if (ret)
return ret;
- return sprintf(buf, "%d\n", state.als_setting);
+ return sysfs_emit(buf, "%d\n", state.als_setting);
}
static DEVICE_ATTR(als_setting, S_IRUGO | S_IWUSR,
--
2.25.1
Powered by blists - more mailing lists