]> git.ipfire.org Git - thirdparty/kernel/linux.git/commitdiff
clk: Use str_enable_disable-like helpers
authorKrzysztof Kozlowski <krzysztof.kozlowski@linaro.org>
Tue, 14 Jan 2025 19:06:12 +0000 (20:06 +0100)
committerStephen Boyd <sboyd@kernel.org>
Wed, 15 Jan 2025 20:27:04 +0000 (12:27 -0800)
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>
drivers/clk/bcm/clk-kona.c
drivers/clk/clk-nomadik.c
drivers/clk/clk-xgene.c
drivers/clk/qcom/clk-rpmh.c

index ec5749e301ba82933144f34acfaf6f3680c443f7..2b0ea882f1e41716722ff67c06ae7d055c350e14 100644 (file)
@@ -10,6 +10,7 @@
 #include <linux/io.h>
 #include <linux/kernel.h>
 #include <linux/clk-provider.h>
+#include <linux/string_choices.h>
 
 /*
  * "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,
                return 0;
 
        pr_err("%s: failed to %s gate for %s\n", __func__,
-               enable ? "enable" : "disable", name);
+               str_enable_disable(enable), name);
 
        return -EIO;
 }
index 06245681dac79f7cde07f1edfd732d9bdb088fe2..fc0aeb4247f25daf455956c2e2725fd617e20f69 100644 (file)
@@ -17,6 +17,7 @@
 #include <linux/debugfs.h>
 #include <linux/seq_file.h>
 #include <linux/spinlock.h>
+#include <linux/string_choices.h>
 #include <linux/reboot.h>
 
 /*
@@ -116,9 +117,9 @@ static void __init nomadik_src_init(void)
 
        val = readl(src_base + SRC_XTALCR);
        pr_info("SXTALO is %s\n",
-               (val & SRC_XTALCR_SXTALDIS) ? "disabled" : "enabled");
+               str_disabled_enabled(val & SRC_XTALCR_SXTALDIS));
        pr_info("MXTAL is %s\n",
-               (val & SRC_XTALCR_MXTALSTAT) ? "enabled" : "disabled");
+               str_enabled_disabled(val & SRC_XTALCR_MXTALSTAT));
        if (of_property_read_bool(np, "disable-sxtalo")) {
                /* The machine uses an external oscillator circuit */
                val |= SRC_XTALCR_SXTALDIS;
index 0c3d0cee98c83d697336868fb9027b14b84e6a03..96946a8e2854c3a3fb80c920c8e3798f39386b24 100644 (file)
@@ -7,6 +7,7 @@
  */
 #include <linux/module.h>
 #include <linux/spinlock.h>
+#include <linux/string_choices.h>
 #include <linux/io.h>
 #include <linux/of.h>
 #include <linux/clkdev.h>
@@ -520,8 +521,7 @@ static int xgene_clk_is_enabled(struct clk_hw *hw)
                data = xgene_clk_read(pclk->param.csr_reg +
                                        pclk->param.reg_clk_offset);
                pr_debug("%s clock is %s\n", clk_hw_get_name(hw),
-                       data & pclk->param.reg_clk_mask ? "enabled" :
-                                                       "disabled");
+                       str_enabled_disabled(data & pclk->param.reg_clk_mask));
        } else {
                return 1;
        }
index eefc322ce367989f625f1285dcccddbdd8341a12..1ee0249867fd4f256a8545e7b6499d4f4125fdf4 100644 (file)
@@ -9,6 +9,7 @@
 #include <linux/module.h>
 #include <linux/of.h>
 #include <linux/platform_device.h>
+#include <linux/string_choices.h>
 #include <soc/qcom/cmd-db.h>
 #include <soc/qcom/rpmh.h>
 #include <soc/qcom/tcs.h>
@@ -206,7 +207,7 @@ static int clk_rpmh_aggregate_state_send_command(struct clk_rpmh *c,
                c->state = c->valid_state_mask;
 
        WARN(1, "clk: %s failed to %s\n", c->res_name,
-            enable ? "enable" : "disable");
+            str_enable_disable(enable));
        return ret;
 }