dri-devel Archive on lore.kernel.org
 help / color / mirror / Atom feed
* [RFC PATCH] accel/amdxdna: Replace sprintf() with sysfs_emit() in sysfs show functions
@ 2026-06-29 15:07 Archit More
  0 siblings, 0 replies; only message in thread
From: Archit More @ 2026-06-29 15:07 UTC (permalink / raw)
  To: lizhi.hou, mamin506, ogabbay; +Cc: dri-devel, linux-kernel, Archit More

Documentation/filesystems/sysfs.rst recommends using sysfs_emit()
instead of sprintf() in sysfs show() callbacks.

Replace the remaining sprintf() calls in amdxdna_sysfs.c with
sysfs_emit(). There is no functional change.

Signed-off-by: Archit More <architmore303@gmail.com>
---
 drivers/accel/amdxdna/amdxdna_sysfs.c | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/drivers/accel/amdxdna/amdxdna_sysfs.c b/drivers/accel/amdxdna/amdxdna_sysfs.c
index d9e359ee8182..8b4749e6c380 100644
--- a/drivers/accel/amdxdna/amdxdna_sysfs.c
+++ b/drivers/accel/amdxdna/amdxdna_sysfs.c
@@ -18,9 +18,9 @@ static ssize_t vbnv_show(struct device *dev, struct device_attribute *attr, char
 	struct amdxdna_dev *xdna = dev_get_drvdata(dev);
 
 	if (!xdna->vbnv)
-		return sprintf(buf, "\n");
+		return sysfs_emit(buf, "\n");
 
-	return sprintf(buf, "%s\n", xdna->vbnv);
+	return sysfs_emit(buf, "%s\n", xdna->vbnv);
 }
 static DEVICE_ATTR_RO(vbnv);
 
@@ -28,7 +28,7 @@ static ssize_t device_type_show(struct device *dev, struct device_attribute *att
 {
 	struct amdxdna_dev *xdna = dev_get_drvdata(dev);
 
-	return sprintf(buf, "%d\n", xdna->dev_info->device_type);
+	return sysfs_emit(buf, "%d\n", xdna->dev_info->device_type);
 }
 static DEVICE_ATTR_RO(device_type);
 
@@ -36,7 +36,7 @@ static ssize_t fw_version_show(struct device *dev, struct device_attribute *attr
 {
 	struct amdxdna_dev *xdna = dev_get_drvdata(dev);
 
-	return sprintf(buf, "%d.%d.%d.%d\n", xdna->fw_ver.major,
+	return sysfs_emit(buf, "%d.%d.%d.%d\n", xdna->fw_ver.major,
 		       xdna->fw_ver.minor, xdna->fw_ver.sub,
 		       xdna->fw_ver.build);
 }
-- 
2.34.1


^ permalink raw reply related	[flat|nested] only message in thread

only message in thread, other threads:[~2026-06-30  7:19 UTC | newest]

Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-06-29 15:07 [RFC PATCH] accel/amdxdna: Replace sprintf() with sysfs_emit() in sysfs show functions Archit More

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox