* [PATCH v2] Input: use sysfs_emit() to instead of scnprintf()
@ 2022-12-02 3:33 ye.xingchen
2023-12-13 6:57 ` Dmitry Torokhov
0 siblings, 1 reply; 2+ messages in thread
From: ye.xingchen @ 2022-12-02 3:33 UTC (permalink / raw)
To: dmitry.torokhov; +Cc: linux-input, linux-kernel, jeff
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>
---
v1 -> v2
Fix the code style.
drivers/input/input.c | 8 ++++----
1 file changed, 4 insertions(+), 4 deletions(-)
diff --git a/drivers/input/input.c b/drivers/input/input.c
index ca2e3dd7188b..c061bbe96086 100644
--- a/drivers/input/input.c
+++ b/drivers/input/input.c
@@ -1362,8 +1362,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)
@@ -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)
--
2.25.1
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: [PATCH v2] Input: use sysfs_emit() to instead of scnprintf()
2022-12-02 3:33 [PATCH v2] Input: use sysfs_emit() to instead of scnprintf() ye.xingchen
@ 2023-12-13 6:57 ` Dmitry Torokhov
0 siblings, 0 replies; 2+ messages in thread
From: Dmitry Torokhov @ 2023-12-13 6:57 UTC (permalink / raw)
To: ye.xingchen; +Cc: linux-input, linux-kernel, jeff
On Fri, Dec 02, 2022 at 11:33:39AM +0800, ye.xingchen@zte.com.cn wrote:
> 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>
Applied, thank you.
--
Dmitry
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2023-12-13 6:57 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2022-12-02 3:33 [PATCH v2] Input: use sysfs_emit() to instead of scnprintf() ye.xingchen
2023-12-13 6:57 ` Dmitry Torokhov
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).