Skip to content

Commit ab9f0d0

Browse files
krzkbebarino
authored andcommitted
clk: 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. Reviewed-by: Florian Fainelli <florian.fainelli@broadcom.com> Signed-off-by: Krzysztof Kozlowski <krzysztof.kozlowski@linaro.org> Link: https://lore.kernel.org/r/20250114190612.846696-1-krzysztof.kozlowski@linaro.org Reviewed-by: Linus Walleij <linus.walleij@linaro.org> Signed-off-by: Stephen Boyd <sboyd@kernel.org>
1 parent 54e020b commit ab9f0d0

File tree

4 files changed

+9
-6
lines changed

4 files changed

+9
-6
lines changed

drivers/clk/bcm/clk-kona.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@
1010
#include <linux/io.h>
1111
#include <linux/kernel.h>
1212
#include <linux/clk-provider.h>
13+
#include <linux/string_choices.h>
1314

1415
/*
1516
* "Policies" affect the frequencies of bus clocks provided by a
@@ -502,7 +503,7 @@ static int clk_gate(struct ccu_data *ccu, const char *name,
502503
return 0;
503504

504505
pr_err("%s: failed to %s gate for %s\n", __func__,
505-
enable ? "enable" : "disable", name);
506+
str_enable_disable(enable), name);
506507

507508
return -EIO;
508509
}

drivers/clk/clk-nomadik.c

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@
1717
#include <linux/debugfs.h>
1818
#include <linux/seq_file.h>
1919
#include <linux/spinlock.h>
20+
#include <linux/string_choices.h>
2021
#include <linux/reboot.h>
2122

2223
/*
@@ -116,9 +117,9 @@ static void __init nomadik_src_init(void)
116117

117118
val = readl(src_base + SRC_XTALCR);
118119
pr_info("SXTALO is %s\n",
119-
(val & SRC_XTALCR_SXTALDIS) ? "disabled" : "enabled");
120+
str_disabled_enabled(val & SRC_XTALCR_SXTALDIS));
120121
pr_info("MXTAL is %s\n",
121-
(val & SRC_XTALCR_MXTALSTAT) ? "enabled" : "disabled");
122+
str_enabled_disabled(val & SRC_XTALCR_MXTALSTAT));
122123
if (of_property_read_bool(np, "disable-sxtalo")) {
123124
/* The machine uses an external oscillator circuit */
124125
val |= SRC_XTALCR_SXTALDIS;

drivers/clk/clk-xgene.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@
77
*/
88
#include <linux/module.h>
99
#include <linux/spinlock.h>
10+
#include <linux/string_choices.h>
1011
#include <linux/io.h>
1112
#include <linux/of.h>
1213
#include <linux/clkdev.h>
@@ -520,8 +521,7 @@ static int xgene_clk_is_enabled(struct clk_hw *hw)
520521
data = xgene_clk_read(pclk->param.csr_reg +
521522
pclk->param.reg_clk_offset);
522523
pr_debug("%s clock is %s\n", clk_hw_get_name(hw),
523-
data & pclk->param.reg_clk_mask ? "enabled" :
524-
"disabled");
524+
str_enabled_disabled(data & pclk->param.reg_clk_mask));
525525
} else {
526526
return 1;
527527
}

drivers/clk/qcom/clk-rpmh.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@
99
#include <linux/module.h>
1010
#include <linux/of.h>
1111
#include <linux/platform_device.h>
12+
#include <linux/string_choices.h>
1213
#include <soc/qcom/cmd-db.h>
1314
#include <soc/qcom/rpmh.h>
1415
#include <soc/qcom/tcs.h>
@@ -206,7 +207,7 @@ static int clk_rpmh_aggregate_state_send_command(struct clk_rpmh *c,
206207
c->state = c->valid_state_mask;
207208

208209
WARN(1, "clk: %s failed to %s\n", c->res_name,
209-
enable ? "enable" : "disable");
210+
str_enable_disable(enable));
210211
return ret;
211212
}
212213

0 commit comments

Comments
 (0)