mirror of
https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git
synced 2024-09-07 03:18:31 +00:00
thermal: of: use for_each_available_child_of_node for child iterator
Use for_each_available_child_of_node() for iterating over each available child instead of iterating over each child and then checking their status. Signed-off-by: Laxman Dewangan <ldewangan@nvidia.com> Signed-off-by: Eduardo Valentin <edubezval@gmail.com>
This commit is contained in:
parent
765bdb406d
commit
42bbe400fb
1 changed files with 3 additions and 15 deletions
|
@ -475,14 +475,10 @@ thermal_zone_of_sensor_register(struct device *dev, int sensor_id, void *data,
|
||||||
|
|
||||||
sensor_np = of_node_get(dev->of_node);
|
sensor_np = of_node_get(dev->of_node);
|
||||||
|
|
||||||
for_each_child_of_node(np, child) {
|
for_each_available_child_of_node(np, child) {
|
||||||
struct of_phandle_args sensor_specs;
|
struct of_phandle_args sensor_specs;
|
||||||
int ret, id;
|
int ret, id;
|
||||||
|
|
||||||
/* Check whether child is enabled or not */
|
|
||||||
if (!of_device_is_available(child))
|
|
||||||
continue;
|
|
||||||
|
|
||||||
/* For now, thermal framework supports only 1 sensor per zone */
|
/* For now, thermal framework supports only 1 sensor per zone */
|
||||||
ret = of_parse_phandle_with_args(child, "thermal-sensors",
|
ret = of_parse_phandle_with_args(child, "thermal-sensors",
|
||||||
"#thermal-sensor-cells",
|
"#thermal-sensor-cells",
|
||||||
|
@ -881,16 +877,12 @@ int __init of_parse_thermal_zones(void)
|
||||||
return 0; /* Run successfully on systems without thermal DT */
|
return 0; /* Run successfully on systems without thermal DT */
|
||||||
}
|
}
|
||||||
|
|
||||||
for_each_child_of_node(np, child) {
|
for_each_available_child_of_node(np, child) {
|
||||||
struct thermal_zone_device *zone;
|
struct thermal_zone_device *zone;
|
||||||
struct thermal_zone_params *tzp;
|
struct thermal_zone_params *tzp;
|
||||||
int i, mask = 0;
|
int i, mask = 0;
|
||||||
u32 prop;
|
u32 prop;
|
||||||
|
|
||||||
/* Check whether child is enabled or not */
|
|
||||||
if (!of_device_is_available(child))
|
|
||||||
continue;
|
|
||||||
|
|
||||||
tz = thermal_of_build_thermal_zone(child);
|
tz = thermal_of_build_thermal_zone(child);
|
||||||
if (IS_ERR(tz)) {
|
if (IS_ERR(tz)) {
|
||||||
pr_err("failed to build thermal zone %s: %ld\n",
|
pr_err("failed to build thermal zone %s: %ld\n",
|
||||||
|
@ -968,13 +960,9 @@ void of_thermal_destroy_zones(void)
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
for_each_child_of_node(np, child) {
|
for_each_available_child_of_node(np, child) {
|
||||||
struct thermal_zone_device *zone;
|
struct thermal_zone_device *zone;
|
||||||
|
|
||||||
/* Check whether child is enabled or not */
|
|
||||||
if (!of_device_is_available(child))
|
|
||||||
continue;
|
|
||||||
|
|
||||||
zone = thermal_zone_get_zone_by_name(child->name);
|
zone = thermal_zone_get_zone_by_name(child->name);
|
||||||
if (IS_ERR(zone))
|
if (IS_ERR(zone))
|
||||||
continue;
|
continue;
|
||||||
|
|
Loading…
Reference in a new issue