Merge branch 'pm-cpuidle'
[firefly-linux-kernel-4.4.55.git] / drivers / acpi / thermal.c
index ccf9527d7ed3011c25204c13b699ba2bfca221c7..6a0329340b42ad188add760db66ebcc17ba9ab22 100644 (file)
@@ -233,26 +233,16 @@ static int acpi_thermal_get_polling_frequency(struct acpi_thermal *tz)
 
 static int acpi_thermal_set_cooling_mode(struct acpi_thermal *tz, int mode)
 {
-       acpi_status status = AE_OK;
-       union acpi_object arg0 = { ACPI_TYPE_INTEGER };
-       struct acpi_object_list arg_list = { 1, &arg0 };
-       acpi_handle handle = NULL;
-
-
        if (!tz)
                return -EINVAL;
 
-       status = acpi_get_handle(tz->device->handle, "_SCP", &handle);
-       if (ACPI_FAILURE(status)) {
+       if (!acpi_has_method(tz->device->handle, "_SCP")) {
                ACPI_DEBUG_PRINT((ACPI_DB_INFO, "_SCP not present\n"));
                return -ENODEV;
-       }
-
-       arg0.integer.value = mode;
-
-       status = acpi_evaluate_object(handle, NULL, &arg_list, NULL);
-       if (ACPI_FAILURE(status))
+       } else if (ACPI_FAILURE(acpi_execute_simple_method(tz->device->handle,
+                                                          "_SCP", mode))) {
                return -ENODEV;
+       }
 
        return 0;
 }
@@ -485,14 +475,14 @@ static int acpi_thermal_trips_update(struct acpi_thermal *tz, int flag)
                        break;
        }
 
-       if (flag & ACPI_TRIPS_DEVICES) {
-               memset(&devices, 0, sizeof(struct acpi_handle_list));
+       if ((flag & ACPI_TRIPS_DEVICES)
+           && acpi_has_method(tz->device->handle, "_TZD")) {
+               memset(&devices, 0, sizeof(devices));
                status = acpi_evaluate_reference(tz->device->handle, "_TZD",
                                                NULL, &devices);
-               if (memcmp(&tz->devices, &devices,
-                               sizeof(struct acpi_handle_list))) {
-                       memcpy(&tz->devices, &devices,
-                               sizeof(struct acpi_handle_list));
+               if (ACPI_SUCCESS(status)
+                   && memcmp(&tz->devices, &devices, sizeof(devices))) {
+                       tz->devices = devices;
                        ACPI_THERMAL_TRIPS_EXCEPTION(flag, "device");
                }
        }