summaryrefslogtreecommitdiff
path: root/drivers/acpi/acpica/evrgnini.c
diff options
context:
space:
mode:
authorLv Zheng <lv.zheng@intel.com>2015-12-29 14:02:00 +0800
committerRafael J. Wysocki <rafael.j.wysocki@intel.com>2016-01-01 03:47:37 +0100
commitf31a99cefd05f798eee8b592e22175ff3fe1876b (patch)
tree6256bae4642ea41ae3f82fc55fc6db8ffa9c2e8e /drivers/acpi/acpica/evrgnini.c
parent7b73806485ada16059ecc1851793dbe865181c53 (diff)
ACPICA: Events: Deploys acpi_ev_find_region_handler()
ACPICA commit b916a0a0ae9e81db1a85523c63ec6aa32d5c70c8 There are code fragments that can be substituted by acpi_ev_find_region_handler(). This patch cleans up these code fragments. Lv Zheng. Link: https://github.com/acpica/acpica/commit/b916a0a0 Signed-off-by: Lv Zheng <lv.zheng@intel.com> Signed-off-by: Bob Moore <robert.moore@intel.com> Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
Diffstat (limited to 'drivers/acpi/acpica/evrgnini.c')
-rw-r--r--drivers/acpi/acpica/evrgnini.c73
1 files changed, 31 insertions, 42 deletions
diff --git a/drivers/acpi/acpica/evrgnini.c b/drivers/acpi/acpica/evrgnini.c
index 6181f5a2af4f..4df81b5a1751 100644
--- a/drivers/acpi/acpica/evrgnini.c
+++ b/drivers/acpi/acpica/evrgnini.c
@@ -602,60 +602,49 @@ acpi_ev_initialize_region(union acpi_operand_object *region_obj,
break;
}
- while (handler_obj) {
+ handler_obj =
+ acpi_ev_find_region_handler(space_id, handler_obj);
+ if (handler_obj) {
- /* Is this handler of the correct type? */
+ /* Found correct handler */
- if (handler_obj->address_space.space_id ==
- space_id) {
+ ACPI_DEBUG_PRINT((ACPI_DB_OPREGION,
+ "Found handler %p for region %p in obj %p\n",
+ handler_obj, region_obj,
+ obj_desc));
- /* Found correct handler */
-
- ACPI_DEBUG_PRINT((ACPI_DB_OPREGION,
- "Found handler %p for region %p in obj %p\n",
- handler_obj,
+ status =
+ acpi_ev_attach_region(handler_obj,
region_obj,
- obj_desc));
+ acpi_ns_locked);
+ /*
+ * Tell all users that this region is usable by
+ * running the _REG method
+ */
+ if (acpi_ns_locked) {
status =
- acpi_ev_attach_region(handler_obj,
- region_obj,
- acpi_ns_locked);
-
- /*
- * Tell all users that this region is usable by
- * running the _REG method
- */
- if (acpi_ns_locked) {
- status =
- acpi_ut_release_mutex
- (ACPI_MTX_NAMESPACE);
- if (ACPI_FAILURE(status)) {
- return_ACPI_STATUS
- (status);
- }
+ acpi_ut_release_mutex
+ (ACPI_MTX_NAMESPACE);
+ if (ACPI_FAILURE(status)) {
+ return_ACPI_STATUS(status);
}
+ }
+ status =
+ acpi_ev_execute_reg_method(region_obj,
+ ACPI_REG_CONNECT);
+
+ if (acpi_ns_locked) {
status =
- acpi_ev_execute_reg_method
- (region_obj, ACPI_REG_CONNECT);
-
- if (acpi_ns_locked) {
- status =
- acpi_ut_acquire_mutex
- (ACPI_MTX_NAMESPACE);
- if (ACPI_FAILURE(status)) {
- return_ACPI_STATUS
- (status);
- }
+ acpi_ut_acquire_mutex
+ (ACPI_MTX_NAMESPACE);
+ if (ACPI_FAILURE(status)) {
+ return_ACPI_STATUS(status);
}
-
- return_ACPI_STATUS(AE_OK);
}
- /* Try next handler in the list */
-
- handler_obj = handler_obj->address_space.next;
+ return_ACPI_STATUS(AE_OK);
}
}