[PATCH] hwmon: (hih6130) Replace sprintf() with sysfs_emit()

Massinissa Ghoul via B4 Relay posted 1 patch 2 weeks, 5 days ago
drivers/hwmon/hih6130.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
[PATCH] hwmon: (hih6130) Replace sprintf() with sysfs_emit()
Posted by Massinissa Ghoul via B4 Relay 2 weeks, 5 days ago
From: Massinissa Ghoul <massigh680@gmail.com>

Use sysfs_emit() instead of sprintf() in the sysfs show functions
hih6130_temperature_show() and hih6130_humidity_show() to use the
preferred kernel interface for writing to sysfs buffers.

No functional change intended.

Note: Not runtime tested due to lack of hardware.

Signed-off-by: Massinissa Ghoul <massigh680@gmail.com>
---
 drivers/hwmon/hih6130.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/hwmon/hih6130.c b/drivers/hwmon/hih6130.c
index 7984be1e706d..6a79aab5d128 100644
--- a/drivers/hwmon/hih6130.c
+++ b/drivers/hwmon/hih6130.c
@@ -168,7 +168,7 @@ static ssize_t hih6130_temperature_show(struct device *dev,
 	ret = hih6130_update_measurements(dev);
 	if (ret < 0)
 		return ret;
-	return sprintf(buf, "%d\n", hih6130->temperature);
+	return sysfs_emit(buf, "%d\n", hih6130->temperature);
 }
 
 /**
@@ -189,7 +189,7 @@ static ssize_t hih6130_humidity_show(struct device *dev,
 	ret = hih6130_update_measurements(dev);
 	if (ret < 0)
 		return ret;
-	return sprintf(buf, "%d\n", hih6130->humidity);
+	return sysfs_emit(buf, "%d\n", hih6130->humidity);
 }
 
 /* sysfs attributes */

---
base-commit: ba08432bda66a7889d8f3d1581dabf10f59b25eb
change-id: 20260907-hwmon-hih6130-sysfs-emit-075116223077

Best regards,
--  
Massinissa Ghoul <massigh680@gmail.com>
Re: [PATCH] hwmon: (hih6130) Replace sprintf() with sysfs_emit()
Posted by Guenter Roeck 2 weeks, 3 days ago
On Mon, Sep 07, 2026 at 12:35:02AM +0200, Massinissa Ghoul wrote:
> From: Massinissa Ghoul <massigh680@gmail.com>
> 
> Use sysfs_emit() instead of sprintf() in the sysfs show functions
> hih6130_temperature_show() and hih6130_humidity_show() to use the
> preferred kernel interface for writing to sysfs buffers.
> 
> No functional change intended.
> 
> Note: Not runtime tested due to lack of hardware.
> 
> Signed-off-by: Massinissa Ghoul <massigh680@gmail.com>

Applied.

Thanks,
Guenter