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)
committerViresh Kumar <viresh.kumar@linaro.org>
Mon, 13 Mar 2023 04:28:11 +0000 (09:58 +0530)
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>
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 e8570365109869d4063339d877b3c3110b75b9b3..5ac6b9e5270e1235287fd071083a706feb0ce0bc 100644 (file)
@@ -179,7 +179,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 76e553af207110dddd987cdadd0f509e6ab2563e..535867a7dfdde1895d425fbccb1b9fcc2e01e087 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 ad4ce8493144669e3d24923b71e403c2856ecd71..48e1772e98fd8137d1f0cd8a1b6fc597ec172131 100644 (file)
@@ -222,7 +222,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;
@@ -279,7 +279,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 513a071845c263a0df2ed4d24adf8de41a56e3b5..f34e6382a4c5000bd49bc52dcf99a264e2dd4c03 100644 (file)
@@ -310,7 +310,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 ab7ac7df9e62eae70ddecebd98e4fb2071f2ce9f..dfd2de4f8e07e4c01ac7a7b81ce5e2e0c5be659d 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);