mirror of
https://github.com/torvalds/linux.git
synced 2024-12-03 01:21:28 +00:00
ACPI: thermal: Use white space more consistently
The usage of white space in the ACPI thermal driver is not very consistent, so improve that a bit. While at it, add missing braces to if()/else in a few places. No functional impact. Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com> Acked-by: Daniel Lezcano <daniel.lezcano@linaro.org>
This commit is contained in:
parent
9388076b4c
commit
52ce50498c
@ -158,7 +158,7 @@ struct acpi_thermal_flags {
|
|||||||
};
|
};
|
||||||
|
|
||||||
struct acpi_thermal {
|
struct acpi_thermal {
|
||||||
struct acpi_device * device;
|
struct acpi_device *device;
|
||||||
acpi_bus_id name;
|
acpi_bus_id name;
|
||||||
unsigned long temperature;
|
unsigned long temperature;
|
||||||
unsigned long last_temperature;
|
unsigned long last_temperature;
|
||||||
@ -270,8 +270,7 @@ static int acpi_thermal_trips_update(struct acpi_thermal *tz, int flag)
|
|||||||
|
|
||||||
/* Critical Shutdown */
|
/* Critical Shutdown */
|
||||||
if (flag & ACPI_TRIPS_CRITICAL) {
|
if (flag & ACPI_TRIPS_CRITICAL) {
|
||||||
status = acpi_evaluate_integer(tz->device->handle,
|
status = acpi_evaluate_integer(tz->device->handle, "_CRT", NULL, &tmp);
|
||||||
"_CRT", NULL, &tmp);
|
|
||||||
tz->trips.critical.temperature = tmp;
|
tz->trips.critical.temperature = tmp;
|
||||||
/*
|
/*
|
||||||
* Treat freezing temperatures as invalid as well; some
|
* Treat freezing temperatures as invalid as well; some
|
||||||
@ -284,8 +283,7 @@ static int acpi_thermal_trips_update(struct acpi_thermal *tz, int flag)
|
|||||||
acpi_handle_debug(tz->device->handle,
|
acpi_handle_debug(tz->device->handle,
|
||||||
"No critical threshold\n");
|
"No critical threshold\n");
|
||||||
} else if (tmp <= 2732) {
|
} else if (tmp <= 2732) {
|
||||||
pr_info(FW_BUG "Invalid critical threshold (%llu)\n",
|
pr_info(FW_BUG "Invalid critical threshold (%llu)\n", tmp);
|
||||||
tmp);
|
|
||||||
tz->trips.critical.flags.valid = 0;
|
tz->trips.critical.flags.valid = 0;
|
||||||
} else {
|
} else {
|
||||||
tz->trips.critical.flags.valid = 1;
|
tz->trips.critical.flags.valid = 1;
|
||||||
@ -312,8 +310,7 @@ static int acpi_thermal_trips_update(struct acpi_thermal *tz, int flag)
|
|||||||
|
|
||||||
/* Critical Sleep (optional) */
|
/* Critical Sleep (optional) */
|
||||||
if (flag & ACPI_TRIPS_HOT) {
|
if (flag & ACPI_TRIPS_HOT) {
|
||||||
status = acpi_evaluate_integer(tz->device->handle,
|
status = acpi_evaluate_integer(tz->device->handle, "_HOT", NULL, &tmp);
|
||||||
"_HOT", NULL, &tmp);
|
|
||||||
if (ACPI_FAILURE(status)) {
|
if (ACPI_FAILURE(status)) {
|
||||||
tz->trips.hot.flags.valid = 0;
|
tz->trips.hot.flags.valid = 0;
|
||||||
acpi_handle_debug(tz->device->handle,
|
acpi_handle_debug(tz->device->handle,
|
||||||
@ -329,7 +326,7 @@ static int acpi_thermal_trips_update(struct acpi_thermal *tz, int flag)
|
|||||||
|
|
||||||
/* Passive (optional) */
|
/* Passive (optional) */
|
||||||
if (((flag & ACPI_TRIPS_PASSIVE) && tz->trips.passive.flags.valid) ||
|
if (((flag & ACPI_TRIPS_PASSIVE) && tz->trips.passive.flags.valid) ||
|
||||||
(flag == ACPI_TRIPS_INIT)) {
|
(flag == ACPI_TRIPS_INIT)) {
|
||||||
valid = tz->trips.passive.flags.valid;
|
valid = tz->trips.passive.flags.valid;
|
||||||
if (psv == -1) {
|
if (psv == -1) {
|
||||||
status = AE_SUPPORT;
|
status = AE_SUPPORT;
|
||||||
@ -338,32 +335,31 @@ static int acpi_thermal_trips_update(struct acpi_thermal *tz, int flag)
|
|||||||
status = AE_OK;
|
status = AE_OK;
|
||||||
} else {
|
} else {
|
||||||
status = acpi_evaluate_integer(tz->device->handle,
|
status = acpi_evaluate_integer(tz->device->handle,
|
||||||
"_PSV", NULL, &tmp);
|
"_PSV", NULL, &tmp);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (ACPI_FAILURE(status))
|
if (ACPI_FAILURE(status)) {
|
||||||
tz->trips.passive.flags.valid = 0;
|
tz->trips.passive.flags.valid = 0;
|
||||||
else {
|
} else {
|
||||||
tz->trips.passive.temperature = tmp;
|
tz->trips.passive.temperature = tmp;
|
||||||
tz->trips.passive.flags.valid = 1;
|
tz->trips.passive.flags.valid = 1;
|
||||||
if (flag == ACPI_TRIPS_INIT) {
|
if (flag == ACPI_TRIPS_INIT) {
|
||||||
status = acpi_evaluate_integer(
|
status = acpi_evaluate_integer(tz->device->handle,
|
||||||
tz->device->handle, "_TC1",
|
"_TC1", NULL, &tmp);
|
||||||
NULL, &tmp);
|
|
||||||
if (ACPI_FAILURE(status))
|
if (ACPI_FAILURE(status))
|
||||||
tz->trips.passive.flags.valid = 0;
|
tz->trips.passive.flags.valid = 0;
|
||||||
else
|
else
|
||||||
tz->trips.passive.tc1 = tmp;
|
tz->trips.passive.tc1 = tmp;
|
||||||
status = acpi_evaluate_integer(
|
|
||||||
tz->device->handle, "_TC2",
|
status = acpi_evaluate_integer(tz->device->handle,
|
||||||
NULL, &tmp);
|
"_TC2", NULL, &tmp);
|
||||||
if (ACPI_FAILURE(status))
|
if (ACPI_FAILURE(status))
|
||||||
tz->trips.passive.flags.valid = 0;
|
tz->trips.passive.flags.valid = 0;
|
||||||
else
|
else
|
||||||
tz->trips.passive.tc2 = tmp;
|
tz->trips.passive.tc2 = tmp;
|
||||||
status = acpi_evaluate_integer(
|
|
||||||
tz->device->handle, "_TSP",
|
status = acpi_evaluate_integer(tz->device->handle,
|
||||||
NULL, &tmp);
|
"_TSP", NULL, &tmp);
|
||||||
if (ACPI_FAILURE(status))
|
if (ACPI_FAILURE(status))
|
||||||
tz->trips.passive.flags.valid = 0;
|
tz->trips.passive.flags.valid = 0;
|
||||||
else
|
else
|
||||||
@ -374,25 +370,25 @@ static int acpi_thermal_trips_update(struct acpi_thermal *tz, int flag)
|
|||||||
if ((flag & ACPI_TRIPS_DEVICES) && tz->trips.passive.flags.valid) {
|
if ((flag & ACPI_TRIPS_DEVICES) && tz->trips.passive.flags.valid) {
|
||||||
memset(&devices, 0, sizeof(struct acpi_handle_list));
|
memset(&devices, 0, sizeof(struct acpi_handle_list));
|
||||||
status = acpi_evaluate_reference(tz->device->handle, "_PSL",
|
status = acpi_evaluate_reference(tz->device->handle, "_PSL",
|
||||||
NULL, &devices);
|
NULL, &devices);
|
||||||
if (ACPI_FAILURE(status)) {
|
if (ACPI_FAILURE(status)) {
|
||||||
acpi_handle_info(tz->device->handle,
|
acpi_handle_info(tz->device->handle,
|
||||||
"Invalid passive threshold\n");
|
"Invalid passive threshold\n");
|
||||||
tz->trips.passive.flags.valid = 0;
|
tz->trips.passive.flags.valid = 0;
|
||||||
}
|
} else {
|
||||||
else
|
|
||||||
tz->trips.passive.flags.valid = 1;
|
tz->trips.passive.flags.valid = 1;
|
||||||
|
}
|
||||||
|
|
||||||
if (memcmp(&tz->trips.passive.devices, &devices,
|
if (memcmp(&tz->trips.passive.devices, &devices,
|
||||||
sizeof(struct acpi_handle_list))) {
|
sizeof(struct acpi_handle_list))) {
|
||||||
memcpy(&tz->trips.passive.devices, &devices,
|
memcpy(&tz->trips.passive.devices, &devices,
|
||||||
sizeof(struct acpi_handle_list));
|
sizeof(struct acpi_handle_list));
|
||||||
ACPI_THERMAL_TRIPS_EXCEPTION(flag, tz, "device");
|
ACPI_THERMAL_TRIPS_EXCEPTION(flag, tz, "device");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if ((flag & ACPI_TRIPS_PASSIVE) || (flag & ACPI_TRIPS_DEVICES)) {
|
if ((flag & ACPI_TRIPS_PASSIVE) || (flag & ACPI_TRIPS_DEVICES)) {
|
||||||
if (valid != tz->trips.passive.flags.valid)
|
if (valid != tz->trips.passive.flags.valid)
|
||||||
ACPI_THERMAL_TRIPS_EXCEPTION(flag, tz, "state");
|
ACPI_THERMAL_TRIPS_EXCEPTION(flag, tz, "state");
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Active (optional) */
|
/* Active (optional) */
|
||||||
@ -404,28 +400,30 @@ static int acpi_thermal_trips_update(struct acpi_thermal *tz, int flag)
|
|||||||
break; /* disable all active trip points */
|
break; /* disable all active trip points */
|
||||||
|
|
||||||
if ((flag == ACPI_TRIPS_INIT) || ((flag & ACPI_TRIPS_ACTIVE) &&
|
if ((flag == ACPI_TRIPS_INIT) || ((flag & ACPI_TRIPS_ACTIVE) &&
|
||||||
tz->trips.active[i].flags.valid)) {
|
tz->trips.active[i].flags.valid)) {
|
||||||
status = acpi_evaluate_integer(tz->device->handle,
|
status = acpi_evaluate_integer(tz->device->handle,
|
||||||
name, NULL, &tmp);
|
name, NULL, &tmp);
|
||||||
if (ACPI_FAILURE(status)) {
|
if (ACPI_FAILURE(status)) {
|
||||||
tz->trips.active[i].flags.valid = 0;
|
tz->trips.active[i].flags.valid = 0;
|
||||||
if (i == 0)
|
if (i == 0)
|
||||||
break;
|
break;
|
||||||
|
|
||||||
if (act <= 0)
|
if (act <= 0)
|
||||||
break;
|
break;
|
||||||
|
|
||||||
if (i == 1)
|
if (i == 1)
|
||||||
tz->trips.active[0].temperature =
|
tz->trips.active[0].temperature = celsius_to_deci_kelvin(act);
|
||||||
celsius_to_deci_kelvin(act);
|
|
||||||
else
|
else
|
||||||
/*
|
/*
|
||||||
* Don't allow override higher than
|
* Don't allow override higher than
|
||||||
* the next higher trip point
|
* the next higher trip point
|
||||||
*/
|
*/
|
||||||
tz->trips.active[i - 1].temperature =
|
tz->trips.active[i-1].temperature =
|
||||||
(tz->trips.active[i - 2].temperature <
|
(tz->trips.active[i-2].temperature <
|
||||||
celsius_to_deci_kelvin(act) ?
|
celsius_to_deci_kelvin(act) ?
|
||||||
tz->trips.active[i - 2].temperature :
|
tz->trips.active[i-2].temperature :
|
||||||
celsius_to_deci_kelvin(act));
|
celsius_to_deci_kelvin(act));
|
||||||
|
|
||||||
break;
|
break;
|
||||||
} else {
|
} else {
|
||||||
tz->trips.active[i].temperature = tmp;
|
tz->trips.active[i].temperature = tmp;
|
||||||
@ -434,22 +432,22 @@ static int acpi_thermal_trips_update(struct acpi_thermal *tz, int flag)
|
|||||||
}
|
}
|
||||||
|
|
||||||
name[2] = 'L';
|
name[2] = 'L';
|
||||||
if ((flag & ACPI_TRIPS_DEVICES) && tz->trips.active[i].flags.valid ) {
|
if ((flag & ACPI_TRIPS_DEVICES) && tz->trips.active[i].flags.valid) {
|
||||||
memset(&devices, 0, sizeof(struct acpi_handle_list));
|
memset(&devices, 0, sizeof(struct acpi_handle_list));
|
||||||
status = acpi_evaluate_reference(tz->device->handle,
|
status = acpi_evaluate_reference(tz->device->handle,
|
||||||
name, NULL, &devices);
|
name, NULL, &devices);
|
||||||
if (ACPI_FAILURE(status)) {
|
if (ACPI_FAILURE(status)) {
|
||||||
acpi_handle_info(tz->device->handle,
|
acpi_handle_info(tz->device->handle,
|
||||||
"Invalid active%d threshold\n", i);
|
"Invalid active%d threshold\n", i);
|
||||||
tz->trips.active[i].flags.valid = 0;
|
tz->trips.active[i].flags.valid = 0;
|
||||||
}
|
} else {
|
||||||
else
|
|
||||||
tz->trips.active[i].flags.valid = 1;
|
tz->trips.active[i].flags.valid = 1;
|
||||||
|
}
|
||||||
|
|
||||||
if (memcmp(&tz->trips.active[i].devices, &devices,
|
if (memcmp(&tz->trips.active[i].devices, &devices,
|
||||||
sizeof(struct acpi_handle_list))) {
|
sizeof(struct acpi_handle_list))) {
|
||||||
memcpy(&tz->trips.active[i].devices, &devices,
|
memcpy(&tz->trips.active[i].devices, &devices,
|
||||||
sizeof(struct acpi_handle_list));
|
sizeof(struct acpi_handle_list));
|
||||||
ACPI_THERMAL_TRIPS_EXCEPTION(flag, tz, "device");
|
ACPI_THERMAL_TRIPS_EXCEPTION(flag, tz, "device");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -464,9 +462,9 @@ static int acpi_thermal_trips_update(struct acpi_thermal *tz, int flag)
|
|||||||
if (flag & ACPI_TRIPS_DEVICES) {
|
if (flag & ACPI_TRIPS_DEVICES) {
|
||||||
memset(&devices, 0, sizeof(devices));
|
memset(&devices, 0, sizeof(devices));
|
||||||
status = acpi_evaluate_reference(tz->device->handle, "_TZD",
|
status = acpi_evaluate_reference(tz->device->handle, "_TZD",
|
||||||
NULL, &devices);
|
NULL, &devices);
|
||||||
if (ACPI_SUCCESS(status)
|
if (ACPI_SUCCESS(status) &&
|
||||||
&& memcmp(&tz->devices, &devices, sizeof(devices))) {
|
memcmp(&tz->devices, &devices, sizeof(devices))) {
|
||||||
tz->devices = devices;
|
tz->devices = devices;
|
||||||
ACPI_THERMAL_TRIPS_EXCEPTION(flag, tz, "device");
|
ACPI_THERMAL_TRIPS_EXCEPTION(flag, tz, "device");
|
||||||
}
|
}
|
||||||
@ -548,8 +546,7 @@ static int thermal_get_trip_type(struct thermal_zone_device *thermal,
|
|||||||
trip--;
|
trip--;
|
||||||
}
|
}
|
||||||
|
|
||||||
for (i = 0; i < ACPI_THERMAL_MAX_ACTIVE &&
|
for (i = 0; i < ACPI_THERMAL_MAX_ACTIVE && tz->trips.active[i].flags.valid; i++) {
|
||||||
tz->trips.active[i].flags.valid; i++) {
|
|
||||||
if (!trip) {
|
if (!trip) {
|
||||||
*type = THERMAL_TRIP_ACTIVE;
|
*type = THERMAL_TRIP_ACTIVE;
|
||||||
return 0;
|
return 0;
|
||||||
@ -572,8 +569,8 @@ static int thermal_get_trip_temp(struct thermal_zone_device *thermal,
|
|||||||
if (tz->trips.critical.flags.valid) {
|
if (tz->trips.critical.flags.valid) {
|
||||||
if (!trip) {
|
if (!trip) {
|
||||||
*temp = deci_kelvin_to_millicelsius_with_offset(
|
*temp = deci_kelvin_to_millicelsius_with_offset(
|
||||||
tz->trips.critical.temperature,
|
tz->trips.critical.temperature,
|
||||||
tz->kelvin_offset);
|
tz->kelvin_offset);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
trip--;
|
trip--;
|
||||||
@ -582,8 +579,8 @@ static int thermal_get_trip_temp(struct thermal_zone_device *thermal,
|
|||||||
if (tz->trips.hot.flags.valid) {
|
if (tz->trips.hot.flags.valid) {
|
||||||
if (!trip) {
|
if (!trip) {
|
||||||
*temp = deci_kelvin_to_millicelsius_with_offset(
|
*temp = deci_kelvin_to_millicelsius_with_offset(
|
||||||
tz->trips.hot.temperature,
|
tz->trips.hot.temperature,
|
||||||
tz->kelvin_offset);
|
tz->kelvin_offset);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
trip--;
|
trip--;
|
||||||
@ -592,8 +589,8 @@ static int thermal_get_trip_temp(struct thermal_zone_device *thermal,
|
|||||||
if (tz->trips.passive.flags.valid) {
|
if (tz->trips.passive.flags.valid) {
|
||||||
if (!trip) {
|
if (!trip) {
|
||||||
*temp = deci_kelvin_to_millicelsius_with_offset(
|
*temp = deci_kelvin_to_millicelsius_with_offset(
|
||||||
tz->trips.passive.temperature,
|
tz->trips.passive.temperature,
|
||||||
tz->kelvin_offset);
|
tz->kelvin_offset);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
trip--;
|
trip--;
|
||||||
@ -603,8 +600,8 @@ static int thermal_get_trip_temp(struct thermal_zone_device *thermal,
|
|||||||
tz->trips.active[i].flags.valid; i++) {
|
tz->trips.active[i].flags.valid; i++) {
|
||||||
if (!trip) {
|
if (!trip) {
|
||||||
*temp = deci_kelvin_to_millicelsius_with_offset(
|
*temp = deci_kelvin_to_millicelsius_with_offset(
|
||||||
tz->trips.active[i].temperature,
|
tz->trips.active[i].temperature,
|
||||||
tz->kelvin_offset);
|
tz->kelvin_offset);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
trip--;
|
trip--;
|
||||||
@ -620,15 +617,15 @@ static int thermal_get_crit_temp(struct thermal_zone_device *thermal,
|
|||||||
|
|
||||||
if (tz->trips.critical.flags.valid) {
|
if (tz->trips.critical.flags.valid) {
|
||||||
*temperature = deci_kelvin_to_millicelsius_with_offset(
|
*temperature = deci_kelvin_to_millicelsius_with_offset(
|
||||||
tz->trips.critical.temperature,
|
tz->trips.critical.temperature,
|
||||||
tz->kelvin_offset);
|
tz->kelvin_offset);
|
||||||
return 0;
|
return 0;
|
||||||
} else
|
} else
|
||||||
return -EINVAL;
|
return -EINVAL;
|
||||||
}
|
}
|
||||||
|
|
||||||
static int thermal_get_trend(struct thermal_zone_device *thermal,
|
static int thermal_get_trend(struct thermal_zone_device *thermal,
|
||||||
int trip, enum thermal_trend *trend)
|
int trip, enum thermal_trend *trend)
|
||||||
{
|
{
|
||||||
struct acpi_thermal *tz = thermal->devdata;
|
struct acpi_thermal *tz = thermal->devdata;
|
||||||
enum thermal_trip_type type;
|
enum thermal_trip_type type;
|
||||||
@ -657,9 +654,8 @@ static int thermal_get_trend(struct thermal_zone_device *thermal,
|
|||||||
* tz->temperature has already been updated by generic thermal layer,
|
* tz->temperature has already been updated by generic thermal layer,
|
||||||
* before this callback being invoked
|
* before this callback being invoked
|
||||||
*/
|
*/
|
||||||
i = (tz->trips.passive.tc1 * (tz->temperature - tz->last_temperature))
|
i = (tz->trips.passive.tc1 * (tz->temperature - tz->last_temperature)) +
|
||||||
+ (tz->trips.passive.tc2
|
(tz->trips.passive.tc2 * (tz->temperature - tz->trips.passive.temperature));
|
||||||
* (tz->temperature - tz->trips.passive.temperature));
|
|
||||||
|
|
||||||
if (i > 0)
|
if (i > 0)
|
||||||
*trend = THERMAL_TREND_RAISING;
|
*trend = THERMAL_TREND_RAISING;
|
||||||
@ -667,6 +663,7 @@ static int thermal_get_trend(struct thermal_zone_device *thermal,
|
|||||||
*trend = THERMAL_TREND_DROPPING;
|
*trend = THERMAL_TREND_DROPPING;
|
||||||
else
|
else
|
||||||
*trend = THERMAL_TREND_STABLE;
|
*trend = THERMAL_TREND_STABLE;
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -691,8 +688,8 @@ static void acpi_thermal_zone_device_critical(struct thermal_zone_device *therma
|
|||||||
}
|
}
|
||||||
|
|
||||||
static int acpi_thermal_cooling_device_cb(struct thermal_zone_device *thermal,
|
static int acpi_thermal_cooling_device_cb(struct thermal_zone_device *thermal,
|
||||||
struct thermal_cooling_device *cdev,
|
struct thermal_cooling_device *cdev,
|
||||||
bool bind)
|
bool bind)
|
||||||
{
|
{
|
||||||
struct acpi_device *device = cdev->devdata;
|
struct acpi_device *device = cdev->devdata;
|
||||||
struct acpi_thermal *tz = thermal->devdata;
|
struct acpi_thermal *tz = thermal->devdata;
|
||||||
@ -711,22 +708,23 @@ static int acpi_thermal_cooling_device_cb(struct thermal_zone_device *thermal,
|
|||||||
|
|
||||||
if (tz->trips.passive.flags.valid) {
|
if (tz->trips.passive.flags.valid) {
|
||||||
trip++;
|
trip++;
|
||||||
for (i = 0; i < tz->trips.passive.devices.count;
|
for (i = 0; i < tz->trips.passive.devices.count; i++) {
|
||||||
i++) {
|
|
||||||
handle = tz->trips.passive.devices.handles[i];
|
handle = tz->trips.passive.devices.handles[i];
|
||||||
dev = acpi_fetch_acpi_dev(handle);
|
dev = acpi_fetch_acpi_dev(handle);
|
||||||
if (dev != device)
|
if (dev != device)
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
if (bind)
|
if (bind)
|
||||||
result =
|
result = thermal_zone_bind_cooling_device(
|
||||||
thermal_zone_bind_cooling_device
|
thermal, trip, cdev,
|
||||||
(thermal, trip, cdev,
|
THERMAL_NO_LIMIT,
|
||||||
THERMAL_NO_LIMIT, THERMAL_NO_LIMIT,
|
THERMAL_NO_LIMIT,
|
||||||
THERMAL_WEIGHT_DEFAULT);
|
THERMAL_WEIGHT_DEFAULT);
|
||||||
else
|
else
|
||||||
result =
|
result =
|
||||||
thermal_zone_unbind_cooling_device
|
thermal_zone_unbind_cooling_device(
|
||||||
(thermal, trip, cdev);
|
thermal, trip, cdev);
|
||||||
|
|
||||||
if (result)
|
if (result)
|
||||||
goto failed;
|
goto failed;
|
||||||
}
|
}
|
||||||
@ -735,22 +733,24 @@ static int acpi_thermal_cooling_device_cb(struct thermal_zone_device *thermal,
|
|||||||
for (i = 0; i < ACPI_THERMAL_MAX_ACTIVE; i++) {
|
for (i = 0; i < ACPI_THERMAL_MAX_ACTIVE; i++) {
|
||||||
if (!tz->trips.active[i].flags.valid)
|
if (!tz->trips.active[i].flags.valid)
|
||||||
break;
|
break;
|
||||||
|
|
||||||
trip++;
|
trip++;
|
||||||
for (j = 0;
|
for (j = 0; j < tz->trips.active[i].devices.count; j++) {
|
||||||
j < tz->trips.active[i].devices.count;
|
|
||||||
j++) {
|
|
||||||
handle = tz->trips.active[i].devices.handles[j];
|
handle = tz->trips.active[i].devices.handles[j];
|
||||||
dev = acpi_fetch_acpi_dev(handle);
|
dev = acpi_fetch_acpi_dev(handle);
|
||||||
if (dev != device)
|
if (dev != device)
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
if (bind)
|
if (bind)
|
||||||
result = thermal_zone_bind_cooling_device
|
result = thermal_zone_bind_cooling_device(
|
||||||
(thermal, trip, cdev,
|
thermal, trip, cdev,
|
||||||
THERMAL_NO_LIMIT, THERMAL_NO_LIMIT,
|
THERMAL_NO_LIMIT,
|
||||||
THERMAL_WEIGHT_DEFAULT);
|
THERMAL_NO_LIMIT,
|
||||||
|
THERMAL_WEIGHT_DEFAULT);
|
||||||
else
|
else
|
||||||
result = thermal_zone_unbind_cooling_device
|
result = thermal_zone_unbind_cooling_device(
|
||||||
(thermal, trip, cdev);
|
thermal, trip, cdev);
|
||||||
|
|
||||||
if (result)
|
if (result)
|
||||||
goto failed;
|
goto failed;
|
||||||
}
|
}
|
||||||
@ -762,14 +762,14 @@ failed:
|
|||||||
|
|
||||||
static int
|
static int
|
||||||
acpi_thermal_bind_cooling_device(struct thermal_zone_device *thermal,
|
acpi_thermal_bind_cooling_device(struct thermal_zone_device *thermal,
|
||||||
struct thermal_cooling_device *cdev)
|
struct thermal_cooling_device *cdev)
|
||||||
{
|
{
|
||||||
return acpi_thermal_cooling_device_cb(thermal, cdev, true);
|
return acpi_thermal_cooling_device_cb(thermal, cdev, true);
|
||||||
}
|
}
|
||||||
|
|
||||||
static int
|
static int
|
||||||
acpi_thermal_unbind_cooling_device(struct thermal_zone_device *thermal,
|
acpi_thermal_unbind_cooling_device(struct thermal_zone_device *thermal,
|
||||||
struct thermal_cooling_device *cdev)
|
struct thermal_cooling_device *cdev)
|
||||||
{
|
{
|
||||||
return acpi_thermal_cooling_device_cb(thermal, cdev, false);
|
return acpi_thermal_cooling_device_cb(thermal, cdev, false);
|
||||||
}
|
}
|
||||||
@ -802,20 +802,20 @@ static int acpi_thermal_register_thermal_zone(struct acpi_thermal *tz)
|
|||||||
if (tz->trips.passive.flags.valid)
|
if (tz->trips.passive.flags.valid)
|
||||||
trips++;
|
trips++;
|
||||||
|
|
||||||
for (i = 0; i < ACPI_THERMAL_MAX_ACTIVE &&
|
for (i = 0; i < ACPI_THERMAL_MAX_ACTIVE && tz->trips.active[i].flags.valid;
|
||||||
tz->trips.active[i].flags.valid; i++, trips++);
|
i++, trips++);
|
||||||
|
|
||||||
if (tz->trips.passive.flags.valid)
|
if (tz->trips.passive.flags.valid)
|
||||||
tz->thermal_zone =
|
tz->thermal_zone = thermal_zone_device_register("acpitz", trips, 0, tz,
|
||||||
thermal_zone_device_register("acpitz", trips, 0, tz,
|
&acpi_thermal_zone_ops, NULL,
|
||||||
&acpi_thermal_zone_ops, NULL,
|
tz->trips.passive.tsp * 100,
|
||||||
tz->trips.passive.tsp*100,
|
tz->polling_frequency * 100);
|
||||||
tz->polling_frequency*100);
|
|
||||||
else
|
else
|
||||||
tz->thermal_zone =
|
tz->thermal_zone =
|
||||||
thermal_zone_device_register("acpitz", trips, 0, tz,
|
thermal_zone_device_register("acpitz", trips, 0, tz,
|
||||||
&acpi_thermal_zone_ops, NULL,
|
&acpi_thermal_zone_ops, NULL,
|
||||||
0, tz->polling_frequency*100);
|
0, tz->polling_frequency * 100);
|
||||||
|
|
||||||
if (IS_ERR(tz->thermal_zone))
|
if (IS_ERR(tz->thermal_zone))
|
||||||
return -ENODEV;
|
return -ENODEV;
|
||||||
|
|
||||||
@ -881,7 +881,6 @@ static void acpi_thermal_notify(struct acpi_device *device, u32 event)
|
|||||||
{
|
{
|
||||||
struct acpi_thermal *tz = acpi_driver_data(device);
|
struct acpi_thermal *tz = acpi_driver_data(device);
|
||||||
|
|
||||||
|
|
||||||
if (!tz)
|
if (!tz)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
@ -893,13 +892,13 @@ static void acpi_thermal_notify(struct acpi_device *device, u32 event)
|
|||||||
acpi_thermal_trips_update(tz, ACPI_TRIPS_REFRESH_THRESHOLDS);
|
acpi_thermal_trips_update(tz, ACPI_TRIPS_REFRESH_THRESHOLDS);
|
||||||
acpi_queue_thermal_check(tz);
|
acpi_queue_thermal_check(tz);
|
||||||
acpi_bus_generate_netlink_event(device->pnp.device_class,
|
acpi_bus_generate_netlink_event(device->pnp.device_class,
|
||||||
dev_name(&device->dev), event, 0);
|
dev_name(&device->dev), event, 0);
|
||||||
break;
|
break;
|
||||||
case ACPI_THERMAL_NOTIFY_DEVICES:
|
case ACPI_THERMAL_NOTIFY_DEVICES:
|
||||||
acpi_thermal_trips_update(tz, ACPI_TRIPS_REFRESH_DEVICES);
|
acpi_thermal_trips_update(tz, ACPI_TRIPS_REFRESH_DEVICES);
|
||||||
acpi_queue_thermal_check(tz);
|
acpi_queue_thermal_check(tz);
|
||||||
acpi_bus_generate_netlink_event(device->pnp.device_class,
|
acpi_bus_generate_netlink_event(device->pnp.device_class,
|
||||||
dev_name(&device->dev), event, 0);
|
dev_name(&device->dev), event, 0);
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
acpi_handle_debug(device->handle, "Unsupported event [0x%x]\n",
|
acpi_handle_debug(device->handle, "Unsupported event [0x%x]\n",
|
||||||
@ -944,7 +943,6 @@ static int acpi_thermal_get_info(struct acpi_thermal *tz)
|
|||||||
{
|
{
|
||||||
int result = 0;
|
int result = 0;
|
||||||
|
|
||||||
|
|
||||||
if (!tz)
|
if (!tz)
|
||||||
return -EINVAL;
|
return -EINVAL;
|
||||||
|
|
||||||
@ -1023,7 +1021,6 @@ static int acpi_thermal_add(struct acpi_device *device)
|
|||||||
int result = 0;
|
int result = 0;
|
||||||
struct acpi_thermal *tz = NULL;
|
struct acpi_thermal *tz = NULL;
|
||||||
|
|
||||||
|
|
||||||
if (!device)
|
if (!device)
|
||||||
return -EINVAL;
|
return -EINVAL;
|
||||||
|
|
||||||
@ -1099,6 +1096,7 @@ static int acpi_thermal_resume(struct device *dev)
|
|||||||
for (i = 0; i < ACPI_THERMAL_MAX_ACTIVE; i++) {
|
for (i = 0; i < ACPI_THERMAL_MAX_ACTIVE; i++) {
|
||||||
if (!tz->trips.active[i].flags.valid)
|
if (!tz->trips.active[i].flags.valid)
|
||||||
break;
|
break;
|
||||||
|
|
||||||
tz->trips.active[i].flags.enabled = 1;
|
tz->trips.active[i].flags.enabled = 1;
|
||||||
for (j = 0; j < tz->trips.active[i].devices.count; j++) {
|
for (j = 0; j < tz->trips.active[i].devices.count; j++) {
|
||||||
result = acpi_bus_update_power(
|
result = acpi_bus_update_power(
|
||||||
@ -1119,7 +1117,6 @@ static int acpi_thermal_resume(struct device *dev)
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
static int thermal_act(const struct dmi_system_id *d) {
|
static int thermal_act(const struct dmi_system_id *d) {
|
||||||
|
|
||||||
if (act == 0) {
|
if (act == 0) {
|
||||||
pr_notice("%s detected: disabling all active thermal trip points\n",
|
pr_notice("%s detected: disabling all active thermal trip points\n",
|
||||||
d->ident);
|
d->ident);
|
||||||
@ -1128,14 +1125,12 @@ static int thermal_act(const struct dmi_system_id *d) {
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
static int thermal_nocrt(const struct dmi_system_id *d) {
|
static int thermal_nocrt(const struct dmi_system_id *d) {
|
||||||
|
|
||||||
pr_notice("%s detected: disabling all critical thermal trip point actions.\n",
|
pr_notice("%s detected: disabling all critical thermal trip point actions.\n",
|
||||||
d->ident);
|
d->ident);
|
||||||
nocrt = 1;
|
nocrt = 1;
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
static int thermal_tzp(const struct dmi_system_id *d) {
|
static int thermal_tzp(const struct dmi_system_id *d) {
|
||||||
|
|
||||||
if (tzp == 0) {
|
if (tzp == 0) {
|
||||||
pr_notice("%s detected: enabling thermal zone polling\n",
|
pr_notice("%s detected: enabling thermal zone polling\n",
|
||||||
d->ident);
|
d->ident);
|
||||||
@ -1144,7 +1139,6 @@ static int thermal_tzp(const struct dmi_system_id *d) {
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
static int thermal_psv(const struct dmi_system_id *d) {
|
static int thermal_psv(const struct dmi_system_id *d) {
|
||||||
|
|
||||||
if (psv == 0) {
|
if (psv == 0) {
|
||||||
pr_notice("%s detected: disabling all passive thermal trip points\n",
|
pr_notice("%s detected: disabling all passive thermal trip points\n",
|
||||||
d->ident);
|
d->ident);
|
||||||
|
Loading…
Reference in New Issue
Block a user