* [PATCH] thermal: Use of_property_present() for testing DT property presence
@ 2023-03-10 14:47 Rob Herring
2023-03-13 4:29 ` Viresh Kumar
2023-03-27 17:13 ` Rafael J. Wysocki
0 siblings, 2 replies; 6+ messages in thread
From: Rob Herring @ 2023-03-10 14:47 UTC (permalink / raw)
To: Amit Daniel Kachhap, Daniel Lezcano, Viresh Kumar, Lukasz Luba,
Rafael J. Wysocki, Amit Kucheria, Zhang Rui, Shawn Guo,
Sascha Hauer, Pengutronix Kernel Team, Fabio Estevam,
NXP Linux Team, Eduardo Valentin, Keerthy
Cc: devicetree, linux-pm, linux-kernel, linux-arm-kernel, linux-omap
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>
---
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
^ permalink raw reply related [flat|nested] 6+ messages in thread
* Re: [PATCH] thermal: Use of_property_present() for testing DT property presence
2023-03-10 14:47 [PATCH] thermal: Use of_property_present() for testing DT property presence Rob Herring
@ 2023-03-13 4:29 ` Viresh Kumar
2023-03-27 17:13 ` Rafael J. Wysocki
1 sibling, 0 replies; 6+ messages in thread
From: Viresh Kumar @ 2023-03-13 4:29 UTC (permalink / raw)
To: Rob Herring
Cc: Amit Daniel Kachhap, Daniel Lezcano, Lukasz Luba,
Rafael J. Wysocki, Amit Kucheria, Zhang Rui, Shawn Guo,
Sascha Hauer, Pengutronix Kernel Team, Fabio Estevam,
NXP Linux Team, Eduardo Valentin, Keerthy, devicetree, linux-pm,
linux-kernel, linux-arm-kernel, linux-omap
On 10-03-23, 08:47, Rob Herring wrote:
> 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>
> ---
> 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(-)
Acked-by: Viresh Kumar <viresh.kumar@linaro.org>
--
viresh
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [PATCH] thermal: Use of_property_present() for testing DT property presence
2023-03-10 14:47 [PATCH] thermal: Use of_property_present() for testing DT property presence Rob Herring
2023-03-13 4:29 ` Viresh Kumar
@ 2023-03-27 17:13 ` Rafael J. Wysocki
2023-03-30 17:28 ` Rafael J. Wysocki
1 sibling, 1 reply; 6+ messages in thread
From: Rafael J. Wysocki @ 2023-03-27 17:13 UTC (permalink / raw)
To: Rob Herring, Daniel Lezcano
Cc: Amit Daniel Kachhap, Viresh Kumar, Lukasz Luba, Rafael J. Wysocki,
Amit Kucheria, Zhang Rui, Shawn Guo, Sascha Hauer,
Pengutronix Kernel Team, Fabio Estevam, NXP Linux Team,
Eduardo Valentin, Keerthy, devicetree, linux-pm, linux-kernel,
linux-arm-kernel, linux-omap
On Fri, Mar 10, 2023 at 3:48 PM Rob Herring <robh@kernel.org> wrote:
>
> 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>
Daniel, are you going to apply this, or should I take it directly?
> ---
> 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
>
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [PATCH] thermal: Use of_property_present() for testing DT property presence
2023-03-27 17:13 ` Rafael J. Wysocki
@ 2023-03-30 17:28 ` Rafael J. Wysocki
2023-03-31 8:44 ` Daniel Lezcano
0 siblings, 1 reply; 6+ messages in thread
From: Rafael J. Wysocki @ 2023-03-30 17:28 UTC (permalink / raw)
To: Rob Herring, Daniel Lezcano
Cc: Amit Daniel Kachhap, Viresh Kumar, Lukasz Luba, Rafael J. Wysocki,
Amit Kucheria, Zhang Rui, Shawn Guo, Sascha Hauer,
Pengutronix Kernel Team, Fabio Estevam, NXP Linux Team,
Eduardo Valentin, devicetree, linux-pm, linux-kernel,
linux-arm-kernel, linux-omap
On Mon, Mar 27, 2023 at 7:13 PM Rafael J. Wysocki <rafael@kernel.org> wrote:
>
> On Fri, Mar 10, 2023 at 3:48 PM Rob Herring <robh@kernel.org> wrote:
> >
> > 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>
>
> Daniel, are you going to apply this, or should I take it directly?
Applied as 6.4 material, thanks!
> > ---
> > 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
> >
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [PATCH] thermal: Use of_property_present() for testing DT property presence
2023-03-30 17:28 ` Rafael J. Wysocki
@ 2023-03-31 8:44 ` Daniel Lezcano
2023-03-31 9:04 ` Rafael J. Wysocki
0 siblings, 1 reply; 6+ messages in thread
From: Daniel Lezcano @ 2023-03-31 8:44 UTC (permalink / raw)
To: Rafael J. Wysocki, Rob Herring
Cc: Amit Daniel Kachhap, Viresh Kumar, Lukasz Luba, Amit Kucheria,
Zhang Rui, Shawn Guo, Sascha Hauer, Pengutronix Kernel Team,
Fabio Estevam, NXP Linux Team, Eduardo Valentin, devicetree,
linux-pm, linux-kernel, linux-arm-kernel, linux-omap
On 30/03/2023 19:28, Rafael J. Wysocki wrote:
> On Mon, Mar 27, 2023 at 7:13 PM Rafael J. Wysocki <rafael@kernel.org> wrote:
>>
>> On Fri, Mar 10, 2023 at 3:48 PM Rob Herring <robh@kernel.org> wrote:
>>>
>>> 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>
>>
>> Daniel, are you going to apply this, or should I take it directly?
>
> Applied as 6.4 material, thanks
Sorry, I forgot to answer. I already applied it.
Shall I drop it from my branch ?
--
<http://www.linaro.org/> Linaro.org │ Open source software for ARM SoCs
Follow Linaro: <http://www.facebook.com/pages/Linaro> Facebook |
<http://twitter.com/#!/linaroorg> Twitter |
<http://www.linaro.org/linaro-blog/> Blog
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [PATCH] thermal: Use of_property_present() for testing DT property presence
2023-03-31 8:44 ` Daniel Lezcano
@ 2023-03-31 9:04 ` Rafael J. Wysocki
0 siblings, 0 replies; 6+ messages in thread
From: Rafael J. Wysocki @ 2023-03-31 9:04 UTC (permalink / raw)
To: Daniel Lezcano
Cc: Rafael J. Wysocki, Rob Herring, Amit Daniel Kachhap, Viresh Kumar,
Lukasz Luba, Amit Kucheria, Zhang Rui, Shawn Guo, Sascha Hauer,
Pengutronix Kernel Team, Fabio Estevam, NXP Linux Team,
Eduardo Valentin, devicetree, linux-pm, linux-kernel,
linux-arm-kernel, linux-omap
On Fri, Mar 31, 2023 at 10:44 AM Daniel Lezcano
<daniel.lezcano@linaro.org> wrote:
>
> On 30/03/2023 19:28, Rafael J. Wysocki wrote:
> > On Mon, Mar 27, 2023 at 7:13 PM Rafael J. Wysocki <rafael@kernel.org> wrote:
> >>
> >> On Fri, Mar 10, 2023 at 3:48 PM Rob Herring <robh@kernel.org> wrote:
> >>>
> >>> 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>
> >>
> >> Daniel, are you going to apply this, or should I take it directly?
> >
> > Applied as 6.4 material, thanks
>
> Sorry, I forgot to answer. I already applied it.
>
> Shall I drop it from my branch ?
If you can do that, then yes, please.
^ permalink raw reply [flat|nested] 6+ messages in thread
end of thread, other threads:[~2023-03-31 9:05 UTC | newest]
Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2023-03-10 14:47 [PATCH] thermal: Use of_property_present() for testing DT property presence Rob Herring
2023-03-13 4:29 ` Viresh Kumar
2023-03-27 17:13 ` Rafael J. Wysocki
2023-03-30 17:28 ` Rafael J. Wysocki
2023-03-31 8:44 ` Daniel Lezcano
2023-03-31 9:04 ` Rafael J. Wysocki
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).