* [PATCH] fpga: bridge: Use sysfs_emit() instead of sprintf()
@ 2026-01-17 4:36 Dinh Nguyen
2026-01-22 10:03 ` Xu Yilun
0 siblings, 1 reply; 3+ messages in thread
From: Dinh Nguyen @ 2026-01-17 4:36 UTC (permalink / raw)
To: mdf, yilun.xu, trix; +Cc: dinguyen, linux-fpga, linux-kernel
According to Documentation/filesystems/sysfs.rst, show() functions
should use sysfs_emit() when formatting the value to be returned to user
space.
Signed-off-by: Dinh Nguyen <dinguyen@kernel.org>
---
drivers/fpga/fpga-bridge.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/drivers/fpga/fpga-bridge.c b/drivers/fpga/fpga-bridge.c
index 8ef395b49bf8..d0d28d5f6112 100644
--- a/drivers/fpga/fpga-bridge.c
+++ b/drivers/fpga/fpga-bridge.c
@@ -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,
--
2.42.0.411.g813d9a9188
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH] fpga: bridge: Use sysfs_emit() instead of sprintf()
2026-01-17 4:36 [PATCH] fpga: bridge: Use sysfs_emit() instead of sprintf() Dinh Nguyen
@ 2026-01-22 10:03 ` Xu Yilun
2026-03-02 3:39 ` Xu Yilun
0 siblings, 1 reply; 3+ messages in thread
From: Xu Yilun @ 2026-01-22 10:03 UTC (permalink / raw)
To: Dinh Nguyen; +Cc: mdf, yilun.xu, trix, linux-fpga, linux-kernel
On Fri, Jan 16, 2026 at 10:36:26PM -0600, Dinh Nguyen wrote:
> According to Documentation/filesystems/sysfs.rst, show() functions
> should use sysfs_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
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH] fpga: bridge: Use sysfs_emit() instead of sprintf()
2026-01-22 10:03 ` Xu Yilun
@ 2026-03-02 3:39 ` Xu Yilun
0 siblings, 0 replies; 3+ messages in thread
From: Xu Yilun @ 2026-03-02 3:39 UTC (permalink / raw)
To: Dinh Nguyen; +Cc: mdf, yilun.xu, trix, linux-fpga, linux-kernel
On Thu, Jan 22, 2026 at 06:03:59PM +0800, Xu Yilun wrote:
> On Fri, Jan 16, 2026 at 10:36:26PM -0600, Dinh Nguyen wrote:
> > According to Documentation/filesystems/sysfs.rst, show() functions
> > should use sysfs_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.
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.
Reviewed-by: Xu Yilun <yilun.xu@intel.com>
>
> Thanks,
> Yilun
>
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2026-03-02 3:59 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2026-01-17 4:36 [PATCH] fpga: bridge: Use sysfs_emit() instead of sprintf() Dinh Nguyen
2026-01-22 10:03 ` Xu Yilun
2026-03-02 3:39 ` Xu Yilun
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®