]> Gentwo Git Trees - linux/.git/commitdiff
drivers: tee: improve sysfs interface by using sysfs_emit()
authorAkhilesh Patil <akhilesh@ee.iitb.ac.in>
Fri, 18 Jul 2025 15:30:13 +0000 (21:00 +0530)
committerJens Wiklander <jens.wiklander@linaro.org>
Mon, 4 Aug 2025 09:05:23 +0000 (11:05 +0200)
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>
Reviewed-by: Sumit Garg <sumit.garg@oss.qualcomm.com>
Signed-off-by: Jens Wiklander <jens.wiklander@linaro.org>
drivers/tee/optee/core.c
drivers/tee/tee_core.c

index c75fddc83576a5debf51e703176dd240003e9e06..ce44e3498d37bdeeee7ceb3f9bc047fea903a1f8 100644 (file)
@@ -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);
 
index acc7998758ad8431655077e2645e4b9ac4eb47ba..944f913f859272ad1d94af4aa7589be5cf08489f 100644 (file)
@@ -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);