linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] thermal/int340x_thermal: Convert to use sysfs_emit_at() API
@ 2023-01-17  2:42 ye.xingchen
  2023-01-20 17:00 ` Rafael J. Wysocki
  0 siblings, 1 reply; 4+ messages in thread
From: ye.xingchen @ 2023-01-17  2:42 UTC (permalink / raw)
  To: rafael
  Cc: daniel.lezcano, amitk, rui.zhang, srinivas.pandruvada, dave,
	chuansheng.liu, joeyli.kernel, jiasheng, linux-pm, linux-kernel

From: ye xingchen <ye.xingchen@zte.com.cn>

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.

Signed-off-by: ye xingchen <ye.xingchen@zte.com.cn>
---
 .../thermal/intel/int340x_thermal/int3400_thermal.c    | 10 ++--------
 1 file changed, 2 insertions(+), 8 deletions(-)

diff --git a/drivers/thermal/intel/int340x_thermal/int3400_thermal.c b/drivers/thermal/intel/int340x_thermal/int3400_thermal.c
index db8a6f63657d..c1fc4a78607c 100644
--- a/drivers/thermal/intel/int340x_thermal/int3400_thermal.c
+++ b/drivers/thermal/intel/int340x_thermal/int3400_thermal.c
@@ -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

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

* Re: [PATCH] thermal/int340x_thermal: Convert to use sysfs_emit_at() API
  2023-01-17  2:42 [PATCH] thermal/int340x_thermal: Convert to use sysfs_emit_at() API ye.xingchen
@ 2023-01-20 17:00 ` Rafael J. Wysocki
  0 siblings, 0 replies; 4+ messages in thread
From: Rafael J. Wysocki @ 2023-01-20 17:00 UTC (permalink / raw)
  To: ye.xingchen
  Cc: rafael, daniel.lezcano, amitk, rui.zhang, srinivas.pandruvada,
	dave, chuansheng.liu, joeyli.kernel, jiasheng, linux-pm,
	linux-kernel

On Tue, Jan 17, 2023 at 3:42 AM <ye.xingchen@zte.com.cn> wrote:
>
> From: ye xingchen <ye.xingchen@zte.com.cn>
>
> 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.
>
> Signed-off-by: ye xingchen <ye.xingchen@zte.com.cn>
> ---
>  .../thermal/intel/int340x_thermal/int3400_thermal.c    | 10 ++--------
>  1 file changed, 2 insertions(+), 8 deletions(-)
>
> diff --git a/drivers/thermal/intel/int340x_thermal/int3400_thermal.c b/drivers/thermal/intel/int340x_thermal/int3400_thermal.c
> index db8a6f63657d..c1fc4a78607c 100644
> --- a/drivers/thermal/intel/int340x_thermal/int3400_thermal.c
> +++ b/drivers/thermal/intel/int340x_thermal/int3400_thermal.c
> @@ -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)
> --

Applied as 6.3 material with a modified changelog, thanks!

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

* Re: [PATCH] thermal/int340x_thermal: Convert to use sysfs_emit_at() API
  2022-12-08  9:07 ye.xingchen
@ 2022-12-08 11:50 ` Rafael J. Wysocki
  0 siblings, 0 replies; 4+ messages in thread
From: Rafael J. Wysocki @ 2022-12-08 11:50 UTC (permalink / raw)
  To: ye.xingchen
  Cc: rafael, daniel.lezcano, amitk, rui.zhang, srinivas.pandruvada,
	dave, keescook, sumeet.r.pawnikar, jiasheng, linux-pm,
	linux-kernel

On Thu, Dec 8, 2022 at 10:07 AM <ye.xingchen@zte.com.cn> wrote:
>
> From: ye xingchen <ye.xingchen@zte.com.cn>
>
> 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.
>
> Signed-off-by: ye xingchen <ye.xingchen@zte.com.cn>

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.

> ---
>  .../thermal/intel/int340x_thermal/int3400_thermal.c    | 10 ++--------
>  1 file changed, 2 insertions(+), 8 deletions(-)
>
> diff --git a/drivers/thermal/intel/int340x_thermal/int3400_thermal.c b/drivers/thermal/intel/int340x_thermal/int3400_thermal.c
> index db8a6f63657d..c1fc4a78607c 100644
> --- a/drivers/thermal/intel/int340x_thermal/int3400_thermal.c
> +++ b/drivers/thermal/intel/int340x_thermal/int3400_thermal.c
> @@ -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

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

* [PATCH] thermal/int340x_thermal: Convert to use sysfs_emit_at() API
@ 2022-12-08  9:07 ye.xingchen
  2022-12-08 11:50 ` Rafael J. Wysocki
  0 siblings, 1 reply; 4+ messages in thread
From: ye.xingchen @ 2022-12-08  9:07 UTC (permalink / raw)
  To: rafael
  Cc: daniel.lezcano, amitk, rui.zhang, srinivas.pandruvada, dave,
	keescook, sumeet.r.pawnikar, jiasheng, linux-pm, linux-kernel

From: ye xingchen <ye.xingchen@zte.com.cn>

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.

Signed-off-by: ye xingchen <ye.xingchen@zte.com.cn>
---
 .../thermal/intel/int340x_thermal/int3400_thermal.c    | 10 ++--------
 1 file changed, 2 insertions(+), 8 deletions(-)

diff --git a/drivers/thermal/intel/int340x_thermal/int3400_thermal.c b/drivers/thermal/intel/int340x_thermal/int3400_thermal.c
index db8a6f63657d..c1fc4a78607c 100644
--- a/drivers/thermal/intel/int340x_thermal/int3400_thermal.c
+++ b/drivers/thermal/intel/int340x_thermal/int3400_thermal.c
@@ -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

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

end of thread, other threads:[~2023-01-20 17:01 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-01-17  2:42 [PATCH] thermal/int340x_thermal: Convert to use sysfs_emit_at() API ye.xingchen
2023-01-20 17:00 ` Rafael J. Wysocki
  -- strict thread matches above, loose matches on Subject: below --
2022-12-08  9:07 ye.xingchen
2022-12-08 11:50 ` Rafael J. Wysocki

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).