aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/acpi/thermal.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/acpi/thermal.c')
-rw-r--r--drivers/acpi/thermal.c58
1 files changed, 19 insertions, 39 deletions
diff --git a/drivers/acpi/thermal.c b/drivers/acpi/thermal.c
index e7fe3a14fdaf..44fffe16767e 100644
--- a/drivers/acpi/thermal.c
+++ b/drivers/acpi/thermal.c
@@ -325,7 +325,7 @@ static int acpi_thermal_get_trip_points(struct acpi_thermal *tz)
325 &tz->trips.critical.temperature); 325 &tz->trips.critical.temperature);
326 if (ACPI_FAILURE(status)) { 326 if (ACPI_FAILURE(status)) {
327 tz->trips.critical.flags.valid = 0; 327 tz->trips.critical.flags.valid = 0;
328 ACPI_DEBUG_PRINT((ACPI_DB_ERROR, "No critical threshold\n")); 328 ACPI_EXCEPTION((AE_INFO, status, "No critical threshold"));
329 return_VALUE(-ENODEV); 329 return_VALUE(-ENODEV);
330 } else { 330 } else {
331 tz->trips.critical.flags.valid = 1; 331 tz->trips.critical.flags.valid = 1;
@@ -384,8 +384,7 @@ static int acpi_thermal_get_trip_points(struct acpi_thermal *tz)
384 tz->trips.passive.flags.valid = 0; 384 tz->trips.passive.flags.valid = 0;
385 385
386 if (!tz->trips.passive.flags.valid) 386 if (!tz->trips.passive.flags.valid)
387 ACPI_DEBUG_PRINT((ACPI_DB_WARN, 387 ACPI_WARNING((AE_INFO, "Invalid passive threshold"));
388 "Invalid passive threshold\n"));
389 else 388 else
390 ACPI_DEBUG_PRINT((ACPI_DB_INFO, 389 ACPI_DEBUG_PRINT((ACPI_DB_INFO,
391 "Found passive threshold [%lu]\n", 390 "Found passive threshold [%lu]\n",
@@ -414,9 +413,8 @@ static int acpi_thermal_get_trip_points(struct acpi_thermal *tz)
414 "Found active threshold [%d]:[%lu]\n", 413 "Found active threshold [%d]:[%lu]\n",
415 i, tz->trips.active[i].temperature)); 414 i, tz->trips.active[i].temperature));
416 } else 415 } else
417 ACPI_DEBUG_PRINT((ACPI_DB_ERROR, 416 ACPI_EXCEPTION((AE_INFO, status,
418 "Invalid active threshold [%d]\n", 417 "Invalid active threshold [%d]", i));
419 i));
420 } 418 }
421 419
422 return_VALUE(0); 420 return_VALUE(0);
@@ -471,7 +469,7 @@ static int acpi_thermal_critical(struct acpi_thermal *tz)
471 return_VALUE(-EINVAL); 469 return_VALUE(-EINVAL);
472 470
473 if (tz->temperature >= tz->trips.critical.temperature) { 471 if (tz->temperature >= tz->trips.critical.temperature) {
474 ACPI_DEBUG_PRINT((ACPI_DB_WARN, "Critical trip point\n")); 472 ACPI_WARNING((AE_INFO, "Critical trip point"));
475 tz->trips.critical.flags.enabled = 1; 473 tz->trips.critical.flags.enabled = 1;
476 } else if (tz->trips.critical.flags.enabled) 474 } else if (tz->trips.critical.flags.enabled)
477 tz->trips.critical.flags.enabled = 0; 475 tz->trips.critical.flags.enabled = 0;
@@ -502,7 +500,7 @@ static int acpi_thermal_hot(struct acpi_thermal *tz)
502 return_VALUE(-EINVAL); 500 return_VALUE(-EINVAL);
503 501
504 if (tz->temperature >= tz->trips.hot.temperature) { 502 if (tz->temperature >= tz->trips.hot.temperature) {
505 ACPI_DEBUG_PRINT((ACPI_DB_WARN, "Hot trip point\n")); 503 ACPI_WARNING((AE_INFO, "Hot trip point"));
506 tz->trips.hot.flags.enabled = 1; 504 tz->trips.hot.flags.enabled = 1;
507 } else if (tz->trips.hot.flags.enabled) 505 } else if (tz->trips.hot.flags.enabled)
508 tz->trips.hot.flags.enabled = 0; 506 tz->trips.hot.flags.enabled = 0;
@@ -642,10 +640,10 @@ static void acpi_thermal_active(struct acpi_thermal *tz)
642 handles[j], 640 handles[j],
643 ACPI_STATE_D0); 641 ACPI_STATE_D0);
644 if (result) { 642 if (result) {
645 ACPI_DEBUG_PRINT((ACPI_DB_WARN, 643 ACPI_WARNING((AE_INFO,
646 "Unable to turn cooling device [%p] 'on'\n", 644 "Unable to turn cooling device [%p] 'on'",
647 active->devices. 645 active->devices.
648 handles[j])); 646 handles[j]));
649 continue; 647 continue;
650 } 648 }
651 active->flags.enabled = 1; 649 active->flags.enabled = 1;
@@ -667,9 +665,9 @@ static void acpi_thermal_active(struct acpi_thermal *tz)
667 result = acpi_bus_set_power(active->devices.handles[j], 665 result = acpi_bus_set_power(active->devices.handles[j],
668 ACPI_STATE_D3); 666 ACPI_STATE_D3);
669 if (result) { 667 if (result) {
670 ACPI_DEBUG_PRINT((ACPI_DB_WARN, 668 ACPI_WARNING((AE_INFO,
671 "Unable to turn cooling device [%p] 'off'\n", 669 "Unable to turn cooling device [%p] 'off'",
672 active->devices.handles[j])); 670 active->devices.handles[j]));
673 continue; 671 continue;
674 } 672 }
675 active->flags.enabled = 0; 673 active->flags.enabled = 0;
@@ -700,7 +698,7 @@ static void acpi_thermal_check(void *data)
700 ACPI_FUNCTION_TRACE("acpi_thermal_check"); 698 ACPI_FUNCTION_TRACE("acpi_thermal_check");
701 699
702 if (!tz) { 700 if (!tz) {
703 ACPI_DEBUG_PRINT((ACPI_DB_ERROR, "Invalid (NULL) context.\n")); 701 ACPI_ERROR((AE_INFO, "Invalid (NULL) context"));
704 return_VOID; 702 return_VOID;
705 } 703 }
706 704
@@ -949,13 +947,11 @@ acpi_thermal_write_trip_points(struct file *file,
949 } 947 }
950 948
951 if (!tz || (count > ACPI_THERMAL_MAX_LIMIT_STR_LEN - 1)) { 949 if (!tz || (count > ACPI_THERMAL_MAX_LIMIT_STR_LEN - 1)) {
952 ACPI_DEBUG_PRINT((ACPI_DB_ERROR, "Invalid argument\n"));
953 count = -EINVAL; 950 count = -EINVAL;
954 goto end; 951 goto end;
955 } 952 }
956 953
957 if (copy_from_user(limit_string, buffer, count)) { 954 if (copy_from_user(limit_string, buffer, count)) {
958 ACPI_DEBUG_PRINT((ACPI_DB_ERROR, "Invalid data\n"));
959 count = -EFAULT; 955 count = -EFAULT;
960 goto end; 956 goto end;
961 } 957 }
@@ -968,7 +964,6 @@ acpi_thermal_write_trip_points(struct file *file,
968 &active[5], &active[6], &active[7], &active[8], 964 &active[5], &active[6], &active[7], &active[8],
969 &active[9]); 965 &active[9]);
970 if (!(num >= 5 && num < (ACPI_THERMAL_MAX_ACTIVE + 3))) { 966 if (!(num >= 5 && num < (ACPI_THERMAL_MAX_ACTIVE + 3))) {
971 ACPI_DEBUG_PRINT((ACPI_DB_ERROR, "Invalid data format\n"));
972 count = -EINVAL; 967 count = -EINVAL;
973 goto end; 968 goto end;
974 } 969 }
@@ -1128,9 +1123,7 @@ static int acpi_thermal_add_fs(struct acpi_device *device)
1128 entry = create_proc_entry(ACPI_THERMAL_FILE_STATE, 1123 entry = create_proc_entry(ACPI_THERMAL_FILE_STATE,
1129 S_IRUGO, acpi_device_dir(device)); 1124 S_IRUGO, acpi_device_dir(device));
1130 if (!entry) 1125 if (!entry)
1131 ACPI_DEBUG_PRINT((ACPI_DB_ERROR, 1126 return_VALUE(-ENODEV);
1132 "Unable to create '%s' fs entry\n",
1133 ACPI_THERMAL_FILE_STATE));
1134 else { 1127 else {
1135 entry->proc_fops = &acpi_thermal_state_fops; 1128 entry->proc_fops = &acpi_thermal_state_fops;
1136 entry->data = acpi_driver_data(device); 1129 entry->data = acpi_driver_data(device);
@@ -1141,9 +1134,7 @@ static int acpi_thermal_add_fs(struct acpi_device *device)
1141 entry = create_proc_entry(ACPI_THERMAL_FILE_TEMPERATURE, 1134 entry = create_proc_entry(ACPI_THERMAL_FILE_TEMPERATURE,
1142 S_IRUGO, acpi_device_dir(device)); 1135 S_IRUGO, acpi_device_dir(device));
1143 if (!entry) 1136 if (!entry)
1144 ACPI_DEBUG_PRINT((ACPI_DB_ERROR, 1137 return_VALUE(-ENODEV);
1145 "Unable to create '%s' fs entry\n",
1146 ACPI_THERMAL_FILE_TEMPERATURE));
1147 else { 1138 else {
1148 entry->proc_fops = &acpi_thermal_temp_fops; 1139 entry->proc_fops = &acpi_thermal_temp_fops;
1149 entry->data = acpi_driver_data(device); 1140 entry->data = acpi_driver_data(device);
@@ -1155,9 +1146,7 @@ static int acpi_thermal_add_fs(struct acpi_device *device)
1155 S_IFREG | S_IRUGO | S_IWUSR, 1146 S_IFREG | S_IRUGO | S_IWUSR,
1156 acpi_device_dir(device)); 1147 acpi_device_dir(device));
1157 if (!entry) 1148 if (!entry)
1158 ACPI_DEBUG_PRINT((ACPI_DB_ERROR, 1149 return_VALUE(-ENODEV);
1159 "Unable to create '%s' fs entry\n",
1160 ACPI_THERMAL_FILE_TRIP_POINTS));
1161 else { 1150 else {
1162 entry->proc_fops = &acpi_thermal_trip_fops; 1151 entry->proc_fops = &acpi_thermal_trip_fops;
1163 entry->data = acpi_driver_data(device); 1152 entry->data = acpi_driver_data(device);
@@ -1169,9 +1158,7 @@ static int acpi_thermal_add_fs(struct acpi_device *device)
1169 S_IFREG | S_IRUGO | S_IWUSR, 1158 S_IFREG | S_IRUGO | S_IWUSR,
1170 acpi_device_dir(device)); 1159 acpi_device_dir(device));
1171 if (!entry) 1160 if (!entry)
1172 ACPI_DEBUG_PRINT((ACPI_DB_ERROR, 1161 return_VALUE(-ENODEV);
1173 "Unable to create '%s' fs entry\n",
1174 ACPI_THERMAL_FILE_COOLING_MODE));
1175 else { 1162 else {
1176 entry->proc_fops = &acpi_thermal_cooling_fops; 1163 entry->proc_fops = &acpi_thermal_cooling_fops;
1177 entry->data = acpi_driver_data(device); 1164 entry->data = acpi_driver_data(device);
@@ -1183,9 +1170,7 @@ static int acpi_thermal_add_fs(struct acpi_device *device)
1183 S_IFREG | S_IRUGO | S_IWUSR, 1170 S_IFREG | S_IRUGO | S_IWUSR,
1184 acpi_device_dir(device)); 1171 acpi_device_dir(device));
1185 if (!entry) 1172 if (!entry)
1186 ACPI_DEBUG_PRINT((ACPI_DB_ERROR, 1173 return_VALUE(-ENODEV);
1187 "Unable to create '%s' fs entry\n",
1188 ACPI_THERMAL_FILE_POLLING_FREQ));
1189 else { 1174 else {
1190 entry->proc_fops = &acpi_thermal_polling_fops; 1175 entry->proc_fops = &acpi_thermal_polling_fops;
1191 entry->data = acpi_driver_data(device); 1176 entry->data = acpi_driver_data(device);
@@ -1355,8 +1340,6 @@ static int acpi_thermal_add(struct acpi_device *device)
1355 ACPI_DEVICE_NOTIFY, 1340 ACPI_DEVICE_NOTIFY,
1356 acpi_thermal_notify, tz); 1341 acpi_thermal_notify, tz);
1357 if (ACPI_FAILURE(status)) { 1342 if (ACPI_FAILURE(status)) {
1358 ACPI_DEBUG_PRINT((ACPI_DB_ERROR,
1359 "Error installing notify handler\n"));
1360 result = -ENODEV; 1343 result = -ENODEV;
1361 goto end; 1344 goto end;
1362 } 1345 }
@@ -1398,9 +1381,6 @@ static int acpi_thermal_remove(struct acpi_device *device, int type)
1398 status = acpi_remove_notify_handler(tz->handle, 1381 status = acpi_remove_notify_handler(tz->handle,
1399 ACPI_DEVICE_NOTIFY, 1382 ACPI_DEVICE_NOTIFY,
1400 acpi_thermal_notify); 1383 acpi_thermal_notify);
1401 if (ACPI_FAILURE(status))
1402 ACPI_DEBUG_PRINT((ACPI_DB_ERROR,
1403 "Error removing notify handler\n"));
1404 1384
1405 /* Terminate policy */ 1385 /* Terminate policy */
1406 if (tz->trips.passive.flags.valid && tz->trips.passive.flags.enabled) { 1386 if (tz->trips.passive.flags.valid && tz->trips.passive.flags.enabled) {