summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRafael J. Wysocki <rafael.j.wysocki@intel.com>2024-08-19 17:52:54 +0200
committerRafael J. Wysocki <rafael.j.wysocki@intel.com>2024-08-22 17:43:14 +0200
commiteb3591cde1aee34c56b5dc96d9b247349827024f (patch)
tree37c14e1e206d3ee73be6d229f46f6cf267a74503
parentb4e6d39817312919f907da266de202a30a7bc43b (diff)
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: Rafael J. Wysocki <rafael.j.wysocki@intel.com> Reviewed-by: Zhang Rui <rui.zhang@intel.com> Reviewed-by: Daniel Lezcano <daniel.lezcano@linaro.org> Link: https://patch.msgid.link/10527734.nUPlyArG6x@rjwysocki.net
-rw-r--r--drivers/thermal/thermal_core.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/drivers/thermal/thermal_core.c b/drivers/thermal/thermal_core.c
index 903971f8f08c..0085a8df8523 100644
--- a/drivers/thermal/thermal_core.c
+++ b/drivers/thermal/thermal_core.c
@@ -858,7 +858,7 @@ int thermal_bind_cdev_to_trip(struct thermal_zone_device *tz,
mutex_lock(&tz->lock);
mutex_lock(&cdev->lock);
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;
break;
}
@@ -923,7 +923,7 @@ int thermal_unbind_cdev_from_trip(struct thermal_zone_device *tz,
mutex_lock(&tz->lock);
mutex_lock(&cdev->lock);
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->cdev_node);