[PATCH] usb: gadget: f_uac2: replace scnprintf() with sysfs_emit()

Sumanth Gavini posted 1 patch 3 months ago
drivers/usb/gadget/function/f_uac2.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
[PATCH] usb: gadget: f_uac2: replace scnprintf() with sysfs_emit()
Posted by Sumanth Gavini 3 months ago
Documentation/filesystems/sysfs.rst mentions that show() should only
use sysfs_emit() or sysfs_emit_at() when formating the value to be
returned to user space. So replace scnprintf() with sysfs_emit().

Signed-off-by: Sumanth Gavini <sumanth.gavini@yahoo.com>
---
 drivers/usb/gadget/function/f_uac2.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/usb/gadget/function/f_uac2.c b/drivers/usb/gadget/function/f_uac2.c
index 9b324821c93b..dd252ff2fb4e 100644
--- a/drivers/usb/gadget/function/f_uac2.c
+++ b/drivers/usb/gadget/function/f_uac2.c
@@ -2052,7 +2052,7 @@ static ssize_t f_uac2_opts_##name##_show(struct config_item *item,	\
 	int result;							\
 									\
 	mutex_lock(&opts->lock);					\
-	result = scnprintf(page, sizeof(opts->name), "%s", opts->name);	\
+	result = sysfs_emit(page, "%s", opts->name);	                \
 	mutex_unlock(&opts->lock);					\
 									\
 	return result;							\
-- 
2.43.0
[PATCH] usb: gadget: f_uac2: replace scnprintf() with sysfs_emit()
Posted by Sumanth Gavini 2 months, 3 weeks ago
Hi All,

Just following up on my patch submitted with subject "[PATCH] usb: gadget: f_uac2: replace scnprintf() with sysfs_emit()".

Original message: https://lore.kernel.org/all/20250704003425.467299-1-sumanth.gavini@yahoo.com/

Would you have any feedback on this change? I'd be happy to address any comments or concerns.

Thank you for your time and consideration.

Regards,
Sumanth Gavini
Re: [PATCH] usb: gadget: f_uac2: replace scnprintf() with sysfs_emit()
Posted by Greg KH 2 months, 3 weeks ago
On Wed, Jul 16, 2025 at 07:17:07PM -0500, Sumanth Gavini wrote:
> Hi All,
> 
> Just following up on my patch submitted with subject "[PATCH] usb: gadget: f_uac2: replace scnprintf() with sysfs_emit()".
> 
> Original message: https://lore.kernel.org/all/20250704003425.467299-1-sumanth.gavini@yahoo.com/
> 
> Would you have any feedback on this change? I'd be happy to address any comments or concerns.

It was merged into my tree 10 days ago, you should have gotten an email
about it already, right?  Look in linux-next, it's there.

confused,

greg k-h