[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Message-Id: <20230310144726.1545543-1-robh@kernel.org>
Date: Fri, 10 Mar 2023 08:47:26 -0600
From: Rob Herring <robh@...nel.org>
To: Amit Daniel Kachhap <amit.kachhap@...il.com>,
Daniel Lezcano <daniel.lezcano@...aro.org>,
Viresh Kumar <viresh.kumar@...aro.org>,
Lukasz Luba <lukasz.luba@....com>,
"Rafael J. Wysocki" <rafael@...nel.org>,
Amit Kucheria <amitk@...nel.org>,
Zhang Rui <rui.zhang@...el.com>,
Shawn Guo <shawnguo@...nel.org>,
Sascha Hauer <s.hauer@...gutronix.de>,
Pengutronix Kernel Team <kernel@...gutronix.de>,
Fabio Estevam <festevam@...il.com>,
NXP Linux Team <linux-imx@....com>,
Eduardo Valentin <edubezval@...il.com>,
Keerthy <j-keerthy@...com>
Cc: devicetree@...r.kernel.org, linux-pm@...r.kernel.org,
linux-kernel@...r.kernel.org, linux-arm-kernel@...ts.infradead.org,
linux-omap@...r.kernel.org
Subject: [PATCH] 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@...nel.org>
---
drivers/thermal/cpufreq_cooling.c | 2 +-
drivers/thermal/imx8mm_thermal.c | 2 +-
drivers/thermal/imx_thermal.c | 4 ++--
drivers/thermal/ti-soc-thermal/ti-thermal-common.c | 2 +-
4 files changed, 5 insertions(+), 5 deletions(-)
diff --git a/drivers/thermal/cpufreq_cooling.c b/drivers/thermal/cpufreq_cooling.c
index 9f8b438fcf8f..4608555b7ec3 100644
--- a/drivers/thermal/cpufreq_cooling.c
+++ b/drivers/thermal/cpufreq_cooling.c
@@ -633,7 +633,7 @@ of_cpufreq_cooling_register(struct cpufreq_policy *policy)
return NULL;
}
- if (of_find_property(np, "#cooling-cells", NULL)) {
+ if (of_property_present(np, "#cooling-cells")) {
struct em_perf_domain *em = em_cpu_get(policy->cpu);
cdev = __cpufreq_cooling_register(np, policy, em);
diff --git a/drivers/thermal/imx8mm_thermal.c b/drivers/thermal/imx8mm_thermal.c
index 72b5d6f319c1..334ce8e9830b 100644
--- a/drivers/thermal/imx8mm_thermal.c
+++ b/drivers/thermal/imx8mm_thermal.c
@@ -282,7 +282,7 @@ static int imx8mm_tmu_probe_set_calib(struct platform_device *pdev,
* strongly recommended to update such old DTs to get correct
* temperature compensation values for each SoC.
*/
- if (!of_find_property(pdev->dev.of_node, "nvmem-cells", NULL)) {
+ if (!of_property_present(pdev->dev.of_node, "nvmem-cells")) {
dev_warn(dev,
"No OCOTP nvmem reference found, SoC-specific calibration not loaded. Please update your DT.\n");
return 0;
diff --git a/drivers/thermal/imx_thermal.c b/drivers/thermal/imx_thermal.c
index fb0d5cab70af..77d6567a3f47 100644
--- a/drivers/thermal/imx_thermal.c
+++ b/drivers/thermal/imx_thermal.c
@@ -594,7 +594,7 @@ static int imx_thermal_register_legacy_cooling(struct imx_thermal_data *data)
np = of_get_cpu_node(data->policy->cpu, NULL);
- if (!np || !of_find_property(np, "#cooling-cells", NULL)) {
+ if (!np || !of_property_present(np, "#cooling-cells")) {
data->cdev = cpufreq_cooling_register(data->policy);
if (IS_ERR(data->cdev)) {
ret = PTR_ERR(data->cdev);
@@ -671,7 +671,7 @@ static int imx_thermal_probe(struct platform_device *pdev)
platform_set_drvdata(pdev, data);
- if (of_find_property(pdev->dev.of_node, "nvmem-cells", NULL)) {
+ if (of_property_present(pdev->dev.of_node, "nvmem-cells")) {
ret = imx_init_from_nvmem_cells(pdev);
if (ret)
return dev_err_probe(&pdev->dev, ret,
diff --git a/drivers/thermal/ti-soc-thermal/ti-thermal-common.c b/drivers/thermal/ti-soc-thermal/ti-thermal-common.c
index 8a9055bd376e..dace6591220e 100644
--- a/drivers/thermal/ti-soc-thermal/ti-thermal-common.c
+++ b/drivers/thermal/ti-soc-thermal/ti-thermal-common.c
@@ -223,7 +223,7 @@ int ti_thermal_register_cpu_cooling(struct ti_bandgap *bgp, int id)
* using DT, then it must be aware that the cooling device
* loading has to happen via cpufreq driver.
*/
- if (of_find_property(np, "#thermal-sensor-cells", NULL))
+ if (of_property_present(np, "#thermal-sensor-cells"))
return 0;
data = ti_bandgap_get_sensor_data(bgp, id);
--
2.39.2
Powered by blists - more mailing lists