LKML Archive mirror
 help / color / mirror / Atom feed
* [PATCH] thermal: int340x: Add new line for UUID display
@ 2023-05-22 22:38 Srinivas Pandruvada
  2023-05-24 17:51 ` Rafael J. Wysocki
  0 siblings, 1 reply; 2+ messages in thread
From: Srinivas Pandruvada @ 2023-05-22 22:38 UTC (permalink / raw
  To: rafael, rui.zhang, daniel.lezcano
  Cc: linux-pm, linux-kernel, Srinivas Pandruvada, stable

Prior to the commit:
"763bd29fd3d1 ("thermal: int340x_thermal: Use sysfs_emit_at() instead of
scnprintf()"
there was a new line after each UUID string. With the newline removed,
existing user space like "thermald" fails to compare each supported UUID
as it is using getline() to read UUID and apply correct thermal table.

To avoid breaking existing user space, add newline after each UUID string.

Signed-off-by: Srinivas Pandruvada <srinivas.pandruvada@linux.intel.com>
Fixes: 763bd29fd3d1 ("thermal: int340x_thermal: Use sysfs_emit_at() instead of scnprintf()")
Cc: stable@vger.kernel.org # v6.3+
---
 drivers/thermal/intel/int340x_thermal/int3400_thermal.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/thermal/intel/int340x_thermal/int3400_thermal.c b/drivers/thermal/intel/int340x_thermal/int3400_thermal.c
index 810231b59dcd..5e1164226ada 100644
--- a/drivers/thermal/intel/int340x_thermal/int3400_thermal.c
+++ b/drivers/thermal/intel/int340x_thermal/int3400_thermal.c
@@ -131,7 +131,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 += sysfs_emit_at(buf, length, int3400_thermal_uuids[i]);
+			length += sysfs_emit_at(buf, length, "%s\n", int3400_thermal_uuids[i]);
 	}
 
 	return length;
@@ -149,7 +149,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 += sysfs_emit_at(buf, length, int3400_thermal_uuids[i]);
+			length += sysfs_emit_at(buf, length, "%s\n", int3400_thermal_uuids[i]);
 	}
 
 	if (length)
-- 
2.39.1


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

* Re: [PATCH] thermal: int340x: Add new line for UUID display
  2023-05-22 22:38 [PATCH] thermal: int340x: Add new line for UUID display Srinivas Pandruvada
@ 2023-05-24 17:51 ` Rafael J. Wysocki
  0 siblings, 0 replies; 2+ messages in thread
From: Rafael J. Wysocki @ 2023-05-24 17:51 UTC (permalink / raw
  To: Srinivas Pandruvada
  Cc: rafael, rui.zhang, daniel.lezcano, linux-pm, linux-kernel, stable

On Tue, May 23, 2023 at 12:39 AM Srinivas Pandruvada
<srinivas.pandruvada@linux.intel.com> wrote:
>
> Prior to the commit:
> "763bd29fd3d1 ("thermal: int340x_thermal: Use sysfs_emit_at() instead of
> scnprintf()"
> there was a new line after each UUID string. With the newline removed,
> existing user space like "thermald" fails to compare each supported UUID
> as it is using getline() to read UUID and apply correct thermal table.
>
> To avoid breaking existing user space, add newline after each UUID string.
>
> Signed-off-by: Srinivas Pandruvada <srinivas.pandruvada@linux.intel.com>
> Fixes: 763bd29fd3d1 ("thermal: int340x_thermal: Use sysfs_emit_at() instead of scnprintf()")
> Cc: stable@vger.kernel.org # v6.3+
> ---
>  drivers/thermal/intel/int340x_thermal/int3400_thermal.c | 4 ++--
>  1 file changed, 2 insertions(+), 2 deletions(-)
>
> diff --git a/drivers/thermal/intel/int340x_thermal/int3400_thermal.c b/drivers/thermal/intel/int340x_thermal/int3400_thermal.c
> index 810231b59dcd..5e1164226ada 100644
> --- a/drivers/thermal/intel/int340x_thermal/int3400_thermal.c
> +++ b/drivers/thermal/intel/int340x_thermal/int3400_thermal.c
> @@ -131,7 +131,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 += sysfs_emit_at(buf, length, int3400_thermal_uuids[i]);
> +                       length += sysfs_emit_at(buf, length, "%s\n", int3400_thermal_uuids[i]);
>         }
>
>         return length;
> @@ -149,7 +149,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 += sysfs_emit_at(buf, length, int3400_thermal_uuids[i]);
> +                       length += sysfs_emit_at(buf, length, "%s\n", int3400_thermal_uuids[i]);
>         }
>
>         if (length)
> --

Applied as 6.4-rc material, thanks!

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

end of thread, other threads:[~2023-05-24 17:52 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2023-05-22 22:38 [PATCH] thermal: int340x: Add new line for UUID display Srinivas Pandruvada
2023-05-24 17:51 ` 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 read-only IMAP folder(s) and NNTP newsgroup(s).