Skip to contentSkip to conversation

ACPI: power: Use str_on_off() helper function

PATCH Applied Thorsten Blum 2 participants 2 messages Feb 9, 2025 – Feb 18, 2025 ACPI

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 ACPI: power: Use str_on_off() helper function

Remove hard-coded strings by using the str_on_off() helper function.

---
 drivers/acpi/power.c | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)
drivers/acpi/power.c +3 -2
index 25174c24d3d7..b7243d7563b1 100644
@@ -29,6 +29,7 @@
 #include <linux/init.h>
 #include <linux/types.h>
 #include <linux/slab.h>
+#include <linux/string_choices.h>
 #include <linux/pm_runtime.h>
 #include <linux/sysfs.h>
 #include <linux/acpi.h>
@@ -197,7 +198,7 @@ static int __get_state(acpi_handle handle, u8 *state)
 	cur_state = sta & ACPI_POWER_RESOURCE_STATE_ON;
 
 	acpi_handle_debug(handle, "Power resource is %s\n",
-			  cur_state ? "on" : "off");
+			  str_on_off(cur_state));
 
 	*state = cur_state;
 	return 0;
@@ -240,7 +241,7 @@ static int acpi_power_get_list_state(struct list_head *list, u8 *state)
 			break;
 	}
 
-	pr_debug("Power resource list is %s\n", cur_state ? "on" : "off");
+	pr_debug("Power resource list is %s\n", str_on_off(cur_state));
 
 	*state = cur_state;
 	return 0;
Signature · 1 line
2.48.1
maintainer Applied
#1 lore raw
Quoted 30 lines · Thorsten Blum

Remove hard-coded strings by using the str_on_off() helper function.

---
 drivers/acpi/power.c | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)
drivers/acpi/power.c +2 -1
index 25174c24d3d7..b7243d7563b1 100644
@@ -29,6 +29,7 @@
 #include <linux/init.h>
 #include <linux/types.h>
 #include <linux/slab.h>
+#include <linux/string_choices.h>
 #include <linux/pm_runtime.h>
 #include <linux/sysfs.h>
 #include <linux/acpi.h>
@@ -197,7 +198,7 @@ static int __get_state(acpi_handle handle, u8 *state)
        cur_state = sta & ACPI_POWER_RESOURCE_STATE_ON;
 
        acpi_handle_debug(handle, "Power resource is %s\n",
-                         cur_state ? "on" : "off");
+                         str_on_off(cur_state));
 
        *state = cur_state;
        return 0;

drivers/acpi/power.c static int acpi_power_get_list_state(struct list_head *list, u8 *state)

Quoted 9 lines
drivers/acpi/power.c +1 -2
@@ -240,7 +241,7 @@ static int acpi_power_get_list_state(struct list_head *list, u8 *state)
                        break;
        }
 
-       pr_debug("Power resource list is %s\n", cur_state ? "on" : "off");
+       pr_debug("Power resource list is %s\n", str_on_off(cur_state));
 
        *state = cur_state;
        return 0;
--

Applied as 6.15 material with edits in the changelog, thanks!