diff options
author | ye xingchen <ye.xingchen@zte.com.cn> | 2023-12-12 22:37:16 -0800 |
---|---|---|
committer | Dmitry Torokhov <dmitry.torokhov@gmail.com> | 2023-12-13 21:26:11 -0800 |
commit | d4db8762dc4c364dce89901ed4690588ad310bfc (patch) | |
tree | 7818ae14a5a20b9c91d18a26c13f26cacc47ee2d /drivers/input/input.c | |
parent | f737020d24e47d6e8b893a2fee2b43268a6af629 (diff) | |
download | linux-d4db8762dc4c364dce89901ed4690588ad310bfc.tar.gz linux-d4db8762dc4c364dce89901ed4690588ad310bfc.tar.bz2 linux-d4db8762dc4c364dce89901ed4690588ad310bfc.zip |
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>
Diffstat (limited to 'drivers/input/input.c')
-rw-r--r-- | drivers/input/input.c | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/drivers/input/input.c b/drivers/input/input.c index 8c5fdb0f858a..f71ea4fb173f 100644 --- a/drivers/input/input.c +++ b/drivers/input/input.c @@ -1365,8 +1365,8 @@ static ssize_t input_dev_show_##name(struct device *dev, \ { \ struct input_dev *input_dev = to_input_dev(dev); \ \ - return scnprintf(buf, PAGE_SIZE, "%s\n", \ - input_dev->name ? input_dev->name : ""); \ + return sysfs_emit(buf, "%s\n", \ + input_dev->name ? input_dev->name : ""); \ } \ static DEVICE_ATTR(name, S_IRUGO, input_dev_show_##name, NULL) @@ -1458,7 +1458,7 @@ static ssize_t inhibited_show(struct device *dev, { struct input_dev *input_dev = to_input_dev(dev); - return scnprintf(buf, PAGE_SIZE, "%d\n", input_dev->inhibited); + return sysfs_emit(buf, "%d\n", input_dev->inhibited); } static ssize_t inhibited_store(struct device *dev, @@ -1505,7 +1505,7 @@ static ssize_t input_dev_show_id_##name(struct device *dev, \ char *buf) \ { \ struct input_dev *input_dev = to_input_dev(dev); \ - return scnprintf(buf, PAGE_SIZE, "%04x\n", input_dev->id.name); \ + return sysfs_emit(buf, "%04x\n", input_dev->id.name); \ } \ static DEVICE_ATTR(name, S_IRUGO, input_dev_show_id_##name, NULL) |