These changes are the raw update to linux-4.4.6-rt14. Kernel sources
[kvmfornfv.git] / kernel / drivers / acpi / acpica / nssearch.c
index 4a9d4a6..d739040 100644 (file)
@@ -325,8 +325,41 @@ acpi_ns_search_and_enter(u32 target_name,
                 * If we found it AND the request specifies that a find is an error,
                 * return the error
                 */
-               if ((status == AE_OK) && (flags & ACPI_NS_ERROR_IF_FOUND)) {
-                       status = AE_ALREADY_EXISTS;
+               if (status == AE_OK) {
+
+                       /* The node was found in the namespace */
+
+                       /*
+                        * If the namespace override feature is enabled for this node,
+                        * delete any existing attached sub-object and make the node
+                        * look like a new node that is owned by the override table.
+                        */
+                       if (flags & ACPI_NS_OVERRIDE_IF_FOUND) {
+                               ACPI_DEBUG_PRINT((ACPI_DB_NAMES,
+                                                 "Namespace override: %4.4s pass %u type %X Owner %X\n",
+                                                 ACPI_CAST_PTR(char,
+                                                               &target_name),
+                                                 interpreter_mode,
+                                                 (*return_node)->type,
+                                                 walk_state->owner_id));
+
+                               acpi_ns_delete_children(*return_node);
+                               if (acpi_gbl_runtime_namespace_override) {
+                                       acpi_ut_remove_reference((*return_node)->object);
+                                       (*return_node)->object = NULL;
+                                       (*return_node)->owner_id =
+                                           walk_state->owner_id;
+                               } else {
+                                       acpi_ns_remove_node(*return_node);
+                                       *return_node = ACPI_ENTRY_NOT_FOUND;
+                               }
+                       }
+
+                       /* Return an error if we don't expect to find the object */
+
+                       else if (flags & ACPI_NS_ERROR_IF_FOUND) {
+                               status = AE_ALREADY_EXISTS;
+                       }
                }
 #ifdef ACPI_ASL_COMPILER
                if (*return_node && (*return_node)->type == ACPI_TYPE_ANY) {