[PATCH] platform/x86: dell-laptop: use sysfs_emit() instead of sprintf()

chen zhang posted 1 patch 4 days, 23 hours ago
There is a newer version of this series
drivers/platform/x86/dell/dell-laptop.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
[PATCH] platform/x86: dell-laptop: use sysfs_emit() instead of sprintf()
Posted by chen zhang 4 days, 23 hours 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: chen zhang <chenzhang@kylinos.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