Skip to content

Commit b8f3a39

Browse files
robherringvireshk
authored andcommitted
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: Rob Herring <robh@kernel.org> Signed-off-by: Viresh Kumar <viresh.kumar@linaro.org>
1 parent 35527c6 commit b8f3a39

5 files changed

Lines changed: 6 additions & 6 deletions

File tree

drivers/cpufreq/cpufreq-dt-platdev.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -179,7 +179,7 @@ static bool __init cpu0_node_has_opp_v2_prop(void)
179179
struct device_node *np = of_cpu_device_node_get(0);
180180
bool ret = false;
181181

182-
if (of_get_property(np, "operating-points-v2", NULL))
182+
if (of_property_present(np, "operating-points-v2"))
183183
ret = true;
184184

185185
of_node_put(np);

drivers/cpufreq/imx-cpufreq-dt.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -89,7 +89,7 @@ static int imx_cpufreq_dt_probe(struct platform_device *pdev)
8989

9090
cpu_dev = get_cpu_device(0);
9191

92-
if (!of_find_property(cpu_dev->of_node, "cpu-supply", NULL))
92+
if (!of_property_present(cpu_dev->of_node, "cpu-supply"))
9393
return -ENODEV;
9494

9595
if (of_machine_is_compatible("fsl,imx7ulp")) {

drivers/cpufreq/imx6q-cpufreq.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -222,7 +222,7 @@ static int imx6q_opp_check_speed_grading(struct device *dev)
222222
u32 val;
223223
int ret;
224224

225-
if (of_find_property(dev->of_node, "nvmem-cells", NULL)) {
225+
if (of_property_present(dev->of_node, "nvmem-cells")) {
226226
ret = nvmem_cell_read_u32(dev, "speed_grade", &val);
227227
if (ret)
228228
return ret;
@@ -279,7 +279,7 @@ static int imx6ul_opp_check_speed_grading(struct device *dev)
279279
u32 val;
280280
int ret = 0;
281281

282-
if (of_find_property(dev->of_node, "nvmem-cells", NULL)) {
282+
if (of_property_present(dev->of_node, "nvmem-cells")) {
283283
ret = nvmem_cell_read_u32(dev, "speed_grade", &val);
284284
if (ret)
285285
return ret;

drivers/cpufreq/scmi-cpufreq.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -310,7 +310,7 @@ static int scmi_cpufreq_probe(struct scmi_device *sdev)
310310

311311
#ifdef CONFIG_COMMON_CLK
312312
/* dummy clock provider as needed by OPP if clocks property is used */
313-
if (of_find_property(dev->of_node, "#clock-cells", NULL))
313+
if (of_property_present(dev->of_node, "#clock-cells"))
314314
devm_of_clk_add_hw_provider(dev, of_clk_hw_simple_get, NULL);
315315
#endif
316316

drivers/cpufreq/tegra20-cpufreq.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ static bool cpu0_node_has_opp_v2_prop(void)
2525
struct device_node *np = of_cpu_device_node_get(0);
2626
bool ret = false;
2727

28-
if (of_get_property(np, "operating-points-v2", NULL))
28+
if (of_property_present(np, "operating-points-v2"))
2929
ret = true;
3030

3131
of_node_put(np);

0 commit comments

Comments
 (0)