]> Git Repo - linux.git/commitdiff
cpufreq: Use str_enable_disable()-like helpers
authorKrzysztof Kozlowski <[email protected]>
Tue, 14 Jan 2025 19:06:00 +0000 (20:06 +0100)
committerRafael J. Wysocki <[email protected]>
Fri, 17 Jan 2025 17:54:57 +0000 (18:54 +0100)
Replace ternary (condition ? "enable" : "disable") syntax with helpers
from string_choices.h because:

 1. Simple function call with one argument is easier to read.  Ternary
    operator has three arguments and with wrapping might lead to quite
    long code.
 2. Is slightly shorter thus also easier to read.
 3. It brings uniformity in the text - same string.
 4. Allows deduping by the linker, which results in a smaller binary
    file.

Signed-off-by: Krzysztof Kozlowski <[email protected]>
Acked-by: Viresh Kumar <[email protected]>
Link: https://patch.msgid.link/[email protected]
[ rjw: Subject and changelog edits ]
Signed-off-by: Rafael J. Wysocki <[email protected]>
drivers/cpufreq/cpufreq.c
drivers/cpufreq/powernv-cpufreq.c

index 1a4cae54a01bd7ccf6c0838831c45b628c89b9ef..c95b4d291f2ce31344deeaca3994dd095f6feaf4 100644 (file)
@@ -25,6 +25,7 @@
 #include <linux/mutex.h>
 #include <linux/pm_qos.h>
 #include <linux/slab.h>
+#include <linux/string_choices.h>
 #include <linux/suspend.h>
 #include <linux/syscore_ops.h>
 #include <linux/tick.h>
@@ -602,12 +603,12 @@ static ssize_t store_boost(struct kobject *kobj, struct kobj_attribute *attr,
 
        if (cpufreq_boost_trigger_state(enable)) {
                pr_err("%s: Cannot %s BOOST!\n",
-                      __func__, enable ? "enable" : "disable");
+                      __func__, str_enable_disable(enable));
                return -EINVAL;
        }
 
        pr_debug("%s: cpufreq BOOST %s\n",
-                __func__, enable ? "enabled" : "disabled");
+                __func__, str_enabled_disabled(enable));
 
        return count;
 }
@@ -2812,7 +2813,7 @@ err_reset_state:
        write_unlock_irqrestore(&cpufreq_driver_lock, flags);
 
        pr_err("%s: Cannot %s BOOST\n",
-              __func__, state ? "enable" : "disable");
+              __func__, str_enable_disable(state));
 
        return ret;
 }
index 8de759247771fbc53768d6881c76ffeb5ee9c90e..ae79d909943b521fe4f9b25e544c131f72342bef 100644 (file)
@@ -18,6 +18,7 @@
 #include <linux/of.h>
 #include <linux/reboot.h>
 #include <linux/slab.h>
+#include <linux/string_choices.h>
 #include <linux/cpu.h>
 #include <linux/hashtable.h>
 #include <trace/events/power.h>
@@ -281,7 +282,7 @@ next:
        pr_info("cpufreq pstate min 0x%x nominal 0x%x max 0x%x\n", pstate_min,
                pstate_nominal, pstate_max);
        pr_info("Workload Optimized Frequency is %s in the platform\n",
-               (powernv_pstate_info.wof_enabled) ? "enabled" : "disabled");
+               str_enabled_disabled(powernv_pstate_info.wof_enabled));
 
        pstate_ids = of_get_property(power_mgt, "ibm,pstate-ids", &len_ids);
        if (!pstate_ids) {
This page took 0.053131 seconds and 4 git commands to generate.