]> git.ipfire.org Git - thirdparty/kernel/stable.git/commitdiff
cpufreq: Use of_property_present() for testing DT property presence
authorRob Herring <robh@kernel.org>
Fri, 10 Mar 2023 14:47:02 +0000 (08:47 -0600)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Thu, 25 Jan 2024 22:52:33 +0000 (14:52 -0800)
[ Upstream commit b8f3a396a7ee43e6079176cc0fb8de2b95a23681 ]

It is preferred to use typed property access functions (i.e.
of_property_read_<type> functions) rather than low-level
of_get_property/of_find_property functions for reading properties. As
part of this, convert of_get_property/of_find_property calls to the
recently added of_property_present() helper when we just want to test
for presence of a property and nothing more.

Signed-off-by: Rob Herring <robh@kernel.org>
Signed-off-by: Viresh Kumar <viresh.kumar@linaro.org>
Stable-dep-of: c4a5118a3ae1 ("cpufreq: scmi: process the result of devm_of_clk_add_hw_provider()")
Signed-off-by: Sasha Levin <sashal@kernel.org>
drivers/cpufreq/cpufreq-dt-platdev.c
drivers/cpufreq/imx-cpufreq-dt.c
drivers/cpufreq/imx6q-cpufreq.c
drivers/cpufreq/scmi-cpufreq.c
drivers/cpufreq/tegra20-cpufreq.c

index e1b5975c7daa1417cd2c2481934ede094639a337..48ca7189a73b81eb0414505be73de5b2c5ce10c2 100644 (file)
@@ -171,7 +171,7 @@ static bool __init cpu0_node_has_opp_v2_prop(void)
        struct device_node *np = of_cpu_device_node_get(0);
        bool ret = false;
 
-       if (of_get_property(np, "operating-points-v2", NULL))
+       if (of_property_present(np, "operating-points-v2"))
                ret = true;
 
        of_node_put(np);
index 3fe9125156b443db3d93529026c91a2e2ce44ff8..0942498b348c3a4c9b48bbb497f8a3bcedd87999 100644 (file)
@@ -89,7 +89,7 @@ static int imx_cpufreq_dt_probe(struct platform_device *pdev)
 
        cpu_dev = get_cpu_device(0);
 
-       if (!of_find_property(cpu_dev->of_node, "cpu-supply", NULL))
+       if (!of_property_present(cpu_dev->of_node, "cpu-supply"))
                return -ENODEV;
 
        if (of_machine_is_compatible("fsl,imx7ulp")) {
index 67f98a083d223252af9b475ef3e3f31bc29af5e0..ae9ef99f7d86206f13ece5d9bbc3958464adba0b 100644 (file)
@@ -230,7 +230,7 @@ static int imx6q_opp_check_speed_grading(struct device *dev)
        u32 val;
        int ret;
 
-       if (of_find_property(dev->of_node, "nvmem-cells", NULL)) {
+       if (of_property_present(dev->of_node, "nvmem-cells")) {
                ret = nvmem_cell_read_u32(dev, "speed_grade", &val);
                if (ret)
                        return ret;
@@ -285,7 +285,7 @@ static int imx6ul_opp_check_speed_grading(struct device *dev)
        u32 val;
        int ret = 0;
 
-       if (of_find_property(dev->of_node, "nvmem-cells", NULL)) {
+       if (of_property_present(dev->of_node, "nvmem-cells")) {
                ret = nvmem_cell_read_u32(dev, "speed_grade", &val);
                if (ret)
                        return ret;
index 1e0cd4d165f043cf76228fde27f10a9c3a5f413b..82e588c3c57b8d94615bae7c756c9bec4a86f869 100644 (file)
@@ -299,7 +299,7 @@ static int scmi_cpufreq_probe(struct scmi_device *sdev)
 
 #ifdef CONFIG_COMMON_CLK
        /* dummy clock provider as needed by OPP if clocks property is used */
-       if (of_find_property(dev->of_node, "#clock-cells", NULL))
+       if (of_property_present(dev->of_node, "#clock-cells"))
                devm_of_clk_add_hw_provider(dev, of_clk_hw_simple_get, NULL);
 #endif
 
index e8db3d75be2517774a123b21ad5c0ed19d946050..72b9c2d5f37545058c3c704bb94ba3064a5e8cc9 100644 (file)
@@ -25,7 +25,7 @@ static bool cpu0_node_has_opp_v2_prop(void)
        struct device_node *np = of_cpu_device_node_get(0);
        bool ret = false;
 
-       if (of_get_property(np, "operating-points-v2", NULL))
+       if (of_property_present(np, "operating-points-v2"))
                ret = true;
 
        of_node_put(np);