Commit b8f3a396 authored by Rob Herring's avatar Rob Herring Committed by Viresh Kumar

cpufreq: Use of_property_present() for testing DT property presence

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: default avatarRob Herring <robh@kernel.org>
Signed-off-by: default avatarViresh Kumar <viresh.kumar@linaro.org>
parent 35527c67
...@@ -179,7 +179,7 @@ static bool __init cpu0_node_has_opp_v2_prop(void) ...@@ -179,7 +179,7 @@ static bool __init cpu0_node_has_opp_v2_prop(void)
struct device_node *np = of_cpu_device_node_get(0); struct device_node *np = of_cpu_device_node_get(0);
bool ret = false; bool ret = false;
if (of_get_property(np, "operating-points-v2", NULL)) if (of_property_present(np, "operating-points-v2"))
ret = true; ret = true;
of_node_put(np); of_node_put(np);
......
...@@ -89,7 +89,7 @@ static int imx_cpufreq_dt_probe(struct platform_device *pdev) ...@@ -89,7 +89,7 @@ static int imx_cpufreq_dt_probe(struct platform_device *pdev)
cpu_dev = get_cpu_device(0); 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; return -ENODEV;
if (of_machine_is_compatible("fsl,imx7ulp")) { if (of_machine_is_compatible("fsl,imx7ulp")) {
......
...@@ -222,7 +222,7 @@ static int imx6q_opp_check_speed_grading(struct device *dev) ...@@ -222,7 +222,7 @@ static int imx6q_opp_check_speed_grading(struct device *dev)
u32 val; u32 val;
int ret; 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); ret = nvmem_cell_read_u32(dev, "speed_grade", &val);
if (ret) if (ret)
return ret; return ret;
...@@ -279,7 +279,7 @@ static int imx6ul_opp_check_speed_grading(struct device *dev) ...@@ -279,7 +279,7 @@ static int imx6ul_opp_check_speed_grading(struct device *dev)
u32 val; u32 val;
int ret = 0; 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); ret = nvmem_cell_read_u32(dev, "speed_grade", &val);
if (ret) if (ret)
return ret; return ret;
......
...@@ -310,7 +310,7 @@ static int scmi_cpufreq_probe(struct scmi_device *sdev) ...@@ -310,7 +310,7 @@ static int scmi_cpufreq_probe(struct scmi_device *sdev)
#ifdef CONFIG_COMMON_CLK #ifdef CONFIG_COMMON_CLK
/* dummy clock provider as needed by OPP if clocks property is used */ /* 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); devm_of_clk_add_hw_provider(dev, of_clk_hw_simple_get, NULL);
#endif #endif
......
...@@ -25,7 +25,7 @@ static bool cpu0_node_has_opp_v2_prop(void) ...@@ -25,7 +25,7 @@ static bool cpu0_node_has_opp_v2_prop(void)
struct device_node *np = of_cpu_device_node_get(0); struct device_node *np = of_cpu_device_node_get(0);
bool ret = false; bool ret = false;
if (of_get_property(np, "operating-points-v2", NULL)) if (of_property_present(np, "operating-points-v2"))
ret = true; ret = true;
of_node_put(np); of_node_put(np);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment