Commit 51fb2ff7 authored by yunshui's avatar yunshui Committed by Hans de Goede

platform/x86: samsung-laptop: Use sysfs_emit() to replace the old interface sprintf()

    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: default avataryunshui <jiangyunshui@kylinos.cn>
Reviewed-by: default avatarAi Chao <aichao@kylinos.cn>
Link: https://lore.kernel.org/r/20240419064106.2396705-1-jiangyunshui@kylinos.cnReviewed-by: default avatarHans de Goede <hdegoede@redhat.com>
Signed-off-by: default avatarHans de Goede <hdegoede@redhat.com>
parent 208ba505
...@@ -661,9 +661,9 @@ static ssize_t get_performance_level(struct device *dev, ...@@ -661,9 +661,9 @@ static ssize_t get_performance_level(struct device *dev,
/* The logic is backwards, yeah, lots of fun... */ /* The logic is backwards, yeah, lots of fun... */
for (i = 0; config->performance_levels[i].name; ++i) { for (i = 0; config->performance_levels[i].name; ++i) {
if (sretval.data[0] == config->performance_levels[i].value) if (sretval.data[0] == config->performance_levels[i].value)
return sprintf(buf, "%s\n", config->performance_levels[i].name); return sysfs_emit(buf, "%s\n", config->performance_levels[i].name);
} }
return sprintf(buf, "%s\n", "unknown"); return sysfs_emit(buf, "%s\n", "unknown");
} }
static ssize_t set_performance_level(struct device *dev, static ssize_t set_performance_level(struct device *dev,
...@@ -744,7 +744,7 @@ static ssize_t get_battery_life_extender(struct device *dev, ...@@ -744,7 +744,7 @@ static ssize_t get_battery_life_extender(struct device *dev,
if (ret < 0) if (ret < 0)
return ret; return ret;
return sprintf(buf, "%d\n", ret); return sysfs_emit(buf, "%d\n", ret);
} }
static ssize_t set_battery_life_extender(struct device *dev, static ssize_t set_battery_life_extender(struct device *dev,
...@@ -813,7 +813,7 @@ static ssize_t get_usb_charge(struct device *dev, ...@@ -813,7 +813,7 @@ static ssize_t get_usb_charge(struct device *dev,
if (ret < 0) if (ret < 0)
return ret; return ret;
return sprintf(buf, "%d\n", ret); return sysfs_emit(buf, "%d\n", ret);
} }
static ssize_t set_usb_charge(struct device *dev, static ssize_t set_usb_charge(struct device *dev,
...@@ -878,7 +878,7 @@ static ssize_t get_lid_handling(struct device *dev, ...@@ -878,7 +878,7 @@ static ssize_t get_lid_handling(struct device *dev,
if (ret < 0) if (ret < 0)
return ret; return ret;
return sprintf(buf, "%d\n", ret); return sysfs_emit(buf, "%d\n", ret);
} }
static ssize_t set_lid_handling(struct device *dev, static ssize_t set_lid_handling(struct device *dev,
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment