public inbox for linux-pm@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH] thermal: sysfs: Use str_enabled_disabled helper in mode_show
@ 2026-03-11 16:42 Thorsten Blum
  2026-03-14 11:17 ` Rafael J. Wysocki
  0 siblings, 1 reply; 2+ messages in thread
From: Thorsten Blum @ 2026-03-11 16:42 UTC (permalink / raw)
  To: Rafael J. Wysocki, Daniel Lezcano, Zhang Rui, Lukasz Luba
  Cc: Thorsten Blum, linux-pm, linux-kernel

Replace hard-coded strings with the str_enabled_disabled() helper. This
unifies the output and helps the linker with deduplication, which can
result in a smaller binary.

Signed-off-by: Thorsten Blum <thorsten.blum@linux.dev>
---
 drivers/thermal/thermal_sysfs.c | 7 +++----
 1 file changed, 3 insertions(+), 4 deletions(-)

diff --git a/drivers/thermal/thermal_sysfs.c b/drivers/thermal/thermal_sysfs.c
index 46b3b2df935c..5eecae13f07d 100644
--- a/drivers/thermal/thermal_sysfs.c
+++ b/drivers/thermal/thermal_sysfs.c
@@ -18,6 +18,7 @@
 #include <linux/err.h>
 #include <linux/slab.h>
 #include <linux/string.h>
+#include <linux/string_choices.h>
 #include <linux/jiffies.h>
 
 #include "thermal_core.h"
@@ -56,10 +57,8 @@ mode_show(struct device *dev, struct device_attribute *attr, char *buf)
 
 	guard(thermal_zone)(tz);
 
-	if (tz->mode == THERMAL_DEVICE_ENABLED)
-		return sysfs_emit(buf, "enabled\n");
-
-	return sysfs_emit(buf, "disabled\n");
+	return sysfs_emit(buf, "%s\n",
+		str_enabled_disabled(tz->mode == THERMAL_DEVICE_ENABLED));
 }
 
 static ssize_t

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

* Re: [PATCH] thermal: sysfs: Use str_enabled_disabled helper in mode_show
  2026-03-11 16:42 [PATCH] thermal: sysfs: Use str_enabled_disabled helper in mode_show Thorsten Blum
@ 2026-03-14 11:17 ` Rafael J. Wysocki
  0 siblings, 0 replies; 2+ messages in thread
From: Rafael J. Wysocki @ 2026-03-14 11:17 UTC (permalink / raw)
  To: Thorsten Blum
  Cc: Rafael J. Wysocki, Daniel Lezcano, Zhang Rui, Lukasz Luba,
	linux-pm, linux-kernel

On Wed, Mar 11, 2026 at 5:43 PM Thorsten Blum <thorsten.blum@linux.dev> wrote:
>
> Replace hard-coded strings with the str_enabled_disabled() helper. This
> unifies the output and helps the linker with deduplication, which can
> result in a smaller binary.
>
> Signed-off-by: Thorsten Blum <thorsten.blum@linux.dev>
> ---
>  drivers/thermal/thermal_sysfs.c | 7 +++----
>  1 file changed, 3 insertions(+), 4 deletions(-)
>
> diff --git a/drivers/thermal/thermal_sysfs.c b/drivers/thermal/thermal_sysfs.c
> index 46b3b2df935c..5eecae13f07d 100644
> --- a/drivers/thermal/thermal_sysfs.c
> +++ b/drivers/thermal/thermal_sysfs.c
> @@ -18,6 +18,7 @@
>  #include <linux/err.h>
>  #include <linux/slab.h>
>  #include <linux/string.h>
> +#include <linux/string_choices.h>
>  #include <linux/jiffies.h>
>
>  #include "thermal_core.h"
> @@ -56,10 +57,8 @@ mode_show(struct device *dev, struct device_attribute *attr, char *buf)
>
>         guard(thermal_zone)(tz);
>
> -       if (tz->mode == THERMAL_DEVICE_ENABLED)
> -               return sysfs_emit(buf, "enabled\n");
> -
> -       return sysfs_emit(buf, "disabled\n");
> +       return sysfs_emit(buf, "%s\n",
> +               str_enabled_disabled(tz->mode == THERMAL_DEVICE_ENABLED));
>  }
>
>  static ssize_t

Applied as 7.1 material, thanks!

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

end of thread, other threads:[~2026-03-14 11:17 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-03-11 16:42 [PATCH] thermal: sysfs: Use str_enabled_disabled helper in mode_show Thorsten Blum
2026-03-14 11:17 ` 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