Skip to content

Commit f58470c

Browse files
TangDongxingJiri Kosina
authored andcommitted
HID: hid-logitech: use sysfs_emit_at() instead of scnprintf()
Follow the advice in Documentation/filesystems/sysfs.rst: show() should only use sysfs_emit() or sysfs_emit_at() when formatting the value to be returned to user space. Signed-off-by: TangDongxing <tang.dongxing@zte.com.cn> Signed-off-by: Jiri Kosina <jkosina@suse.com>
1 parent 5e06802 commit f58470c

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

drivers/hid/hid-lg4ff.c

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -823,7 +823,7 @@ static ssize_t lg4ff_alternate_modes_show(struct device *dev, struct device_attr
823823
for (i = 0; i < LG4FF_MODE_MAX_IDX; i++) {
824824
if (entry->wdata.alternate_modes & BIT(i)) {
825825
/* Print tag and full name */
826-
count += scnprintf(buf + count, PAGE_SIZE - count, "%s: %s",
826+
count += sysfs_emit_at(buf, count, "%s: %s",
827827
lg4ff_alternate_modes[i].tag,
828828
!lg4ff_alternate_modes[i].product_id ? entry->wdata.real_name : lg4ff_alternate_modes[i].name);
829829
if (count >= PAGE_SIZE - 1)
@@ -832,9 +832,9 @@ static ssize_t lg4ff_alternate_modes_show(struct device *dev, struct device_attr
832832
/* Mark the currently active mode with an asterisk */
833833
if (lg4ff_alternate_modes[i].product_id == entry->wdata.product_id ||
834834
(lg4ff_alternate_modes[i].product_id == 0 && entry->wdata.product_id == entry->wdata.real_product_id))
835-
count += scnprintf(buf + count, PAGE_SIZE - count, " *\n");
835+
count += sysfs_emit_at(buf, count, " *\n");
836836
else
837-
count += scnprintf(buf + count, PAGE_SIZE - count, "\n");
837+
count += sysfs_emit_at(buf, count, "\n");
838838

839839
if (count >= PAGE_SIZE - 1)
840840
return count;

0 commit comments

Comments
 (0)