Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

Input: use sysfs_emit() instead of scnprintf()

Replace calls to scnprintf() in the methods showing device attributes
with sysfs_emit() to simplify the code.

Signed-off-by: ye xingchen <ye.xingchen@zte.com.cn>
Link: https://lore.kernel.org/r/202212021133398847947@zte.com.cn
Signed-off-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>

authored by

ye xingchen and committed by
Dmitry Torokhov
d4db8762 f737020d

+4 -4
+4 -4
drivers/input/input.c
··· 1365 1365 { \ 1366 1366 struct input_dev *input_dev = to_input_dev(dev); \ 1367 1367 \ 1368 - return scnprintf(buf, PAGE_SIZE, "%s\n", \ 1369 - input_dev->name ? input_dev->name : ""); \ 1368 + return sysfs_emit(buf, "%s\n", \ 1369 + input_dev->name ? input_dev->name : ""); \ 1370 1370 } \ 1371 1371 static DEVICE_ATTR(name, S_IRUGO, input_dev_show_##name, NULL) 1372 1372 ··· 1458 1458 { 1459 1459 struct input_dev *input_dev = to_input_dev(dev); 1460 1460 1461 - return scnprintf(buf, PAGE_SIZE, "%d\n", input_dev->inhibited); 1461 + return sysfs_emit(buf, "%d\n", input_dev->inhibited); 1462 1462 } 1463 1463 1464 1464 static ssize_t inhibited_store(struct device *dev, ··· 1505 1505 char *buf) \ 1506 1506 { \ 1507 1507 struct input_dev *input_dev = to_input_dev(dev); \ 1508 - return scnprintf(buf, PAGE_SIZE, "%04x\n", input_dev->id.name); \ 1508 + return sysfs_emit(buf, "%04x\n", input_dev->id.name); \ 1509 1509 } \ 1510 1510 static DEVICE_ATTR(name, S_IRUGO, input_dev_show_id_##name, NULL) 1511 1511