diff mbox series

Input: use sysfs_emit() to instead of scnprintf()

Message ID 202212011554474934696@zte.com.cn
State Accepted
Commit 4c9abd78aa0c04809e24120cafcbbd88c0a80a80
Headers show
Series Input: use sysfs_emit() to instead of scnprintf() | expand

Commit Message

ye.xingchen@zte.com.cn Dec. 1, 2022, 7:54 a.m. UTC
From: ye xingchen <ye.xingchen@zte.com.cn>

Replace the open-code with sysfs_emit() to simplify the code.

Signed-off-by: ye xingchen <ye.xingchen@zte.com.cn>
---
 drivers/input/input.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)
diff mbox series

Patch

diff --git a/drivers/input/input.c b/drivers/input/input.c
index ca2e3dd7188b..4e4643e74ac5 100644
--- a/drivers/input/input.c
+++ b/drivers/input/input.c
@@ -1362,7 +1362,7 @@  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",			\
+	return sysfs_emit(buf, "%s\n",			\
 			 input_dev->name ? input_dev->name : "");	\
 }									\
 static DEVICE_ATTR(name, S_IRUGO, input_dev_show_##name, NULL)
@@ -1455,7 +1455,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,
@@ -1502,7 +1502,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)