{
struct thermal_instance *instance;
- mutex_lock(&tz->lock);
+ lockdep_assert_held(&tz->lock);
thermal_zone_trip_update(tz, trip);
list_for_each_entry(instance, &tz->thermal_instances, tz_node)
thermal_cdev_update(instance->cdev);
- mutex_unlock(&tz->lock);
-
return 0;
}
int total_instance = 0;
int cur_trip_level = get_trip_level(tz);
- mutex_lock(&tz->lock);
+ lockdep_assert_held(&tz->lock);
list_for_each_entry(instance, &tz->thermal_instances, tz_node) {
if (instance->trip != trip)
mutex_unlock(&cdev->lock);
}
- mutex_unlock(&tz->lock);
-
return 0;
}
static int power_allocator_throttle(struct thermal_zone_device *tz, int trip)
{
- int ret = 0;
+ int ret;
int switch_on_temp, control_temp;
struct power_allocator_params *params = tz->governor_data;
bool update;
- mutex_lock(&tz->lock);
+ lockdep_assert_held(&tz->lock);
/*
* We get called for every trip point but we only need to do
* our calculations once
*/
if (trip != params->trip_max_desired_temperature)
- goto out;
+ return 0;
ret = tz->ops->get_trip_temp(tz, params->trip_switch_on,
&switch_on_temp);
tz->passive = 0;
reset_pid_controller(params);
allow_maximum_power(tz, update);
- goto out;
+ return 0;
}
tz->passive = 1;
dev_warn(&tz->device,
"Failed to get the maximum desired temperature: %d\n",
ret);
- goto out;
+ return ret;
}
- ret = allocate_power(tz, control_temp);
-
- mutex_unlock(&tz->lock);
-out:
- return ret;
+ return allocate_power(tz, control_temp);
}
static struct thermal_governor thermal_gov_power_allocator = {
{
struct thermal_instance *instance;
- mutex_lock(&tz->lock);
+ lockdep_assert_held(&tz->lock);
thermal_zone_trip_update(tz, trip);
list_for_each_entry(instance, &tz->thermal_instances, tz_node)
thermal_cdev_update(instance->cdev);
- mutex_unlock(&tz->lock);
-
return 0;
}
static void handle_non_critical_trips(struct thermal_zone_device *tz, int trip)
{
+ mutex_lock(&tz->lock);
tz->governor ? tz->governor->throttle(tz, trip) :
def_governor->throttle(tz, trip);
+ mutex_unlock(&tz->lock);
}
void thermal_zone_device_critical(struct thermal_zone_device *tz)