Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit a527f2d7 authored by Carlos Corbacho's avatar Carlos Corbacho Committed by Len Brown
Browse files

ACPI: WMI: Clean up handling of spec violating data blocks



Acer violate the ACPI-WMI spec by declaring some of their data blocks as
expensive, but with no corresponding WCxx method. There is already some
workaround code in to handle the initial WCxx call (we just ignore a
failure here); but we need to properly check if the second, "clean up",
WCxx call is actually needed or not, rather than fail simply because it
isn't there.

Signed-off-by: default avatarCarlos Corbacho <carlos@strangeworlds.co.uk>
Signed-off-by: default avatarLen Brown <len.brown@intel.com>
parent 9b963c40
Loading
Loading
Loading
Loading
+6 −4
Original line number Original line Diff line number Diff line
@@ -293,7 +293,7 @@ struct acpi_buffer *out)
{
{
	struct guid_block *block = NULL;
	struct guid_block *block = NULL;
	struct wmi_block *wblock = NULL;
	struct wmi_block *wblock = NULL;
	acpi_handle handle;
	acpi_handle handle, wc_handle;
	acpi_status status, wc_status = AE_ERROR;
	acpi_status status, wc_status = AE_ERROR;
	struct acpi_object_list input, wc_input;
	struct acpi_object_list input, wc_input;
	union acpi_object wc_params[1], wq_params[1];
	union acpi_object wc_params[1], wq_params[1];
@@ -338,6 +338,8 @@ struct acpi_buffer *out)
		 * expensive, but have no corresponding WCxx method. So we
		 * expensive, but have no corresponding WCxx method. So we
		 * should not fail if this happens.
		 * should not fail if this happens.
		 */
		 */
		wc_status = acpi_get_handle(handle, wc_method, &wc_handle);
		if (ACPI_SUCCESS(wc_status))
			wc_status = acpi_evaluate_object(handle, wc_method,
			wc_status = acpi_evaluate_object(handle, wc_method,
				&wc_input, NULL);
				&wc_input, NULL);
	}
	}
@@ -351,7 +353,7 @@ struct acpi_buffer *out)
	 * If ACPI_WMI_EXPENSIVE, call the relevant WCxx method, even if
	 * If ACPI_WMI_EXPENSIVE, call the relevant WCxx method, even if
	 * the WQxx method failed - we should disable collection anyway.
	 * the WQxx method failed - we should disable collection anyway.
	 */
	 */
	if ((block->flags & ACPI_WMI_EXPENSIVE) && wc_status) {
	if ((block->flags & ACPI_WMI_EXPENSIVE) && ACPI_SUCCESS(wc_status)) {
		wc_params[0].integer.value = 0;
		wc_params[0].integer.value = 0;
		status = acpi_evaluate_object(handle,
		status = acpi_evaluate_object(handle,
		wc_method, &wc_input, NULL);
		wc_method, &wc_input, NULL);