| Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 1 | /****************************************************************************** | 
|  | 2 | * | 
|  | 3 | * Module Name: nsload - namespace loading/expanding/contracting procedures | 
|  | 4 | * | 
|  | 5 | *****************************************************************************/ | 
|  | 6 |  | 
|  | 7 | /* | 
| Bob Moore | 6c9deb7 | 2007-02-02 19:48:24 +0300 | [diff] [blame] | 8 | * Copyright (C) 2000 - 2007, R. Byron Moore | 
| Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 9 | * All rights reserved. | 
|  | 10 | * | 
|  | 11 | * Redistribution and use in source and binary forms, with or without | 
|  | 12 | * modification, are permitted provided that the following conditions | 
|  | 13 | * are met: | 
|  | 14 | * 1. Redistributions of source code must retain the above copyright | 
|  | 15 | *    notice, this list of conditions, and the following disclaimer, | 
|  | 16 | *    without modification. | 
|  | 17 | * 2. Redistributions in binary form must reproduce at minimum a disclaimer | 
|  | 18 | *    substantially similar to the "NO WARRANTY" disclaimer below | 
|  | 19 | *    ("Disclaimer") and any redistribution must be conditioned upon | 
|  | 20 | *    including a substantially similar Disclaimer requirement for further | 
|  | 21 | *    binary redistribution. | 
|  | 22 | * 3. Neither the names of the above-listed copyright holders nor the names | 
|  | 23 | *    of any contributors may be used to endorse or promote products derived | 
|  | 24 | *    from this software without specific prior written permission. | 
|  | 25 | * | 
|  | 26 | * Alternatively, this software may be distributed under the terms of the | 
|  | 27 | * GNU General Public License ("GPL") version 2 as published by the Free | 
|  | 28 | * Software Foundation. | 
|  | 29 | * | 
|  | 30 | * NO WARRANTY | 
|  | 31 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS | 
|  | 32 | * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT | 
|  | 33 | * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR | 
|  | 34 | * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT | 
|  | 35 | * HOLDERS OR CONTRIBUTORS BE LIABLE FOR SPECIAL, EXEMPLARY, OR CONSEQUENTIAL | 
|  | 36 | * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS | 
|  | 37 | * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) | 
|  | 38 | * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, | 
|  | 39 | * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING | 
|  | 40 | * IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE | 
|  | 41 | * POSSIBILITY OF SUCH DAMAGES. | 
|  | 42 | */ | 
|  | 43 |  | 
| Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 44 | #include <acpi/acpi.h> | 
|  | 45 | #include <acpi/acnamesp.h> | 
|  | 46 | #include <acpi/acdispat.h> | 
| Bob Moore | f3d2e78 | 2007-02-02 19:48:18 +0300 | [diff] [blame] | 47 | #include <acpi/actables.h> | 
| Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 48 |  | 
| Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 49 | #define _COMPONENT          ACPI_NAMESPACE | 
| Len Brown | 4be44fc | 2005-08-05 00:44:28 -0400 | [diff] [blame] | 50 | ACPI_MODULE_NAME("nsload") | 
| Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 51 |  | 
| Robert Moore | 44f6c01 | 2005-04-18 22:49:35 -0400 | [diff] [blame] | 52 | /* Local prototypes */ | 
| Robert Moore | 44f6c01 | 2005-04-18 22:49:35 -0400 | [diff] [blame] | 53 | #ifdef ACPI_FUTURE_IMPLEMENTATION | 
| Len Brown | 4be44fc | 2005-08-05 00:44:28 -0400 | [diff] [blame] | 54 | acpi_status acpi_ns_unload_namespace(acpi_handle handle); | 
| Robert Moore | 44f6c01 | 2005-04-18 22:49:35 -0400 | [diff] [blame] | 55 |  | 
| Len Brown | 4be44fc | 2005-08-05 00:44:28 -0400 | [diff] [blame] | 56 | static acpi_status acpi_ns_delete_subtree(acpi_handle start_handle); | 
| Robert Moore | 44f6c01 | 2005-04-18 22:49:35 -0400 | [diff] [blame] | 57 | #endif | 
|  | 58 |  | 
| Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 59 | #ifndef ACPI_NO_METHOD_EXECUTION | 
| Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 60 | /******************************************************************************* | 
|  | 61 | * | 
|  | 62 | * FUNCTION:    acpi_ns_load_table | 
|  | 63 | * | 
| Bob Moore | f3d2e78 | 2007-02-02 19:48:18 +0300 | [diff] [blame] | 64 | * PARAMETERS:  table_index     - Index for table to be loaded | 
| Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 65 | *              Node            - Owning NS node | 
|  | 66 | * | 
|  | 67 | * RETURN:      Status | 
|  | 68 | * | 
|  | 69 | * DESCRIPTION: Load one ACPI table into the namespace | 
|  | 70 | * | 
|  | 71 | ******************************************************************************/ | 
|  | 72 |  | 
|  | 73 | acpi_status | 
| Bob Moore | f3d2e78 | 2007-02-02 19:48:18 +0300 | [diff] [blame] | 74 | acpi_ns_load_table(acpi_native_uint table_index, | 
| Len Brown | 4be44fc | 2005-08-05 00:44:28 -0400 | [diff] [blame] | 75 | struct acpi_namespace_node *node) | 
| Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 76 | { | 
| Len Brown | 4be44fc | 2005-08-05 00:44:28 -0400 | [diff] [blame] | 77 | acpi_status status; | 
| Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 78 |  | 
| Bob Moore | b229cf9 | 2006-04-21 17:15:00 -0400 | [diff] [blame] | 79 | ACPI_FUNCTION_TRACE(ns_load_table); | 
| Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 80 |  | 
| Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 81 | /* | 
|  | 82 | * Parse the table and load the namespace with all named | 
|  | 83 | * objects found within.  Control methods are NOT parsed | 
|  | 84 | * at this time.  In fact, the control methods cannot be | 
|  | 85 | * parsed until the entire namespace is loaded, because | 
|  | 86 | * if a control method makes a forward reference (call) | 
|  | 87 | * to another control method, we can't continue parsing | 
|  | 88 | * because we don't know how many arguments to parse next! | 
|  | 89 | */ | 
| Len Brown | 4be44fc | 2005-08-05 00:44:28 -0400 | [diff] [blame] | 90 | status = acpi_ut_acquire_mutex(ACPI_MTX_NAMESPACE); | 
|  | 91 | if (ACPI_FAILURE(status)) { | 
|  | 92 | return_ACPI_STATUS(status); | 
| Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 93 | } | 
|  | 94 |  | 
| Bob Moore | f3d2e78 | 2007-02-02 19:48:18 +0300 | [diff] [blame] | 95 | /* If table already loaded into namespace, just return */ | 
|  | 96 |  | 
|  | 97 | if (acpi_tb_is_table_loaded(table_index)) { | 
|  | 98 | status = AE_ALREADY_EXISTS; | 
|  | 99 | goto unlock; | 
|  | 100 | } | 
|  | 101 |  | 
|  | 102 | ACPI_DEBUG_PRINT((ACPI_DB_INFO, | 
|  | 103 | "**** Loading table into namespace ****\n")); | 
|  | 104 |  | 
|  | 105 | status = acpi_tb_allocate_owner_id(table_index); | 
|  | 106 | if (ACPI_FAILURE(status)) { | 
|  | 107 | goto unlock; | 
|  | 108 | } | 
|  | 109 |  | 
|  | 110 | status = acpi_ns_parse_table(table_index, node->child); | 
|  | 111 | if (ACPI_SUCCESS(status)) { | 
|  | 112 | acpi_tb_set_table_loaded_flag(table_index, TRUE); | 
|  | 113 | } else { | 
|  | 114 | acpi_tb_release_owner_id(table_index); | 
|  | 115 | } | 
|  | 116 |  | 
|  | 117 | unlock: | 
| Len Brown | 4be44fc | 2005-08-05 00:44:28 -0400 | [diff] [blame] | 118 | (void)acpi_ut_release_mutex(ACPI_MTX_NAMESPACE); | 
| Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 119 |  | 
| Len Brown | 4be44fc | 2005-08-05 00:44:28 -0400 | [diff] [blame] | 120 | if (ACPI_FAILURE(status)) { | 
|  | 121 | return_ACPI_STATUS(status); | 
| Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 122 | } | 
|  | 123 |  | 
|  | 124 | /* | 
|  | 125 | * Now we can parse the control methods.  We always parse | 
|  | 126 | * them here for a sanity check, and if configured for | 
|  | 127 | * just-in-time parsing, we delete the control method | 
|  | 128 | * parse trees. | 
|  | 129 | */ | 
| Len Brown | 4be44fc | 2005-08-05 00:44:28 -0400 | [diff] [blame] | 130 | ACPI_DEBUG_PRINT((ACPI_DB_INFO, | 
|  | 131 | "**** Begin Table Method Parsing and Object Initialization ****\n")); | 
| Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 132 |  | 
| Bob Moore | f3d2e78 | 2007-02-02 19:48:18 +0300 | [diff] [blame] | 133 | status = acpi_ds_initialize_objects(table_index, node); | 
| Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 134 |  | 
| Len Brown | 4be44fc | 2005-08-05 00:44:28 -0400 | [diff] [blame] | 135 | ACPI_DEBUG_PRINT((ACPI_DB_INFO, | 
|  | 136 | "**** Completed Table Method Parsing and Object Initialization ****\n")); | 
| Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 137 |  | 
| Len Brown | 4be44fc | 2005-08-05 00:44:28 -0400 | [diff] [blame] | 138 | return_ACPI_STATUS(status); | 
| Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 139 | } | 
|  | 140 |  | 
| Bob Moore | f3d2e78 | 2007-02-02 19:48:18 +0300 | [diff] [blame] | 141 | #ifdef ACPI_OBSOLETE_FUNCTIONS | 
| Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 142 | /******************************************************************************* | 
|  | 143 | * | 
|  | 144 | * FUNCTION:    acpi_load_namespace | 
|  | 145 | * | 
|  | 146 | * PARAMETERS:  None | 
|  | 147 | * | 
|  | 148 | * RETURN:      Status | 
|  | 149 | * | 
|  | 150 | * DESCRIPTION: Load the name space from what ever is pointed to by DSDT. | 
|  | 151 | *              (DSDT points to either the BIOS or a buffer.) | 
|  | 152 | * | 
|  | 153 | ******************************************************************************/ | 
|  | 154 |  | 
| Len Brown | 4be44fc | 2005-08-05 00:44:28 -0400 | [diff] [blame] | 155 | acpi_status acpi_ns_load_namespace(void) | 
| Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 156 | { | 
| Len Brown | 4be44fc | 2005-08-05 00:44:28 -0400 | [diff] [blame] | 157 | acpi_status status; | 
| Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 158 |  | 
| Bob Moore | b229cf9 | 2006-04-21 17:15:00 -0400 | [diff] [blame] | 159 | ACPI_FUNCTION_TRACE(acpi_load_name_space); | 
| Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 160 |  | 
|  | 161 | /* There must be at least a DSDT installed */ | 
|  | 162 |  | 
|  | 163 | if (acpi_gbl_DSDT == NULL) { | 
| Bob Moore | b8e4d89 | 2006-01-27 16:43:00 -0500 | [diff] [blame] | 164 | ACPI_ERROR((AE_INFO, "DSDT is not in memory")); | 
| Len Brown | 4be44fc | 2005-08-05 00:44:28 -0400 | [diff] [blame] | 165 | return_ACPI_STATUS(AE_NO_ACPI_TABLES); | 
| Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 166 | } | 
|  | 167 |  | 
|  | 168 | /* | 
|  | 169 | * Load the namespace.  The DSDT is required, | 
|  | 170 | * but the SSDT and PSDT tables are optional. | 
|  | 171 | */ | 
| Bob Moore | b229cf9 | 2006-04-21 17:15:00 -0400 | [diff] [blame] | 172 | status = acpi_ns_load_table_by_type(ACPI_TABLE_ID_DSDT); | 
| Len Brown | 4be44fc | 2005-08-05 00:44:28 -0400 | [diff] [blame] | 173 | if (ACPI_FAILURE(status)) { | 
|  | 174 | return_ACPI_STATUS(status); | 
| Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 175 | } | 
|  | 176 |  | 
|  | 177 | /* Ignore exceptions from these */ | 
|  | 178 |  | 
| Bob Moore | b229cf9 | 2006-04-21 17:15:00 -0400 | [diff] [blame] | 179 | (void)acpi_ns_load_table_by_type(ACPI_TABLE_ID_SSDT); | 
|  | 180 | (void)acpi_ns_load_table_by_type(ACPI_TABLE_ID_PSDT); | 
| Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 181 |  | 
| Len Brown | 4be44fc | 2005-08-05 00:44:28 -0400 | [diff] [blame] | 182 | ACPI_DEBUG_PRINT_RAW((ACPI_DB_INIT, | 
|  | 183 | "ACPI Namespace successfully loaded at root %p\n", | 
|  | 184 | acpi_gbl_root_node)); | 
| Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 185 |  | 
| Len Brown | 4be44fc | 2005-08-05 00:44:28 -0400 | [diff] [blame] | 186 | return_ACPI_STATUS(status); | 
| Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 187 | } | 
| Bob Moore | f3d2e78 | 2007-02-02 19:48:18 +0300 | [diff] [blame] | 188 | #endif | 
| Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 189 |  | 
| Robert Moore | 44f6c01 | 2005-04-18 22:49:35 -0400 | [diff] [blame] | 190 | #ifdef ACPI_FUTURE_IMPLEMENTATION | 
| Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 191 | /******************************************************************************* | 
|  | 192 | * | 
|  | 193 | * FUNCTION:    acpi_ns_delete_subtree | 
|  | 194 | * | 
|  | 195 | * PARAMETERS:  start_handle        - Handle in namespace where search begins | 
|  | 196 | * | 
|  | 197 | * RETURNS      Status | 
|  | 198 | * | 
|  | 199 | * DESCRIPTION: Walks the namespace starting at the given handle and deletes | 
|  | 200 | *              all objects, entries, and scopes in the entire subtree. | 
|  | 201 | * | 
|  | 202 | *              Namespace/Interpreter should be locked or the subsystem should | 
|  | 203 | *              be in shutdown before this routine is called. | 
|  | 204 | * | 
|  | 205 | ******************************************************************************/ | 
|  | 206 |  | 
| Len Brown | 4be44fc | 2005-08-05 00:44:28 -0400 | [diff] [blame] | 207 | static acpi_status acpi_ns_delete_subtree(acpi_handle start_handle) | 
| Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 208 | { | 
| Len Brown | 4be44fc | 2005-08-05 00:44:28 -0400 | [diff] [blame] | 209 | acpi_status status; | 
|  | 210 | acpi_handle child_handle; | 
|  | 211 | acpi_handle parent_handle; | 
|  | 212 | acpi_handle next_child_handle; | 
|  | 213 | acpi_handle dummy; | 
|  | 214 | u32 level; | 
| Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 215 |  | 
| Bob Moore | b229cf9 | 2006-04-21 17:15:00 -0400 | [diff] [blame] | 216 | ACPI_FUNCTION_TRACE(ns_delete_subtree); | 
| Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 217 |  | 
|  | 218 | parent_handle = start_handle; | 
|  | 219 | child_handle = NULL; | 
| Len Brown | 4be44fc | 2005-08-05 00:44:28 -0400 | [diff] [blame] | 220 | level = 1; | 
| Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 221 |  | 
|  | 222 | /* | 
|  | 223 | * Traverse the tree of objects until we bubble back up | 
|  | 224 | * to where we started. | 
|  | 225 | */ | 
|  | 226 | while (level > 0) { | 
| Bob Moore | 52fc0b0 | 2006-10-02 00:00:00 -0400 | [diff] [blame] | 227 |  | 
| Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 228 | /* Attempt to get the next object in this scope */ | 
|  | 229 |  | 
| Len Brown | 4be44fc | 2005-08-05 00:44:28 -0400 | [diff] [blame] | 230 | status = acpi_get_next_object(ACPI_TYPE_ANY, parent_handle, | 
|  | 231 | child_handle, &next_child_handle); | 
| Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 232 |  | 
|  | 233 | child_handle = next_child_handle; | 
|  | 234 |  | 
|  | 235 | /* Did we get a new object? */ | 
|  | 236 |  | 
| Len Brown | 4be44fc | 2005-08-05 00:44:28 -0400 | [diff] [blame] | 237 | if (ACPI_SUCCESS(status)) { | 
| Bob Moore | 52fc0b0 | 2006-10-02 00:00:00 -0400 | [diff] [blame] | 238 |  | 
| Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 239 | /* Check if this object has any children */ | 
|  | 240 |  | 
| Len Brown | 4be44fc | 2005-08-05 00:44:28 -0400 | [diff] [blame] | 241 | if (ACPI_SUCCESS | 
|  | 242 | (acpi_get_next_object | 
|  | 243 | (ACPI_TYPE_ANY, child_handle, NULL, &dummy))) { | 
| Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 244 | /* | 
|  | 245 | * There is at least one child of this object, | 
|  | 246 | * visit the object | 
|  | 247 | */ | 
|  | 248 | level++; | 
|  | 249 | parent_handle = child_handle; | 
|  | 250 | child_handle = NULL; | 
|  | 251 | } | 
| Len Brown | 4be44fc | 2005-08-05 00:44:28 -0400 | [diff] [blame] | 252 | } else { | 
| Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 253 | /* | 
|  | 254 | * No more children in this object, go back up to | 
|  | 255 | * the object's parent | 
|  | 256 | */ | 
|  | 257 | level--; | 
|  | 258 |  | 
|  | 259 | /* Delete all children now */ | 
|  | 260 |  | 
| Len Brown | 4be44fc | 2005-08-05 00:44:28 -0400 | [diff] [blame] | 261 | acpi_ns_delete_children(child_handle); | 
| Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 262 |  | 
|  | 263 | child_handle = parent_handle; | 
| Len Brown | 4be44fc | 2005-08-05 00:44:28 -0400 | [diff] [blame] | 264 | status = acpi_get_parent(parent_handle, &parent_handle); | 
|  | 265 | if (ACPI_FAILURE(status)) { | 
|  | 266 | return_ACPI_STATUS(status); | 
| Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 267 | } | 
|  | 268 | } | 
|  | 269 | } | 
|  | 270 |  | 
|  | 271 | /* Now delete the starting object, and we are done */ | 
|  | 272 |  | 
| Len Brown | 4be44fc | 2005-08-05 00:44:28 -0400 | [diff] [blame] | 273 | acpi_ns_delete_node(child_handle); | 
| Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 274 |  | 
| Len Brown | 4be44fc | 2005-08-05 00:44:28 -0400 | [diff] [blame] | 275 | return_ACPI_STATUS(AE_OK); | 
| Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 276 | } | 
|  | 277 |  | 
| Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 278 | /******************************************************************************* | 
|  | 279 | * | 
|  | 280 | *  FUNCTION:       acpi_ns_unload_name_space | 
|  | 281 | * | 
|  | 282 | *  PARAMETERS:     Handle          - Root of namespace subtree to be deleted | 
|  | 283 | * | 
|  | 284 | *  RETURN:         Status | 
|  | 285 | * | 
|  | 286 | *  DESCRIPTION:    Shrinks the namespace, typically in response to an undocking | 
|  | 287 | *                  event.  Deletes an entire subtree starting from (and | 
|  | 288 | *                  including) the given handle. | 
|  | 289 | * | 
|  | 290 | ******************************************************************************/ | 
|  | 291 |  | 
| Len Brown | 4be44fc | 2005-08-05 00:44:28 -0400 | [diff] [blame] | 292 | acpi_status acpi_ns_unload_namespace(acpi_handle handle) | 
| Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 293 | { | 
| Len Brown | 4be44fc | 2005-08-05 00:44:28 -0400 | [diff] [blame] | 294 | acpi_status status; | 
| Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 295 |  | 
| Bob Moore | b229cf9 | 2006-04-21 17:15:00 -0400 | [diff] [blame] | 296 | ACPI_FUNCTION_TRACE(ns_unload_name_space); | 
| Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 297 |  | 
|  | 298 | /* Parameter validation */ | 
|  | 299 |  | 
|  | 300 | if (!acpi_gbl_root_node) { | 
| Len Brown | 4be44fc | 2005-08-05 00:44:28 -0400 | [diff] [blame] | 301 | return_ACPI_STATUS(AE_NO_NAMESPACE); | 
| Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 302 | } | 
|  | 303 |  | 
|  | 304 | if (!handle) { | 
| Len Brown | 4be44fc | 2005-08-05 00:44:28 -0400 | [diff] [blame] | 305 | return_ACPI_STATUS(AE_BAD_PARAMETER); | 
| Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 306 | } | 
|  | 307 |  | 
|  | 308 | /* This function does the real work */ | 
|  | 309 |  | 
| Len Brown | 4be44fc | 2005-08-05 00:44:28 -0400 | [diff] [blame] | 310 | status = acpi_ns_delete_subtree(handle); | 
| Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 311 |  | 
| Len Brown | 4be44fc | 2005-08-05 00:44:28 -0400 | [diff] [blame] | 312 | return_ACPI_STATUS(status); | 
| Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 313 | } | 
| Robert Moore | 44f6c01 | 2005-04-18 22:49:35 -0400 | [diff] [blame] | 314 | #endif | 
| Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 315 | #endif |