Commit 4a2d6f66 authored by Zhang Rui's avatar Zhang Rui Committed by Rafael J. Wysocki

intel-smartconnect: convert acpi_evaluate_object() to acpi_evaluate_integer()

acpi_evaluate_integer() is an ACPI API introduced to evaluate an
ACPI control method that is known to have an integer return value.
This API can simplify the code because the calling function does not need to
use the specified acpi_buffer structure required by acpi_evaluate_object();

Convert acpi_evaluate_object() to acpi_evaluate_integer()
in drivers/platform/x86/intel-smartconnect.c in this patch.
Signed-off-by: default avatarZhang Rui <rui.zhang@intel.com>
CC: Matthew Garrett <matthew.garrett@nebula.com>
Signed-off-by: default avatarRafael J. Wysocki <rafael.j.wysocki@intel.com>
parent c7c878a4
...@@ -25,28 +25,18 @@ MODULE_LICENSE("GPL"); ...@@ -25,28 +25,18 @@ MODULE_LICENSE("GPL");
static int smartconnect_acpi_init(struct acpi_device *acpi) static int smartconnect_acpi_init(struct acpi_device *acpi)
{ {
struct acpi_buffer output = { ACPI_ALLOCATE_BUFFER, NULL }; unsigned long long value;
union acpi_object *result;
acpi_status status; acpi_status status;
status = acpi_evaluate_object(acpi->handle, "GAOS", NULL, &output); status = acpi_evaluate_integer(acpi->handle, "GAOS", NULL, &value);
if (!ACPI_SUCCESS(status)) if (!ACPI_SUCCESS(status))
return -EINVAL; return -EINVAL;
result = output.pointer; if (value & 0x1) {
if (result->type != ACPI_TYPE_INTEGER) {
kfree(result);
return -EINVAL;
}
if (result->integer.value & 0x1) {
dev_info(&acpi->dev, "Disabling Intel Smart Connect\n"); dev_info(&acpi->dev, "Disabling Intel Smart Connect\n");
status = acpi_execute_simple_method(acpi->handle, "SAOS", 0); status = acpi_execute_simple_method(acpi->handle, "SAOS", 0);
} }
kfree(result);
return 0; return 0;
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment