platform/x86: thinkpad_acpi: change sprintf() to sysfs_emit()
authoryunshui <jiangyunshui@kylinos.cn>
Wed, 17 Apr 2024 09:20:55 +0000 (17:20 +0800)
committerHans de Goede <hdegoede@redhat.com>
Mon, 29 Apr 2024 08:52:03 +0000 (10:52 +0200)
As Documentation/filesystems/sysfs.rst suggested,
show() should only use sysfs_emit() or sysfs_emit_at() when formatting
the value to be returned to user space.

Signed-off-by: yunshui <jiangyunshui@kylinos.cn>
Reviewed-by: Ai Chao <aichao@kylinos.cn>
Link: https://lore.kernel.org/r/20240417092055.1170586-1-jiangyunshui@kylinos.cn
Reviewed-by: Hans de Goede <hdegoede@redhat.com>
Signed-off-by: Hans de Goede <hdegoede@redhat.com>
drivers/platform/x86/thinkpad_acpi.c

index 771aaa7ae4cf4549a80f83adcc4cc7e878fc5624..729ab2de30b53c9a760da209fc86a9ce227d4ac5 100644 (file)
@@ -2679,7 +2679,7 @@ static ssize_t hotkey_bios_enabled_show(struct device *dev,
                           struct device_attribute *attr,
                           char *buf)
 {
-       return sprintf(buf, "0\n");
+       return sysfs_emit(buf, "0\n");
 }
 
 static DEVICE_ATTR_RO(hotkey_bios_enabled);
@@ -9789,7 +9789,7 @@ static ssize_t tpacpi_battery_show(int what,
                battery = BAT_PRIMARY;
        if (tpacpi_battery_get(what, battery, &ret))
                return -ENODEV;
-       return sprintf(buf, "%d\n", ret);
+       return sysfs_emit(buf, "%d\n", ret);
 }
 
 static ssize_t charge_control_start_threshold_show(struct device *device,