diff options
Diffstat (limited to 'drivers/thermal/thermal_core.c')
| -rw-r--r-- | drivers/thermal/thermal_core.c | 22 | 
1 files changed, 16 insertions, 6 deletions
| diff --git a/drivers/thermal/thermal_core.c b/drivers/thermal/thermal_core.c index 51374f4e1cca..648829ab79ff 100644 --- a/drivers/thermal/thermal_core.c +++ b/drivers/thermal/thermal_core.c @@ -375,10 +375,12 @@ static void handle_thermal_trip(struct thermal_zone_device *tz, int trip)  	if (tz->last_temperature != THERMAL_TEMP_INVALID) {  		if (tz->last_temperature < trip_temp &&  		    tz->temperature >= trip_temp) -			thermal_notify_tz_trip_up(tz->id, trip); +			thermal_notify_tz_trip_up(tz->id, trip, +						  tz->temperature);  		if (tz->last_temperature >= trip_temp &&  		    tz->temperature < (trip_temp - hyst)) -			thermal_notify_tz_trip_down(tz->id, trip); +			thermal_notify_tz_trip_down(tz->id, trip, +						    tz->temperature);  	}  	if (type == THERMAL_TRIP_CRITICAL || type == THERMAL_TRIP_HOT) @@ -887,7 +889,7 @@ __thermal_cooling_device_register(struct device_node *np,  {  	struct thermal_cooling_device *cdev;  	struct thermal_zone_device *pos = NULL; -	int ret; +	int id, ret;  	if (!ops || !ops->get_max_state || !ops->get_cur_state ||  	    !ops->set_cur_state) @@ -901,6 +903,11 @@ __thermal_cooling_device_register(struct device_node *np,  	if (ret < 0)  		goto out_kfree_cdev;  	cdev->id = ret; +	id = ret; + +	ret = dev_set_name(&cdev->device, "cooling_device%d", cdev->id); +	if (ret) +		goto out_ida_remove;  	cdev->type = kstrdup(type ? type : "", GFP_KERNEL);  	if (!cdev->type) { @@ -916,7 +923,6 @@ __thermal_cooling_device_register(struct device_node *np,  	cdev->device.class = &thermal_class;  	cdev->devdata = devdata;  	thermal_cooling_device_setup_sysfs(cdev); -	dev_set_name(&cdev->device, "cooling_device%d", cdev->id);  	ret = device_register(&cdev->device);  	if (ret)  		goto out_kfree_type; @@ -941,8 +947,9 @@ __thermal_cooling_device_register(struct device_node *np,  out_kfree_type:  	kfree(cdev->type);  	put_device(&cdev->device); +	cdev = NULL;  out_ida_remove: -	ida_simple_remove(&thermal_cdev_ida, cdev->id); +	ida_simple_remove(&thermal_cdev_ida, id);  out_kfree_cdev:  	kfree(cdev);  	return ERR_PTR(ret); @@ -1227,6 +1234,10 @@ thermal_zone_device_register(const char *type, int trips, int mask,  	tz->id = id;  	strlcpy(tz->type, type, sizeof(tz->type)); +	result = dev_set_name(&tz->device, "thermal_zone%d", tz->id); +	if (result) +		goto remove_id; +  	if (!ops->critical)  		ops->critical = thermal_zone_device_critical; @@ -1248,7 +1259,6 @@ thermal_zone_device_register(const char *type, int trips, int mask,  	/* A new thermal zone needs to be updated anyway. */  	atomic_set(&tz->need_update, 1); -	dev_set_name(&tz->device, "thermal_zone%d", tz->id);  	result = device_register(&tz->device);  	if (result)  		goto release_device; |