summaryrefslogtreecommitdiffstats
path: root/drivers/platform
diff options
context:
space:
mode:
authorZhang Rui <rui.zhang@intel.com>2013-09-02 20:32:06 -0400
committerRafael J. Wysocki <rafael.j.wysocki@intel.com>2013-09-23 19:37:56 -0400
commite2e196069fd68fcf8c20fd478f8b683e5403e575 (patch)
treef80d21414852da1acd621824062c37a9e43d4b79 /drivers/platform
parent8a8bce1dc50c9beab55fc697230f910a9142fc3d (diff)
toshiba_acpi: convert acpi_get_handle() to acpi_has_method()
acpi_has_method() is a new ACPI API introduced to check the existence of an ACPI control method. It can be used to replace acpi_get_handle() in the case that 1. the calling function doesn't need the ACPI handle of the control method. and 2. the calling function doesn't care the reason why the method is unavailable. Convert acpi_get_handle() to acpi_has_method() 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.c21
1 files changed, 6 insertions, 15 deletions
diff --git a/drivers/platform/x86/toshiba_acpi.c b/drivers/platform/x86/toshiba_acpi.c
index 4c0e6579c4ca..235185b710c8 100644
--- a/drivers/platform/x86/toshiba_acpi.c
+++ b/drivers/platform/x86/toshiba_acpi.c
@@ -974,7 +974,7 @@ static void toshiba_acpi_report_hotkey(struct toshiba_acpi_dev *dev,
974static int toshiba_acpi_setup_keyboard(struct toshiba_acpi_dev *dev) 974static int toshiba_acpi_setup_keyboard(struct toshiba_acpi_dev *dev)
975{ 975{
976 acpi_status status; 976 acpi_status status;
977 acpi_handle ec_handle, handle; 977 acpi_handle ec_handle;
978 int error; 978 int error;
979 u32 hci_result; 979 u32 hci_result;
980 980
@@ -1001,10 +1001,7 @@ static int toshiba_acpi_setup_keyboard(struct toshiba_acpi_dev *dev)
1001 */ 1001 */
1002 status = AE_ERROR; 1002 status = AE_ERROR;
1003 ec_handle = ec_get_handle(); 1003 ec_handle = ec_get_handle();
1004 if (ec_handle) 1004 if (ec_handle && acpi_has_method(ec_handle, "NTFY")) {
1005 status = acpi_get_handle(ec_handle, "NTFY", &handle);
1006
1007 if (ACPI_SUCCESS(status)) {
1008 INIT_WORK(&dev->hotkey_work, toshiba_acpi_hotkey_work); 1005 INIT_WORK(&dev->hotkey_work, toshiba_acpi_hotkey_work);
1009 1006
1010 error = i8042_install_filter(toshiba_acpi_i8042_filter); 1007 error = i8042_install_filter(toshiba_acpi_i8042_filter);
@@ -1020,10 +1017,9 @@ static int toshiba_acpi_setup_keyboard(struct toshiba_acpi_dev *dev)
1020 * Determine hotkey query interface. Prefer using the INFO 1017 * Determine hotkey query interface. Prefer using the INFO
1021 * method when it is available. 1018 * method when it is available.
1022 */ 1019 */
1023 status = acpi_get_handle(dev->acpi_dev->handle, "INFO", &handle); 1020 if (acpi_has_method(dev->acpi_dev->handle, "INFO"))
1024 if (ACPI_SUCCESS(status)) {
1025 dev->info_supported = 1; 1021 dev->info_supported = 1;
1026 } else { 1022 else {
1027 hci_write1(dev, HCI_SYSTEM_EVENT, 1, &hci_result); 1023 hci_write1(dev, HCI_SYSTEM_EVENT, 1, &hci_result);
1028 if (hci_result == HCI_SUCCESS) 1024 if (hci_result == HCI_SUCCESS)
1029 dev->system_event_supported = 1; 1025 dev->system_event_supported = 1;
@@ -1148,15 +1144,10 @@ static int toshiba_acpi_remove(struct acpi_device *acpi_dev)
1148 1144
1149static const char *find_hci_method(acpi_handle handle) 1145static const char *find_hci_method(acpi_handle handle)
1150{ 1146{
1151 acpi_status status; 1147 if (acpi_has_method(handle, "GHCI"))
1152 acpi_handle hci_handle;
1153
1154 status = acpi_get_handle(handle, "GHCI", &hci_handle);
1155 if (ACPI_SUCCESS(status))
1156 return "GHCI"; 1148 return "GHCI";
1157 1149
1158 status = acpi_get_handle(handle, "SPFC", &hci_handle); 1150 if (acpi_has_method(handle, "SPFC"))
1159 if (ACPI_SUCCESS(status))
1160 return "SPFC"; 1151 return "SPFC";
1161 1152
1162 return NULL; 1153 return NULL;