[PATCH] bus: fsl-mc: Replace snprintf with sysfs_emit in sysfs show functions

Subsystems: qoriq dpaa2 fsl-mc bus driver, the rest

STALE345d

2 messages, 2 authors, 2025-08-22 · open the first message on its own page

[PATCH] bus: fsl-mc: Replace snprintf with sysfs_emit in sysfs show functions

From: Chelsy Ratnawat <hidden>
Date: 2025-08-22 12:15:43

Use sysfs_emit() instead of snprintf() when writing to sysfs buffers,
as recommended by the kernel documentation.

Signed-off-by: Chelsy Ratnawat <redacted>
---
 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 c1c0a4759c7e..13172a0cdb48 100644
--- a/drivers/bus/fsl-mc/fsl-mc-bus.c
+++ b/drivers/bus/fsl-mc/fsl-mc-bus.c
@@ -203,7 +203,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.47.3

Re: [PATCH] bus: fsl-mc: Replace snprintf with sysfs_emit in sysfs show functions

From: Christophe Leroy <hidden>
Date: 2025-08-22 13:20:39


Le 22/08/2025 à 13:57, Chelsy Ratnawat a écrit :
Use sysfs_emit() instead of snprintf() when writing to sysfs buffers,
as recommended by the kernel documentation.
Change modalias_show() at the same time.

Christophe
quoted hunk
Signed-off-by: Chelsy Ratnawat <redacted>
---
  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 c1c0a4759c7e..13172a0cdb48 100644
--- a/drivers/bus/fsl-mc/fsl-mc-bus.c
+++ b/drivers/bus/fsl-mc/fsl-mc-bus.c
@@ -203,7 +203,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.47.3

Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help