Skip to content

Commit 86df7d1

Browse files
robherringrafaeljw
authored andcommitted
thermal: 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> Acked-by: Viresh Kumar <viresh.kumar@linaro.org> Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
1 parent d9dc060 commit 86df7d1

4 files changed

Lines changed: 5 additions & 5 deletions

File tree

drivers/thermal/cpufreq_cooling.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -633,7 +633,7 @@ of_cpufreq_cooling_register(struct cpufreq_policy *policy)
633633
return NULL;
634634
}
635635

636-
if (of_find_property(np, "#cooling-cells", NULL)) {
636+
if (of_property_present(np, "#cooling-cells")) {
637637
struct em_perf_domain *em = em_cpu_get(policy->cpu);
638638

639639
cdev = __cpufreq_cooling_register(np, policy, em);

drivers/thermal/imx8mm_thermal.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -282,7 +282,7 @@ static int imx8mm_tmu_probe_set_calib(struct platform_device *pdev,
282282
* strongly recommended to update such old DTs to get correct
283283
* temperature compensation values for each SoC.
284284
*/
285-
if (!of_find_property(pdev->dev.of_node, "nvmem-cells", NULL)) {
285+
if (!of_property_present(pdev->dev.of_node, "nvmem-cells")) {
286286
dev_warn(dev,
287287
"No OCOTP nvmem reference found, SoC-specific calibration not loaded. Please update your DT.\n");
288288
return 0;

drivers/thermal/imx_thermal.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -571,7 +571,7 @@ static int imx_thermal_register_legacy_cooling(struct imx_thermal_data *data)
571571

572572
np = of_get_cpu_node(data->policy->cpu, NULL);
573573

574-
if (!np || !of_find_property(np, "#cooling-cells", NULL)) {
574+
if (!np || !of_property_present(np, "#cooling-cells")) {
575575
data->cdev = cpufreq_cooling_register(data->policy);
576576
if (IS_ERR(data->cdev)) {
577577
ret = PTR_ERR(data->cdev);
@@ -648,7 +648,7 @@ static int imx_thermal_probe(struct platform_device *pdev)
648648

649649
platform_set_drvdata(pdev, data);
650650

651-
if (of_find_property(pdev->dev.of_node, "nvmem-cells", NULL)) {
651+
if (of_property_present(pdev->dev.of_node, "nvmem-cells")) {
652652
ret = imx_init_from_nvmem_cells(pdev);
653653
if (ret)
654654
return dev_err_probe(&pdev->dev, ret,

drivers/thermal/ti-soc-thermal/ti-thermal-common.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -223,7 +223,7 @@ int ti_thermal_register_cpu_cooling(struct ti_bandgap *bgp, int id)
223223
* using DT, then it must be aware that the cooling device
224224
* loading has to happen via cpufreq driver.
225225
*/
226-
if (of_find_property(np, "#thermal-sensor-cells", NULL))
226+
if (of_property_present(np, "#thermal-sensor-cells"))
227227
return 0;
228228

229229
data = ti_bandgap_get_sensor_data(bgp, id);

0 commit comments

Comments
 (0)