ACPICA: Module-level code: enable _REG execution in same scope
[firefly-linux-kernel-4.4.55.git] / drivers / acpi / acpica / nseval.c
index 65e0d1a260ea9d0ba1d81de0ac59d5449b8999be..af9fe91037340ff1e404ffdc521881da8e65bf58 100644 (file)
@@ -381,6 +381,18 @@ acpi_ns_exec_module_code(union acpi_operand_object *method_obj,
                                    method_obj->method.next_object);
        type = acpi_ns_get_type(parent_node);
 
+       /*
+        * Get the region handler and save it in the method object. We may need
+        * this if an operation region declaration causes a _REG method to be run.
+        *
+        * We can't do this in acpi_ps_link_module_code because
+        * acpi_gbl_root_node->Object is NULL at PASS1.
+        */
+       if ((type == ACPI_TYPE_DEVICE) && parent_node->object) {
+               method_obj->method.extra.handler =
+                   parent_node->object->device.handler;
+       }
+
        /* Must clear next_object (acpi_ns_attach_object needs the field) */
 
        method_obj->method.next_object = NULL;