Commit eb3591cd authored by Rafael J. Wysocki's avatar Rafael J. Wysocki

thermal: core: Drop redundant thermal instance checks

Because the trip and cdev pointers are sufficient to identify a thermal
instance holding them unambiguously, drop the additional thermal zone
checks from two loops walking the list of thermal instances in a
thermal zone.

No intentional functional impact.
Signed-off-by: default avatarRafael J. Wysocki <rafael.j.wysocki@intel.com>
Reviewed-by: default avatarZhang Rui <rui.zhang@intel.com>
Reviewed-by: default avatarDaniel Lezcano <daniel.lezcano@linaro.org>
Link: https://patch.msgid.link/10527734.nUPlyArG6x@rjwysocki.net
parent b4e6d398
...@@ -858,7 +858,7 @@ int thermal_bind_cdev_to_trip(struct thermal_zone_device *tz, ...@@ -858,7 +858,7 @@ int thermal_bind_cdev_to_trip(struct thermal_zone_device *tz,
mutex_lock(&tz->lock); mutex_lock(&tz->lock);
mutex_lock(&cdev->lock); mutex_lock(&cdev->lock);
list_for_each_entry(pos, &tz->thermal_instances, tz_node) list_for_each_entry(pos, &tz->thermal_instances, tz_node)
if (pos->tz == tz && pos->trip == trip && pos->cdev == cdev) { if (pos->trip == trip && pos->cdev == cdev) {
result = -EEXIST; result = -EEXIST;
break; break;
} }
...@@ -923,7 +923,7 @@ int thermal_unbind_cdev_from_trip(struct thermal_zone_device *tz, ...@@ -923,7 +923,7 @@ int thermal_unbind_cdev_from_trip(struct thermal_zone_device *tz,
mutex_lock(&tz->lock); mutex_lock(&tz->lock);
mutex_lock(&cdev->lock); mutex_lock(&cdev->lock);
list_for_each_entry_safe(pos, next, &tz->thermal_instances, tz_node) { list_for_each_entry_safe(pos, next, &tz->thermal_instances, tz_node) {
if (pos->tz == tz && pos->trip == trip && pos->cdev == cdev) { if (pos->trip == trip && pos->cdev == cdev) {
list_del(&pos->tz_node); list_del(&pos->tz_node);
list_del(&pos->cdev_node); list_del(&pos->cdev_node);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment