ACPI: DPTF: Fix reading of attributes
authorSrinivas Pandruvada <srinivas.pandruvada@linux.intel.com>
Tue, 27 Jul 2021 16:18:24 +0000 (09:18 -0700)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Wed, 4 Aug 2021 10:46:39 +0000 (12:46 +0200)
commit2388c7674fbdb9d8944caee768e599b02a21b33e
treed88fdab9b1316803d6da33f6339298a48aeff3f2
parent0d6afa25975e73fef3537678e98386020661eed0
ACPI: DPTF: Fix reading of attributes

commit 41a8457f3f6f829be1f8f8fa7577a46b9b7223ef upstream.

The current assumption that methods to read PCH FIVR attributes will
return integer, is not correct. There is no good way to return integer
as negative numbers are also valid.

These read methods return a package of integers. The first integer returns
status, which is 0 on success and any other value for failure. When the
returned status is zero, then the second integer returns the actual value.

This change fixes this issue by replacing acpi_evaluate_integer() with
acpi_evaluate_object() and use acpi_extract_package() to extract results.

Fixes: 2ce6324eadb01 ("ACPI: DPTF: Add PCH FIVR participant driver")
Signed-off-by: Srinivas Pandruvada <srinivas.pandruvada@linux.intel.com>
Cc: 5.10+ <stable@vger.kernel.org> # 5.10+
Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
drivers/acpi/dptf/dptf_pch_fivr.c