Commit 64ee2528 authored by ye xingchen's avatar ye xingchen Committed by Rafael J. Wysocki

ACPI: fan: Convert to use sysfs_emit_at() API

Follow the advice of the Documentation/filesystems/sysfs.rst and show()
should only use sysfs_emit() or sysfs_emit_at() when formatting the
value to be returned to user space.
Signed-off-by: default avatarye xingchen <ye.xingchen@zte.com.cn>
Signed-off-by: default avatarRafael J. Wysocki <rafael.j.wysocki@intel.com>
parent f2ae44ae
...@@ -27,24 +27,24 @@ static ssize_t show_state(struct device *dev, struct device_attribute *attr, cha ...@@ -27,24 +27,24 @@ static ssize_t show_state(struct device *dev, struct device_attribute *attr, cha
count = scnprintf(buf, PAGE_SIZE, "%lld:", fps->control); count = scnprintf(buf, PAGE_SIZE, "%lld:", fps->control);
if (fps->trip_point == 0xFFFFFFFF || fps->trip_point > 9) if (fps->trip_point == 0xFFFFFFFF || fps->trip_point > 9)
count += scnprintf(&buf[count], PAGE_SIZE - count, "not-defined:"); count += sysfs_emit_at(buf, count, "not-defined:");
else else
count += scnprintf(&buf[count], PAGE_SIZE - count, "%lld:", fps->trip_point); count += sysfs_emit_at(buf, count, "%lld:", fps->trip_point);
if (fps->speed == 0xFFFFFFFF) if (fps->speed == 0xFFFFFFFF)
count += scnprintf(&buf[count], PAGE_SIZE - count, "not-defined:"); count += sysfs_emit_at(buf, count, "not-defined:");
else else
count += scnprintf(&buf[count], PAGE_SIZE - count, "%lld:", fps->speed); count += sysfs_emit_at(buf, count, "%lld:", fps->speed);
if (fps->noise_level == 0xFFFFFFFF) if (fps->noise_level == 0xFFFFFFFF)
count += scnprintf(&buf[count], PAGE_SIZE - count, "not-defined:"); count += sysfs_emit_at(buf, count, "not-defined:");
else else
count += scnprintf(&buf[count], PAGE_SIZE - count, "%lld:", fps->noise_level * 100); count += sysfs_emit_at(buf, count, "%lld:", fps->noise_level * 100);
if (fps->power == 0xFFFFFFFF) if (fps->power == 0xFFFFFFFF)
count += scnprintf(&buf[count], PAGE_SIZE - count, "not-defined\n"); count += sysfs_emit_at(buf, count, "not-defined\n");
else else
count += scnprintf(&buf[count], PAGE_SIZE - count, "%lld\n", fps->power); count += sysfs_emit_at(buf, count, "%lld\n", fps->power);
return count; return count;
} }
......
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