linux-input.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH linux-next] Input: synaptics-rmi4 - Convert to use sysfs_emit() APIs
@ 2022-09-27  7:09 zhangsongyi.cgel
  2022-09-28  0:48 ` Dmitry Torokhov
  0 siblings, 1 reply; 2+ messages in thread
From: zhangsongyi.cgel @ 2022-09-27  7:09 UTC (permalink / raw)
  To: dmitry.torokhov; +Cc: zhang.songyi, linux-input, linux-kernel, Zeal Robot

From: zhang songyi <zhang.songyi@zte.com.cn>

Follow the advice of the Documentation/filesystems/sysfs.rst and show()
should only use sysfs_emit() or sysfs_emit_at() when formatting the value
to be returned to user space.

Reported-by: Zeal Robot <zealci@zte.com.cn>
Signed-off-by: zhang songyi <zhang.songyi@zte.com.cn>
---
 drivers/input/rmi4/rmi_f34.c | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/drivers/input/rmi4/rmi_f34.c b/drivers/input/rmi4/rmi_f34.c
index e5dca9868f87..e6e7dde76c5b 100644
--- a/drivers/input/rmi4/rmi_f34.c
+++ b/drivers/input/rmi4/rmi_f34.c
@@ -321,11 +321,11 @@ static ssize_t rmi_driver_bootloader_id_show(struct device *dev,
 		f34 = dev_get_drvdata(&fn->dev);
 
 		if (f34->bl_version == 5)
-			return scnprintf(buf, PAGE_SIZE, "%c%c\n",
+			return sysfs_emit(buf, "%c%c\n",
 					 f34->bootloader_id[0],
 					 f34->bootloader_id[1]);
 		else
-			return scnprintf(buf, PAGE_SIZE, "V%d.%d\n",
+			return sysfs_emit(buf, "V%d.%d\n",
 					 f34->bootloader_id[1],
 					 f34->bootloader_id[0]);
 	}
@@ -346,7 +346,7 @@ static ssize_t rmi_driver_configuration_id_show(struct device *dev,
 	if (fn) {
 		f34 = dev_get_drvdata(&fn->dev);
 
-		return scnprintf(buf, PAGE_SIZE, "%s\n", f34->configuration_id);
+		return sysfs_emit(buf, "%s\n", f34->configuration_id);
 	}
 
 	return 0;
@@ -499,7 +499,7 @@ static ssize_t rmi_driver_update_fw_status_show(struct device *dev,
 	if (data->f34_container)
 		update_status = rmi_f34_status(data->f34_container);
 
-	return scnprintf(buf, PAGE_SIZE, "%d\n", update_status);
+	return sysfs_emit(buf, "%d\n", update_status);
 }
 
 static DEVICE_ATTR(update_fw_status, 0444,
-- 
2.25.1



^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [PATCH linux-next] Input: synaptics-rmi4 - Convert to use sysfs_emit() APIs
  2022-09-27  7:09 [PATCH linux-next] Input: synaptics-rmi4 - Convert to use sysfs_emit() APIs zhangsongyi.cgel
@ 2022-09-28  0:48 ` Dmitry Torokhov
  0 siblings, 0 replies; 2+ messages in thread
From: Dmitry Torokhov @ 2022-09-28  0:48 UTC (permalink / raw)
  To: zhangsongyi.cgel; +Cc: zhang.songyi, linux-input, linux-kernel, Zeal Robot

On Tue, Sep 27, 2022 at 07:09:36AM +0000, zhangsongyi.cgel@gmail.com wrote:
> From: zhang songyi <zhang.songyi@zte.com.cn>
> 
> Follow the advice of the Documentation/filesystems/sysfs.rst and show()
> should only use sysfs_emit() or sysfs_emit_at() when formatting the value
> to be returned to user space.
> 
> Reported-by: Zeal Robot <zealci@zte.com.cn>
> Signed-off-by: zhang songyi <zhang.songyi@zte.com.cn>

Applied, thank you.

-- 
Dmitry

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2022-09-28  0:48 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-09-27  7:09 [PATCH linux-next] Input: synaptics-rmi4 - Convert to use sysfs_emit() APIs zhangsongyi.cgel
2022-09-28  0:48 ` 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).