fpga: bridge: Use sysfs_emit() instead of sprintf()
PATCH 1/1 fpga: bridge: Use sysfs_emit() instead of sprintf()
According to Documentation/filesystems/sysfs.rst, show() functions should use sysfs_emit() when formatting the value to be returned to user space.
--- drivers/fpga/fpga-bridge.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/fpga/fpga-bridge.c +1 -1
@@ -290,7 +290,7 @@ static ssize_t name_show(struct device *dev, {struct fpga_bridge *bridge =to_fpga_bridge (dev); -return sprintf (buf,"%s\n" , bridge->name); +return sysfs_emit (buf,"%s\n" , bridge->name); } static ssize_t state_show(struct device *dev,
Signature · 1 line
2.42.0.411.g813d9a9188
Quoted 2 lines · Dinh Nguyen
According to
Documentation/filesystems/sysfs.rst,show()functions should usesysfs_emit()when formatting the value to be returned to user
The doc says "New implementations ... should only use ...". The existing code is OK, the patch is also OK, but sorry I expect we don't churn code just for doing it. We could also append these trivial changes along with patchsets that make real improvements.
Thanks,
Yilun
Xu Yilun
Reviewed-byQuoted 8 lines · Xu Yilun
Quoted 2 lines · Dinh Nguyen
According to
Documentation/filesystems/sysfs.rst,show()functions should usesysfs_emit()when formatting the value to be returned to userThe doc says "New implementations ... should only use ...". The existing code is OK, the patch is also OK, but sorry I expect we don't churn code just for doing it. We could also append these trivial changes along with patchsets that make real improvements.
I'm sorry. I changed my mind and would like to apply this patch. This change solves the inconsistent usage of sprintf() & sysfs_emit() in the same file.
Quoted 4 lines
Thanks,
Yilun