linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] hwmon: max31827: use sysfs_emit() in temp1_resolution_show()
@ 2025-07-12 13:14 Khaled Elnaggar
  2025-07-16 14:48 ` Guenter Roeck
  0 siblings, 1 reply; 2+ messages in thread
From: Khaled Elnaggar @ 2025-07-12 13:14 UTC (permalink / raw)
  To: jdelvare, linux
  Cc: Khaled Elnaggar, linux-kernel-mentees, shuah, linux-hwmon,
	linux-kernel

Replace scnprintf() with sysfs_emit() in temp1_resolution_show(),
as recommended in Documentation/filesystems/sysfs.rst: show() callbacks
should use sysfs_emit() or sysfs_emit_at() to format values returned to
userspace.

Signed-off-by: Khaled Elnaggar <khaledelnaggarlinux@gmail.com>
---
 drivers/hwmon/max31827.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/hwmon/max31827.c b/drivers/hwmon/max31827.c
index 48e8f8ba4d05..c423cabcb28b 100644
--- a/drivers/hwmon/max31827.c
+++ b/drivers/hwmon/max31827.c
@@ -445,7 +445,7 @@ static ssize_t temp1_resolution_show(struct device *dev,

 	val = FIELD_GET(MAX31827_CONFIGURATION_RESOLUTION_MASK, val);

-	return scnprintf(buf, PAGE_SIZE, "%u\n", max31827_resolutions[val]);
+	return sysfs_emit(buf, "%u\n", max31827_resolutions[val]);
 }

 static ssize_t temp1_resolution_store(struct device *dev,
--
2.47.2


^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [PATCH] hwmon: max31827: use sysfs_emit() in temp1_resolution_show()
  2025-07-12 13:14 [PATCH] hwmon: max31827: use sysfs_emit() in temp1_resolution_show() Khaled Elnaggar
@ 2025-07-16 14:48 ` Guenter Roeck
  0 siblings, 0 replies; 2+ messages in thread
From: Guenter Roeck @ 2025-07-16 14:48 UTC (permalink / raw)
  To: Khaled Elnaggar
  Cc: jdelvare, linux-kernel-mentees, shuah, linux-hwmon, linux-kernel

On Sat, Jul 12, 2025 at 04:14:46PM +0300, Khaled Elnaggar wrote:
> Replace scnprintf() with sysfs_emit() in temp1_resolution_show(),
> as recommended in Documentation/filesystems/sysfs.rst: show() callbacks
> should use sysfs_emit() or sysfs_emit_at() to format values returned to
> userspace.
> 
> Signed-off-by: Khaled Elnaggar <khaledelnaggarlinux@gmail.com>

Applied.

Thanks,
Guenter

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2025-07-16 14:48 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-07-12 13:14 [PATCH] hwmon: max31827: use sysfs_emit() in temp1_resolution_show() Khaled Elnaggar
2025-07-16 14:48 ` Guenter Roeck

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).