thermal: Use of_property_present() for testing DT property presence
PATCH 1/1 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.
--- 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(-)
drivers/thermal/cpufreq_cooling.c +1 -1
@@ -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);
drivers/thermal/imx8mm_thermal.c +1 -1
@@ -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 ;
drivers/thermal/imx_thermal.c +2 -2
@@ -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,
drivers/thermal/ti-soc-thermal/ti-thermal-common.c +1 -1
@@ -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);
Signature · 1 line
2.39.2
Quoted 7 lines · Rob Herring
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.
Quoted 7 lines
Signed-off-by Rob Herring <[email protected]>--- 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(-)
Signature · 1 line
viresh
Rafael J. Wysocki
maintainerQuoted 9 lines · Rob Herring
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 <[email protected]>
Daniel, are you going to apply this, or should I take it directly?
Quoted 71 lines
--- 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(-)drivers/thermal/cpufreq_cooling.c +1
-1@@ -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);drivers/thermal/imx8mm_thermal.c +1
-1@@ -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 ;drivers/thermal/imx_thermal.c +2
-2@@ -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,drivers/thermal/ti-soc-thermal/ti-thermal-common.c +1
-2@@ -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
Quoted 10 lines · Rafael J. Wysocki
Quoted 8 lines · Rob Herring
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.
Quoted 3 lines
Quoted 1 line
Signed-off-by Rob Herring <[email protected]>Daniel, are you going to apply this, or should I take it directly?
Applied as 6.4 material, thanks!
Quoted 71 lines
Quoted 71 lines
--- 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(-)drivers/thermal/cpufreq_cooling.c +1
-1@@ -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);drivers/thermal/imx8mm_thermal.c +1
-1@@ -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 ;drivers/thermal/imx_thermal.c +2
-2@@ -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,drivers/thermal/ti-soc-thermal/ti-thermal-common.c +1
-2@@ -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
Quoted 11 lines · Rafael J. Wysocki
Quoted 10 lines · Rafael J. Wysocki
Quoted 8 lines · Rob Herring
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.
Quoted 5 lines
Quoted 3 lines
Quoted 1 line
Signed-off-by Rob Herring <[email protected]>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 ?
Signature · 5 lines
<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
Rafael J. Wysocki
maintainerQuoted 15 lines · Daniel Lezcano
Quoted 13 lines · Rafael J. Wysocki
Quoted 12 lines · Rafael J. Wysocki
Quoted 9 lines · Rob Herring
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 <[email protected]>
Quoted 7 lines
Quoted 3 lines
Quoted 1 line
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.