Skip to content

Commit f994c1c

Browse files
krzkrafaeljw
authored andcommitted
cpufreq: Use str_enable_disable()-like helpers
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 <krzysztof.kozlowski@linaro.org> Acked-by: Viresh Kumar <viresh.kumar@linaro.org> Link: https://patch.msgid.link/20250114190600.846651-1-krzysztof.kozlowski@linaro.org [ rjw: Subject and changelog edits ] Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
1 parent 423124a commit f994c1c

File tree

2 files changed

+6
-4
lines changed

2 files changed

+6
-4
lines changed

drivers/cpufreq/cpufreq.c

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,7 @@
2525
#include <linux/mutex.h>
2626
#include <linux/pm_qos.h>
2727
#include <linux/slab.h>
28+
#include <linux/string_choices.h>
2829
#include <linux/suspend.h>
2930
#include <linux/syscore_ops.h>
3031
#include <linux/tick.h>
@@ -602,12 +603,12 @@ static ssize_t store_boost(struct kobject *kobj, struct kobj_attribute *attr,
602603

603604
if (cpufreq_boost_trigger_state(enable)) {
604605
pr_err("%s: Cannot %s BOOST!\n",
605-
__func__, enable ? "enable" : "disable");
606+
__func__, str_enable_disable(enable));
606607
return -EINVAL;
607608
}
608609

609610
pr_debug("%s: cpufreq BOOST %s\n",
610-
__func__, enable ? "enabled" : "disabled");
611+
__func__, str_enabled_disabled(enable));
611612

612613
return count;
613614
}
@@ -2812,7 +2813,7 @@ int cpufreq_boost_trigger_state(int state)
28122813
write_unlock_irqrestore(&cpufreq_driver_lock, flags);
28132814

28142815
pr_err("%s: Cannot %s BOOST\n",
2815-
__func__, state ? "enable" : "disable");
2816+
__func__, str_enable_disable(state));
28162817

28172818
return ret;
28182819
}

drivers/cpufreq/powernv-cpufreq.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@
1818
#include <linux/of.h>
1919
#include <linux/reboot.h>
2020
#include <linux/slab.h>
21+
#include <linux/string_choices.h>
2122
#include <linux/cpu.h>
2223
#include <linux/hashtable.h>
2324
#include <trace/events/power.h>
@@ -281,7 +282,7 @@ static int init_powernv_pstates(void)
281282
pr_info("cpufreq pstate min 0x%x nominal 0x%x max 0x%x\n", pstate_min,
282283
pstate_nominal, pstate_max);
283284
pr_info("Workload Optimized Frequency is %s in the platform\n",
284-
(powernv_pstate_info.wof_enabled) ? "enabled" : "disabled");
285+
str_enabled_disabled(powernv_pstate_info.wof_enabled));
285286

286287
pstate_ids = of_get_property(power_mgt, "ibm,pstate-ids", &len_ids);
287288
if (!pstate_ids) {

0 commit comments

Comments
 (0)