Skip to contentSkip to conversation

bus: fsl-mc: convert sysfs snprintf and sprintf to sysfs_emit

PATCH New Bo Liu 1 participant 1 message Feb 1, 2023 QorIQ DPAA2 fsl-mc bus driver

lore
Share & tools
lore

Bo Liu

author
#0 lore raw

PATCH 1/1 bus: fsl-mc: convert sysfs snprintf and sprintf to sysfs_emit

Follow the advice of the Documentation/filesystems/sysfs.rst and show() should only use sysfs_emit() or sysfs_emit_at() when formatting the value to be returned to user space.

---
 drivers/bus/fsl-mc/fsl-mc-bus.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/bus/fsl-mc/fsl-mc-bus.c +2 -2
index 36cb091a33b4..94facaedf0b5 100644
@@ -174,7 +174,7 @@ static ssize_t modalias_show(struct device *dev, struct device_attribute *attr,
 {
 	struct fsl_mc_device *mc_dev = to_fsl_mc_device(dev);
 
-	return sprintf(buf, "fsl-mc:v%08Xd%s\n", mc_dev->obj_desc.vendor,
+	return sysfs_emit(buf, "fsl-mc:v%08Xd%s\n", mc_dev->obj_desc.vendor,
 		       mc_dev->obj_desc.type);
 }
 static DEVICE_ATTR_RO(modalias);
@@ -201,7 +201,7 @@ static ssize_t driver_override_show(struct device *dev,
 {
 	struct fsl_mc_device *mc_dev = to_fsl_mc_device(dev);
 
-	return snprintf(buf, PAGE_SIZE, "%s\n", mc_dev->driver_override);
+	return sysfs_emit(buf, "%s\n", mc_dev->driver_override);
 }
 static DEVICE_ATTR_RW(driver_override);
 
Signature · 1 line
2.27.0