Skip to contentSkip to conversation

accel/amdxdna: Replace sprintf() with sysfs_emit() in sysfs show functions

RFC PATCH New Archit More 1 participant 1 message Jun 29

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

RFC PATCH 1/1 accel/amdxdna: Replace sprintf() with sysfs_emit() in sysfs show functions

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.

---
 drivers/accel/amdxdna/amdxdna_sysfs.c | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)
drivers/accel/amdxdna/amdxdna_sysfs.c +4 -4
index d9e359ee8182..8b4749e6c380 100644
@@ -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);
 }
Signature · 1 line
2.34.1