Commit 170f0da2 authored by Luke D. Jones's avatar Luke D. Jones Committed by Hans de Goede

platform/x86: asus-wmi: Convert all attr-show to use sysfs_emit

This changes all *_show attributes in asus-wmi.c to use sysfs_emit()
instead of the older method of writing to the output buffer manually.
Signed-off-by: default avatarLuke D. Jones <luke@ljones.dev>
Reviewed-by: default avatarAndy Shevchenko <andy.shevchenko@gmail.com>
Link: https://lore.kernel.org/r/20220809025054.1626339-6-luke@ljones.devSigned-off-by: default avatarHans de Goede <hdegoede@redhat.com>
parent c6607bcb
...@@ -771,7 +771,7 @@ static ssize_t charge_control_end_threshold_show(struct device *device, ...@@ -771,7 +771,7 @@ static ssize_t charge_control_end_threshold_show(struct device *device,
struct device_attribute *attr, struct device_attribute *attr,
char *buf) char *buf)
{ {
return sprintf(buf, "%d\n", charge_end_threshold); return sysfs_emit(buf, "%d\n", charge_end_threshold);
} }
static DEVICE_ATTR_RW(charge_control_end_threshold); static DEVICE_ATTR_RW(charge_control_end_threshold);
...@@ -1819,7 +1819,7 @@ static ssize_t pwm1_show(struct device *dev, ...@@ -1819,7 +1819,7 @@ static ssize_t pwm1_show(struct device *dev,
value = -1; value = -1;
} }
return sprintf(buf, "%d\n", value); return sysfs_emit(buf, "%d\n", value);
} }
static ssize_t pwm1_store(struct device *dev, static ssize_t pwm1_store(struct device *dev,
...@@ -1879,7 +1879,7 @@ static ssize_t fan1_input_show(struct device *dev, ...@@ -1879,7 +1879,7 @@ static ssize_t fan1_input_show(struct device *dev,
return -ENXIO; return -ENXIO;
} }
return sprintf(buf, "%d\n", value < 0 ? -1 : value*100); return sysfs_emit(buf, "%d\n", value < 0 ? -1 : value * 100);
} }
static ssize_t pwm1_enable_show(struct device *dev, static ssize_t pwm1_enable_show(struct device *dev,
...@@ -1897,7 +1897,7 @@ static ssize_t pwm1_enable_show(struct device *dev, ...@@ -1897,7 +1897,7 @@ static ssize_t pwm1_enable_show(struct device *dev,
* in practice on X532FL at least (the bit is always 0) and there's * in practice on X532FL at least (the bit is always 0) and there's
* also nothing in the DSDT to indicate that this behaviour exists. * also nothing in the DSDT to indicate that this behaviour exists.
*/ */
return sprintf(buf, "%d\n", asus->fan_pwm_mode); return sysfs_emit(buf, "%d\n", asus->fan_pwm_mode);
} }
static ssize_t pwm1_enable_store(struct device *dev, static ssize_t pwm1_enable_store(struct device *dev,
...@@ -1965,7 +1965,7 @@ static ssize_t fan1_label_show(struct device *dev, ...@@ -1965,7 +1965,7 @@ static ssize_t fan1_label_show(struct device *dev,
struct device_attribute *attr, struct device_attribute *attr,
char *buf) char *buf)
{ {
return sprintf(buf, "%s\n", ASUS_FAN_DESC); return sysfs_emit(buf, "%s\n", ASUS_FAN_DESC);
} }
static ssize_t asus_hwmon_temp1(struct device *dev, static ssize_t asus_hwmon_temp1(struct device *dev,
...@@ -2158,7 +2158,7 @@ static ssize_t fan_boost_mode_show(struct device *dev, ...@@ -2158,7 +2158,7 @@ static ssize_t fan_boost_mode_show(struct device *dev,
{ {
struct asus_wmi *asus = dev_get_drvdata(dev); struct asus_wmi *asus = dev_get_drvdata(dev);
return scnprintf(buf, PAGE_SIZE, "%d\n", asus->fan_boost_mode); return sysfs_emit(buf, "%d\n", asus->fan_boost_mode);
} }
static ssize_t fan_boost_mode_store(struct device *dev, static ssize_t fan_boost_mode_store(struct device *dev,
...@@ -2711,7 +2711,7 @@ static ssize_t throttle_thermal_policy_show(struct device *dev, ...@@ -2711,7 +2711,7 @@ static ssize_t throttle_thermal_policy_show(struct device *dev,
struct asus_wmi *asus = dev_get_drvdata(dev); struct asus_wmi *asus = dev_get_drvdata(dev);
u8 mode = asus->throttle_thermal_policy_mode; u8 mode = asus->throttle_thermal_policy_mode;
return scnprintf(buf, PAGE_SIZE, "%d\n", mode); return sysfs_emit(buf, "%d\n", mode);
} }
static ssize_t throttle_thermal_policy_store(struct device *dev, static ssize_t throttle_thermal_policy_store(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