linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] usb: gadget: f_uac1: replace scnprintf() with sysfs_emit()
       [not found] <20250718175037.299710-1-sumanth.gavini.ref@yahoo.com>
@ 2025-07-18 17:50 ` Sumanth Gavini
  2025-07-21 14:31   ` Greg KH
  0 siblings, 1 reply; 2+ messages in thread
From: Sumanth Gavini @ 2025-07-18 17:50 UTC (permalink / raw)
  To: gregkh, crwulff, sumanth.gavini
  Cc: linux-usb, linux-kernel, skhan, david.hunter.linux

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_uac1.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/usb/gadget/function/f_uac1.c b/drivers/usb/gadget/function/f_uac1.c
index c87e74afc881..9da9fb4e1239 100644
--- a/drivers/usb/gadget/function/f_uac1.c
+++ b/drivers/usb/gadget/function/f_uac1.c
@@ -1634,7 +1634,7 @@ static ssize_t f_uac1_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


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

* Re: [PATCH] usb: gadget: f_uac1: replace scnprintf() with sysfs_emit()
  2025-07-18 17:50 ` [PATCH] usb: gadget: f_uac1: replace scnprintf() with sysfs_emit() Sumanth Gavini
@ 2025-07-21 14:31   ` Greg KH
  0 siblings, 0 replies; 2+ messages in thread
From: Greg KH @ 2025-07-21 14:31 UTC (permalink / raw)
  To: Sumanth Gavini
  Cc: crwulff, linux-usb, linux-kernel, skhan, david.hunter.linux

On Fri, Jul 18, 2025 at 12:50:35PM -0500, Sumanth Gavini wrote:
> 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_uac1.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/drivers/usb/gadget/function/f_uac1.c b/drivers/usb/gadget/function/f_uac1.c
> index c87e74afc881..9da9fb4e1239 100644
> --- a/drivers/usb/gadget/function/f_uac1.c
> +++ b/drivers/usb/gadget/function/f_uac1.c
> @@ -1634,7 +1634,7 @@ static ssize_t f_uac1_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
> 
> 

Note, this really isn't needed at all, you should only use sysfs_emit()
for new code, but this "cleanup" is simple enough...

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

end of thread, other threads:[~2025-07-21 14:31 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
     [not found] <20250718175037.299710-1-sumanth.gavini.ref@yahoo.com>
2025-07-18 17:50 ` [PATCH] usb: gadget: f_uac1: replace scnprintf() with sysfs_emit() Sumanth Gavini
2025-07-21 14:31   ` Greg KH

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).