Skip to content

Commit 64ee252

Browse files
ye xingchenrafaeljw
authored andcommitted
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: ye xingchen <[email protected]> Signed-off-by: Rafael J. Wysocki <[email protected]>
1 parent f2ae44a commit 64ee252

File tree

1 file changed

+8
-8
lines changed

1 file changed

+8
-8
lines changed

drivers/acpi/fan_attr.c

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -27,24 +27,24 @@ static ssize_t show_state(struct device *dev, struct device_attribute *attr, cha
2727
count = scnprintf(buf, PAGE_SIZE, "%lld:", fps->control);
2828

2929
if (fps->trip_point == 0xFFFFFFFF || fps->trip_point > 9)
30-
count += scnprintf(&buf[count], PAGE_SIZE - count, "not-defined:");
30+
count += sysfs_emit_at(buf, count, "not-defined:");
3131
else
32-
count += scnprintf(&buf[count], PAGE_SIZE - count, "%lld:", fps->trip_point);
32+
count += sysfs_emit_at(buf, count, "%lld:", fps->trip_point);
3333

3434
if (fps->speed == 0xFFFFFFFF)
35-
count += scnprintf(&buf[count], PAGE_SIZE - count, "not-defined:");
35+
count += sysfs_emit_at(buf, count, "not-defined:");
3636
else
37-
count += scnprintf(&buf[count], PAGE_SIZE - count, "%lld:", fps->speed);
37+
count += sysfs_emit_at(buf, count, "%lld:", fps->speed);
3838

3939
if (fps->noise_level == 0xFFFFFFFF)
40-
count += scnprintf(&buf[count], PAGE_SIZE - count, "not-defined:");
40+
count += sysfs_emit_at(buf, count, "not-defined:");
4141
else
42-
count += scnprintf(&buf[count], PAGE_SIZE - count, "%lld:", fps->noise_level * 100);
42+
count += sysfs_emit_at(buf, count, "%lld:", fps->noise_level * 100);
4343

4444
if (fps->power == 0xFFFFFFFF)
45-
count += scnprintf(&buf[count], PAGE_SIZE - count, "not-defined\n");
45+
count += sysfs_emit_at(buf, count, "not-defined\n");
4646
else
47-
count += scnprintf(&buf[count], PAGE_SIZE - count, "%lld\n", fps->power);
47+
count += sysfs_emit_at(buf, count, "%lld\n", fps->power);
4848

4949
return count;
5050
}

0 commit comments

Comments
 (0)