diff options
author | Zhang Rui <rui.zhang@intel.com> | 2013-09-02 20:32:15 -0400 |
---|---|---|
committer | Rafael J. Wysocki <rafael.j.wysocki@intel.com> | 2013-09-23 19:37:57 -0400 |
commit | 74facaf75d3de2dd81193d907d0bee050c259f0c (patch) | |
tree | 683d43bb5af14f4e886645cc8610dcf6a8a69898 /drivers/platform | |
parent | 4a2d6f6637d59bafa8be5cd4c323684224422ef1 (diff) |
toshiba_acpi: 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/toshiba_acpi.c in this patch.
Signed-off-by: Zhang Rui <rui.zhang@intel.com>
CC: Matthew Garrett <matthew.garrett@nebula.com>
Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
Diffstat (limited to 'drivers/platform')
-rw-r--r-- | drivers/platform/x86/toshiba_acpi.c | 14 |
1 files changed, 5 insertions, 9 deletions
diff --git a/drivers/platform/x86/toshiba_acpi.c b/drivers/platform/x86/toshiba_acpi.c index 235185b710c8..0cfadb65f7c6 100644 --- a/drivers/platform/x86/toshiba_acpi.c +++ b/drivers/platform/x86/toshiba_acpi.c | |||
@@ -940,21 +940,17 @@ static void toshiba_acpi_hotkey_work(struct work_struct *work) | |||
940 | */ | 940 | */ |
941 | static int toshiba_acpi_query_hotkey(struct toshiba_acpi_dev *dev) | 941 | static int toshiba_acpi_query_hotkey(struct toshiba_acpi_dev *dev) |
942 | { | 942 | { |
943 | struct acpi_buffer buf; | 943 | unsigned long long value; |
944 | union acpi_object out_obj; | ||
945 | acpi_status status; | 944 | acpi_status status; |
946 | 945 | ||
947 | buf.pointer = &out_obj; | 946 | status = acpi_evaluate_integer(dev->acpi_dev->handle, "INFO", |
948 | buf.length = sizeof(out_obj); | 947 | NULL, &value); |
949 | 948 | if (ACPI_FAILURE(status)) { | |
950 | status = acpi_evaluate_object(dev->acpi_dev->handle, "INFO", | ||
951 | NULL, &buf); | ||
952 | if (ACPI_FAILURE(status) || out_obj.type != ACPI_TYPE_INTEGER) { | ||
953 | pr_err("ACPI INFO method execution failed\n"); | 949 | pr_err("ACPI INFO method execution failed\n"); |
954 | return -EIO; | 950 | return -EIO; |
955 | } | 951 | } |
956 | 952 | ||
957 | return out_obj.integer.value; | 953 | return value; |
958 | } | 954 | } |
959 | 955 | ||
960 | static void toshiba_acpi_report_hotkey(struct toshiba_acpi_dev *dev, | 956 | static void toshiba_acpi_report_hotkey(struct toshiba_acpi_dev *dev, |