Merge tag 'block-5.13-2021-05-14' of git://git.kernel.dk/linux-block
[linux-2.6-microblaze.git] / drivers / thermal / gov_fair_share.c
index aaa0718..1e5abf4 100644 (file)
@@ -82,6 +82,8 @@ static int fair_share_throttle(struct thermal_zone_device *tz, int trip)
        int total_instance = 0;
        int cur_trip_level = get_trip_level(tz);
 
+       mutex_lock(&tz->lock);
+
        list_for_each_entry(instance, &tz->thermal_instances, tz_node) {
                if (instance->trip != trip)
                        continue;
@@ -105,11 +107,12 @@ static int fair_share_throttle(struct thermal_zone_device *tz, int trip)
                instance->target = get_target_state(tz, cdev, percentage,
                                                    cur_trip_level);
 
-               mutex_lock(&instance->cdev->lock);
-               instance->cdev->updated = false;
-               mutex_unlock(&instance->cdev->lock);
-               thermal_cdev_update(cdev);
+               mutex_lock(&cdev->lock);
+               __thermal_cdev_update(cdev);
+               mutex_unlock(&cdev->lock);
        }
+
+       mutex_unlock(&tz->lock);
        return 0;
 }