Skip to contentSkip to conversation

thermal/int340x_thermal: Convert to use sysfs_emit_at() API

PATCH In review [email protected] 2 participants 2 messages Dec 8, 2022 Thermal

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 thermal/int340x_thermal: Convert to use sysfs_emit_at() API

From: ye xingchen <[email protected]>

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.

---
 .../thermal/intel/int340x_thermal/int3400_thermal.c    | 10 ++--------
 1 file changed, 2 insertions(+), 8 deletions(-)
drivers/thermal/intel/int340x_thermal/int3400_thermal.c +2 -8
index db8a6f63657d..c1fc4a78607c 100644
@@ -130,10 +130,7 @@ static ssize_t available_uuids_show(struct device *dev,
 
 	for (i = 0; i < INT3400_THERMAL_MAXIMUM_UUID; i++) {
 		if (priv->uuid_bitmap & (1 << i))
-			length += scnprintf(&buf[length],
-					    PAGE_SIZE - length,
-					    "%s\n",
-					    int3400_thermal_uuids[i]);
+			length += sysfs_emit_at(buf, length, int3400_thermal_uuids[i]);
 	}
 
 	return length;
@@ -151,10 +148,7 @@ static ssize_t current_uuid_show(struct device *dev,
 
 	for (i = 0; i <= INT3400_THERMAL_CRITICAL; i++) {
 		if (priv->os_uuid_mask & BIT(i))
-			length += scnprintf(&buf[length],
-					    PAGE_SIZE - length,
-					    "%s\n",
-					    int3400_thermal_uuids[i]);
+			length += sysfs_emit_at(buf, length, int3400_thermal_uuids[i]);
 	}
 
 	if (length)
Signature · 1 line
2.25.1
#1 lore raw
Quoted 8 lines · On Thu, Dec 8, 2022 at 10:07 AM <[email protected]> wrote:

From: ye xingchen <[email protected]>

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.

Well, you've clearly not taken my feedback into account.

Please resend this after 6.2-rc1 is out. It will not be acted upon till then.

Quoted 34 lines
---
 .../thermal/intel/int340x_thermal/int3400_thermal.c    | 10 ++--------
 1 file changed, 2 insertions(+), 8 deletions(-)
drivers/thermal/intel/int340x_thermal/int3400_thermal.c +2 -9
index db8a6f63657d..c1fc4a78607c 100644
@@ -130,10 +130,7 @@ static ssize_t available_uuids_show(struct device *dev,
 
        for (i = 0; i < INT3400_THERMAL_MAXIMUM_UUID; i++) {
                if (priv->uuid_bitmap & (1 << i))
-                       length += scnprintf(&buf[length],
-                                           PAGE_SIZE - length,
-                                           "%s\n",
-                                           int3400_thermal_uuids[i]);
+                       length += sysfs_emit_at(buf, length, int3400_thermal_uuids[i]);
        }
 
        return length;
@@ -151,10 +148,7 @@ static ssize_t current_uuid_show(struct device *dev,
 
        for (i = 0; i <= INT3400_THERMAL_CRITICAL; i++) {
                if (priv->os_uuid_mask & BIT(i))
-                       length += scnprintf(&buf[length],
-                                           PAGE_SIZE - length,
-                                           "%s\n",
-                                           int3400_thermal_uuids[i]);
+                       length += sysfs_emit_at(buf, length, int3400_thermal_uuids[i]);
        }
 
        if (length)
--

2.25.1