[PATCH 06/42] drivers/bus/fsl-mc: Convert snprintf to sysfs_emit

From: Li Zhijian
Date: Mon Jan 15 2024 - 23:53:05 EST


Per filesystems/sysfs.rst, show() should only use sysfs_emit()
or sysfs_emit_at() when formatting the value to be returned to user space.

coccinelle complains that there are still a couple of functions that use
snprintf(). Convert them to sysfs_emit().

> ./drivers/bus/fsl-mc/fsl-mc-bus.c:205:8-16: WARNING: please use sysfs_emit

No functional change intended

CC: Stuart Yoder <stuyoder@xxxxxxxxx>
CC: Laurentiu Tudor <laurentiu.tudor@xxxxxxx>
Signed-off-by: Li Zhijian <lizhijian@xxxxxxxxxxx>
---
drivers/bus/fsl-mc/fsl-mc-bus.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/bus/fsl-mc/fsl-mc-bus.c b/drivers/bus/fsl-mc/fsl-mc-bus.c
index 2f6d5002e43d..e77e230332b8 100644
--- a/drivers/bus/fsl-mc/fsl-mc-bus.c
+++ b/drivers/bus/fsl-mc/fsl-mc-bus.c
@@ -202,7 +202,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);

--
2.29.2