From: Sumit Garg via OP-TEE <op-tee@lists.trustedfirmware.org>
To: Akhilesh Patil <akhilesh@ee.iitb.ac.in>
Cc: op-tee@lists.trustedfirmware.org, linux-kernel@vger.kernel.org,
akhileshpatilvnit@gmail.com, skhan@linuxfoundation.org
Subject: Re: [PATCH] drivers: tee: improve sysfs interface by using sysfs_emit()
Date: Mon, 21 Jul 2025 16:26:57 +0530 [thread overview]
Message-ID: <aH4c-bAN28Gmq86k@sumit-X1> (raw)
In-Reply-To: <aHpohUxxSH42w16U@bhairav-test.ee.iitb.ac.in>
On Fri, Jul 18, 2025 at 09:00:13PM +0530, Akhilesh Patil wrote:
> Replace scnprintf() with sysfs_emit() while formatting buffer that is
> passed to userspace as per the recommendation in
> Documentation/filesystems/sysfs.rst. sysfs _show() callbacks should use
> sysfs_emit() or sysfs_emit_at() while returning values to the userspace.
> This change does not impact functionality, but aligns with sysfs
> interface usage guidelines for the tee driver.
>
> Signed-off-by: Akhilesh Patil <akhilesh@ee.iitb.ac.in>
> ---
> drivers/tee/optee/core.c | 2 +-
> drivers/tee/tee_core.c | 2 +-
> 2 files changed, 2 insertions(+), 2 deletions(-)
Nice catch.
Reviewed-by: Sumit Garg <sumit.garg@oss.qualcomm.com>
-Sumit
>
> diff --git a/drivers/tee/optee/core.c b/drivers/tee/optee/core.c
> index c75fddc83576..ce44e3498d37 100644
> --- a/drivers/tee/optee/core.c
> +++ b/drivers/tee/optee/core.c
> @@ -72,7 +72,7 @@ static ssize_t rpmb_routing_model_show(struct device *dev,
> else
> s = "user";
>
> - return scnprintf(buf, PAGE_SIZE, "%s\n", s);
> + return sysfs_emit(buf, "%s\n", s);
> }
> static DEVICE_ATTR_RO(rpmb_routing_model);
>
> diff --git a/drivers/tee/tee_core.c b/drivers/tee/tee_core.c
> index acc7998758ad..944f913f8592 100644
> --- a/drivers/tee/tee_core.c
> +++ b/drivers/tee/tee_core.c
> @@ -977,7 +977,7 @@ static ssize_t implementation_id_show(struct device *dev,
> struct tee_ioctl_version_data vers;
>
> teedev->desc->ops->get_version(teedev, &vers);
> - return scnprintf(buf, PAGE_SIZE, "%d\n", vers.impl_id);
> + return sysfs_emit(buf, "%d\n", vers.impl_id);
> }
> static DEVICE_ATTR_RO(implementation_id);
>
> --
> 2.34.1
>
next prev parent reply other threads:[~2025-07-21 10:57 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-07-18 15:30 [PATCH] drivers: tee: improve sysfs interface by using sysfs_emit() Akhilesh Patil via OP-TEE
2025-07-21 10:56 ` Sumit Garg via OP-TEE [this message]
2025-08-04 11:20 ` Jens Wiklander
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=aH4c-bAN28Gmq86k@sumit-X1 \
--to=op-tee@lists.trustedfirmware.org \
--cc=akhilesh@ee.iitb.ac.in \
--cc=akhileshpatilvnit@gmail.com \
--cc=linux-kernel@vger.kernel.org \
--cc=skhan@linuxfoundation.org \
--cc=sumit.garg@kernel.org \
/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