From: Greg KH <gregkh@linuxfoundation.org>
To: Sumanth Gavini <sumanth.gavini@yahoo.com>
Cc: crwulff@gmail.com, linux-usb@vger.kernel.org,
linux-kernel@vger.kernel.org, skhan@linuxfoundation.org,
david.hunter.linux@gmail.com
Subject: Re: [PATCH] usb: gadget: f_uac1: replace scnprintf() with sysfs_emit()
Date: Mon, 21 Jul 2025 16:31:26 +0200 [thread overview]
Message-ID: <2025072103-pointing-ravioli-493b@gregkh> (raw)
In-Reply-To: <20250718175037.299710-1-sumanth.gavini@yahoo.com>
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...
prev parent reply other threads:[~2025-07-21 14:31 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
[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 message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=2025072103-pointing-ravioli-493b@gregkh \
--to=gregkh@linuxfoundation.org \
--cc=crwulff@gmail.com \
--cc=david.hunter.linux@gmail.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-usb@vger.kernel.org \
--cc=skhan@linuxfoundation.org \
--cc=sumanth.gavini@yahoo.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
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).