Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

thermal: sysfs: Use str_enabled_disabled() helper in mode_show()

Replace hard-coded strings with the str_enabled_disabled() helper.

This unifies the output and helps the linker with deduplication, which
may result in a smaller binary.

Signed-off-by: Thorsten Blum <thorsten.blum@linux.dev>
[ rjw: Subject and changelog tweaks ]
Link: https://patch.msgid.link/20260311164212.405981-3-thorsten.blum@linux.dev
Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>

authored by

Thorsten Blum and committed by
Rafael J. Wysocki
2dc1b0dd 5ddd020b

+3 -4
+3 -4
drivers/thermal/thermal_sysfs.c
··· 18 18 #include <linux/err.h> 19 19 #include <linux/slab.h> 20 20 #include <linux/string.h> 21 + #include <linux/string_choices.h> 21 22 #include <linux/jiffies.h> 22 23 23 24 #include "thermal_core.h" ··· 57 56 58 57 guard(thermal_zone)(tz); 59 58 60 - if (tz->mode == THERMAL_DEVICE_ENABLED) 61 - return sysfs_emit(buf, "enabled\n"); 62 - 63 - return sysfs_emit(buf, "disabled\n"); 59 + return sysfs_emit(buf, "%s\n", 60 + str_enabled_disabled(tz->mode == THERMAL_DEVICE_ENABLED)); 64 61 } 65 62 66 63 static ssize_t