diff options
author | Len Brown <len.brown@intel.com> | 2005-08-05 00:44:28 -0400 |
---|---|---|
committer | Len Brown <len.brown@intel.com> | 2005-08-05 00:45:14 -0400 |
commit | 4be44fcd3bf648b782f4460fd06dfae6c42ded4b (patch) | |
tree | 5b5b7d296ea58786f53b95e5eac9565ff66890b0 /drivers/acpi/namespace | |
parent | c65ade4dc8b486e8c8b9b0a6399789a5428e2039 (diff) |
[ACPI] Lindent all ACPI files
Signed-off-by: Len Brown <len.brown@intel.com>
Diffstat (limited to 'drivers/acpi/namespace')
-rw-r--r-- | drivers/acpi/namespace/nsaccess.c | 342 | ||||
-rw-r--r-- | drivers/acpi/namespace/nsalloc.c | 232 | ||||
-rw-r--r-- | drivers/acpi/namespace/nsdump.c | 429 | ||||
-rw-r--r-- | drivers/acpi/namespace/nsdumpdv.c | 74 | ||||
-rw-r--r-- | drivers/acpi/namespace/nseval.c | 270 | ||||
-rw-r--r-- | drivers/acpi/namespace/nsinit.c | 257 | ||||
-rw-r--r-- | drivers/acpi/namespace/nsload.c | 228 | ||||
-rw-r--r-- | drivers/acpi/namespace/nsnames.c | 118 | ||||
-rw-r--r-- | drivers/acpi/namespace/nsobject.c | 209 | ||||
-rw-r--r-- | drivers/acpi/namespace/nsparse.c | 86 | ||||
-rw-r--r-- | drivers/acpi/namespace/nssearch.c | 205 | ||||
-rw-r--r-- | drivers/acpi/namespace/nsutils.c | 502 | ||||
-rw-r--r-- | drivers/acpi/namespace/nswalk.c | 105 | ||||
-rw-r--r-- | drivers/acpi/namespace/nsxfeval.c | 430 | ||||
-rw-r--r-- | drivers/acpi/namespace/nsxfname.c | 173 | ||||
-rw-r--r-- | drivers/acpi/namespace/nsxfobj.c | 91 |
16 files changed, 1679 insertions, 2072 deletions
diff --git a/drivers/acpi/namespace/nsaccess.c b/drivers/acpi/namespace/nsaccess.c index 7589e1fdf25a..edfbe34600f5 100644 --- a/drivers/acpi/namespace/nsaccess.c +++ b/drivers/acpi/namespace/nsaccess.c | |||
@@ -41,16 +41,13 @@ | |||
41 | * POSSIBILITY OF SUCH DAMAGES. | 41 | * POSSIBILITY OF SUCH DAMAGES. |
42 | */ | 42 | */ |
43 | 43 | ||
44 | |||
45 | #include <acpi/acpi.h> | 44 | #include <acpi/acpi.h> |
46 | #include <acpi/amlcode.h> | 45 | #include <acpi/amlcode.h> |
47 | #include <acpi/acnamesp.h> | 46 | #include <acpi/acnamesp.h> |
48 | #include <acpi/acdispat.h> | 47 | #include <acpi/acdispat.h> |
49 | 48 | ||
50 | |||
51 | #define _COMPONENT ACPI_NAMESPACE | 49 | #define _COMPONENT ACPI_NAMESPACE |
52 | ACPI_MODULE_NAME ("nsaccess") | 50 | ACPI_MODULE_NAME("nsaccess") |
53 | |||
54 | 51 | ||
55 | /******************************************************************************* | 52 | /******************************************************************************* |
56 | * | 53 | * |
@@ -65,24 +62,19 @@ | |||
65 | * MUTEX: Locks namespace for entire execution | 62 | * MUTEX: Locks namespace for entire execution |
66 | * | 63 | * |
67 | ******************************************************************************/ | 64 | ******************************************************************************/ |
68 | 65 | acpi_status acpi_ns_root_initialize(void) | |
69 | acpi_status | ||
70 | acpi_ns_root_initialize ( | ||
71 | void) | ||
72 | { | 66 | { |
73 | acpi_status status; | 67 | acpi_status status; |
74 | const struct acpi_predefined_names *init_val = NULL; | 68 | const struct acpi_predefined_names *init_val = NULL; |
75 | struct acpi_namespace_node *new_node; | 69 | struct acpi_namespace_node *new_node; |
76 | union acpi_operand_object *obj_desc; | 70 | union acpi_operand_object *obj_desc; |
77 | acpi_string val = NULL; | 71 | acpi_string val = NULL; |
78 | |||
79 | 72 | ||
80 | ACPI_FUNCTION_TRACE ("ns_root_initialize"); | 73 | ACPI_FUNCTION_TRACE("ns_root_initialize"); |
81 | 74 | ||
82 | 75 | status = acpi_ut_acquire_mutex(ACPI_MTX_NAMESPACE); | |
83 | status = acpi_ut_acquire_mutex (ACPI_MTX_NAMESPACE); | 76 | if (ACPI_FAILURE(status)) { |
84 | if (ACPI_FAILURE (status)) { | 77 | return_ACPI_STATUS(status); |
85 | return_ACPI_STATUS (status); | ||
86 | } | 78 | } |
87 | 79 | ||
88 | /* | 80 | /* |
@@ -102,24 +94,26 @@ acpi_ns_root_initialize ( | |||
102 | 94 | ||
103 | /* Enter the pre-defined names in the name table */ | 95 | /* Enter the pre-defined names in the name table */ |
104 | 96 | ||
105 | ACPI_DEBUG_PRINT ((ACPI_DB_INFO, | 97 | ACPI_DEBUG_PRINT((ACPI_DB_INFO, |
106 | "Entering predefined entries into namespace\n")); | 98 | "Entering predefined entries into namespace\n")); |
107 | 99 | ||
108 | for (init_val = acpi_gbl_pre_defined_names; init_val->name; init_val++) { | 100 | for (init_val = acpi_gbl_pre_defined_names; init_val->name; init_val++) { |
109 | /* _OSI is optional for now, will be permanent later */ | 101 | /* _OSI is optional for now, will be permanent later */ |
110 | 102 | ||
111 | if (!ACPI_STRCMP (init_val->name, "_OSI") && !acpi_gbl_create_osi_method) { | 103 | if (!ACPI_STRCMP(init_val->name, "_OSI") |
104 | && !acpi_gbl_create_osi_method) { | ||
112 | continue; | 105 | continue; |
113 | } | 106 | } |
114 | 107 | ||
115 | status = acpi_ns_lookup (NULL, init_val->name, init_val->type, | 108 | status = acpi_ns_lookup(NULL, init_val->name, init_val->type, |
116 | ACPI_IMODE_LOAD_PASS2, ACPI_NS_NO_UPSEARCH, | 109 | ACPI_IMODE_LOAD_PASS2, |
117 | NULL, &new_node); | 110 | ACPI_NS_NO_UPSEARCH, NULL, &new_node); |
118 | 111 | ||
119 | if (ACPI_FAILURE (status) || (!new_node)) /* Must be on same line for code converter */ { | 112 | if (ACPI_FAILURE(status) || (!new_node)) { /* Must be on same line for code converter */ |
120 | ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, | 113 | ACPI_DEBUG_PRINT((ACPI_DB_ERROR, |
121 | "Could not create predefined name %s, %s\n", | 114 | "Could not create predefined name %s, %s\n", |
122 | init_val->name, acpi_format_exception (status))); | 115 | init_val->name, |
116 | acpi_format_exception(status))); | ||
123 | } | 117 | } |
124 | 118 | ||
125 | /* | 119 | /* |
@@ -128,11 +122,11 @@ acpi_ns_root_initialize ( | |||
128 | * initial value, create the initial value. | 122 | * initial value, create the initial value. |
129 | */ | 123 | */ |
130 | if (init_val->val) { | 124 | if (init_val->val) { |
131 | status = acpi_os_predefined_override (init_val, &val); | 125 | status = acpi_os_predefined_override(init_val, &val); |
132 | if (ACPI_FAILURE (status)) { | 126 | if (ACPI_FAILURE(status)) { |
133 | ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, | 127 | ACPI_DEBUG_PRINT((ACPI_DB_ERROR, |
134 | "Could not override predefined %s\n", | 128 | "Could not override predefined %s\n", |
135 | init_val->name)); | 129 | init_val->name)); |
136 | } | 130 | } |
137 | 131 | ||
138 | if (!val) { | 132 | if (!val) { |
@@ -143,7 +137,8 @@ acpi_ns_root_initialize ( | |||
143 | * Entry requests an initial value, allocate a | 137 | * Entry requests an initial value, allocate a |
144 | * descriptor for it. | 138 | * descriptor for it. |
145 | */ | 139 | */ |
146 | obj_desc = acpi_ut_create_internal_object (init_val->type); | 140 | obj_desc = |
141 | acpi_ut_create_internal_object(init_val->type); | ||
147 | if (!obj_desc) { | 142 | if (!obj_desc) { |
148 | status = AE_NO_MEMORY; | 143 | status = AE_NO_MEMORY; |
149 | goto unlock_and_exit; | 144 | goto unlock_and_exit; |
@@ -156,7 +151,8 @@ acpi_ns_root_initialize ( | |||
156 | */ | 151 | */ |
157 | switch (init_val->type) { | 152 | switch (init_val->type) { |
158 | case ACPI_TYPE_METHOD: | 153 | case ACPI_TYPE_METHOD: |
159 | obj_desc->method.param_count = (u8) ACPI_TO_INTEGER (val); | 154 | obj_desc->method.param_count = |
155 | (u8) ACPI_TO_INTEGER(val); | ||
160 | obj_desc->common.flags |= AOPOBJ_DATA_VALID; | 156 | obj_desc->common.flags |= AOPOBJ_DATA_VALID; |
161 | 157 | ||
162 | #if defined (ACPI_ASL_COMPILER) | 158 | #if defined (ACPI_ASL_COMPILER) |
@@ -167,45 +163,50 @@ acpi_ns_root_initialize ( | |||
167 | #else | 163 | #else |
168 | /* Mark this as a very SPECIAL method */ | 164 | /* Mark this as a very SPECIAL method */ |
169 | 165 | ||
170 | obj_desc->method.method_flags = AML_METHOD_INTERNAL_ONLY; | 166 | obj_desc->method.method_flags = |
167 | AML_METHOD_INTERNAL_ONLY; | ||
171 | 168 | ||
172 | #ifndef ACPI_DUMP_APP | 169 | #ifndef ACPI_DUMP_APP |
173 | obj_desc->method.implementation = acpi_ut_osi_implementation; | 170 | obj_desc->method.implementation = |
171 | acpi_ut_osi_implementation; | ||
174 | #endif | 172 | #endif |
175 | #endif | 173 | #endif |
176 | break; | 174 | break; |
177 | 175 | ||
178 | case ACPI_TYPE_INTEGER: | 176 | case ACPI_TYPE_INTEGER: |
179 | 177 | ||
180 | obj_desc->integer.value = ACPI_TO_INTEGER (val); | 178 | obj_desc->integer.value = ACPI_TO_INTEGER(val); |
181 | break; | 179 | break; |
182 | 180 | ||
183 | |||
184 | case ACPI_TYPE_STRING: | 181 | case ACPI_TYPE_STRING: |
185 | 182 | ||
186 | /* | 183 | /* |
187 | * Build an object around the static string | 184 | * Build an object around the static string |
188 | */ | 185 | */ |
189 | obj_desc->string.length = (u32) ACPI_STRLEN (val); | 186 | obj_desc->string.length = |
187 | (u32) ACPI_STRLEN(val); | ||
190 | obj_desc->string.pointer = val; | 188 | obj_desc->string.pointer = val; |
191 | obj_desc->common.flags |= AOPOBJ_STATIC_POINTER; | 189 | obj_desc->common.flags |= AOPOBJ_STATIC_POINTER; |
192 | break; | 190 | break; |
193 | 191 | ||
194 | |||
195 | case ACPI_TYPE_MUTEX: | 192 | case ACPI_TYPE_MUTEX: |
196 | 193 | ||
197 | obj_desc->mutex.node = new_node; | 194 | obj_desc->mutex.node = new_node; |
198 | obj_desc->mutex.sync_level = (u8) (ACPI_TO_INTEGER (val) - 1); | 195 | obj_desc->mutex.sync_level = |
196 | (u8) (ACPI_TO_INTEGER(val) - 1); | ||
199 | 197 | ||
200 | if (ACPI_STRCMP (init_val->name, "_GL_") == 0) { | 198 | if (ACPI_STRCMP(init_val->name, "_GL_") == 0) { |
201 | /* | 199 | /* |
202 | * Create a counting semaphore for the | 200 | * Create a counting semaphore for the |
203 | * global lock | 201 | * global lock |
204 | */ | 202 | */ |
205 | status = acpi_os_create_semaphore (ACPI_NO_UNIT_LIMIT, | 203 | status = |
206 | 1, &obj_desc->mutex.semaphore); | 204 | acpi_os_create_semaphore |
207 | if (ACPI_FAILURE (status)) { | 205 | (ACPI_NO_UNIT_LIMIT, 1, |
208 | acpi_ut_remove_reference (obj_desc); | 206 | &obj_desc->mutex.semaphore); |
207 | if (ACPI_FAILURE(status)) { | ||
208 | acpi_ut_remove_reference | ||
209 | (obj_desc); | ||
209 | goto unlock_and_exit; | 210 | goto unlock_and_exit; |
210 | } | 211 | } |
211 | 212 | ||
@@ -213,56 +214,58 @@ acpi_ns_root_initialize ( | |||
213 | * We just created the mutex for the | 214 | * We just created the mutex for the |
214 | * global lock, save it | 215 | * global lock, save it |
215 | */ | 216 | */ |
216 | acpi_gbl_global_lock_semaphore = obj_desc->mutex.semaphore; | 217 | acpi_gbl_global_lock_semaphore = |
217 | } | 218 | obj_desc->mutex.semaphore; |
218 | else { | 219 | } else { |
219 | /* Create a mutex */ | 220 | /* Create a mutex */ |
220 | 221 | ||
221 | status = acpi_os_create_semaphore (1, 1, | 222 | status = acpi_os_create_semaphore(1, 1, |
222 | &obj_desc->mutex.semaphore); | 223 | &obj_desc-> |
223 | if (ACPI_FAILURE (status)) { | 224 | mutex. |
224 | acpi_ut_remove_reference (obj_desc); | 225 | semaphore); |
226 | if (ACPI_FAILURE(status)) { | ||
227 | acpi_ut_remove_reference | ||
228 | (obj_desc); | ||
225 | goto unlock_and_exit; | 229 | goto unlock_and_exit; |
226 | } | 230 | } |
227 | } | 231 | } |
228 | break; | 232 | break; |
229 | 233 | ||
230 | |||
231 | default: | 234 | default: |
232 | 235 | ||
233 | ACPI_REPORT_ERROR (("Unsupported initial type value %X\n", | 236 | ACPI_REPORT_ERROR(("Unsupported initial type value %X\n", init_val->type)); |
234 | init_val->type)); | 237 | acpi_ut_remove_reference(obj_desc); |
235 | acpi_ut_remove_reference (obj_desc); | ||
236 | obj_desc = NULL; | 238 | obj_desc = NULL; |
237 | continue; | 239 | continue; |
238 | } | 240 | } |
239 | 241 | ||
240 | /* Store pointer to value descriptor in the Node */ | 242 | /* Store pointer to value descriptor in the Node */ |
241 | 243 | ||
242 | status = acpi_ns_attach_object (new_node, obj_desc, | 244 | status = acpi_ns_attach_object(new_node, obj_desc, |
243 | ACPI_GET_OBJECT_TYPE (obj_desc)); | 245 | ACPI_GET_OBJECT_TYPE |
246 | (obj_desc)); | ||
244 | 247 | ||
245 | /* Remove local reference to the object */ | 248 | /* Remove local reference to the object */ |
246 | 249 | ||
247 | acpi_ut_remove_reference (obj_desc); | 250 | acpi_ut_remove_reference(obj_desc); |
248 | } | 251 | } |
249 | } | 252 | } |
250 | 253 | ||
251 | 254 | unlock_and_exit: | |
252 | unlock_and_exit: | 255 | (void)acpi_ut_release_mutex(ACPI_MTX_NAMESPACE); |
253 | (void) acpi_ut_release_mutex (ACPI_MTX_NAMESPACE); | ||
254 | 256 | ||
255 | /* Save a handle to "_GPE", it is always present */ | 257 | /* Save a handle to "_GPE", it is always present */ |
256 | 258 | ||
257 | if (ACPI_SUCCESS (status)) { | 259 | if (ACPI_SUCCESS(status)) { |
258 | status = acpi_ns_get_node_by_path ("\\_GPE", NULL, ACPI_NS_NO_UPSEARCH, | 260 | status = |
259 | &acpi_gbl_fadt_gpe_device); | 261 | acpi_ns_get_node_by_path("\\_GPE", NULL, |
262 | ACPI_NS_NO_UPSEARCH, | ||
263 | &acpi_gbl_fadt_gpe_device); | ||
260 | } | 264 | } |
261 | 265 | ||
262 | return_ACPI_STATUS (status); | 266 | return_ACPI_STATUS(status); |
263 | } | 267 | } |
264 | 268 | ||
265 | |||
266 | /******************************************************************************* | 269 | /******************************************************************************* |
267 | * | 270 | * |
268 | * FUNCTION: acpi_ns_lookup | 271 | * FUNCTION: acpi_ns_lookup |
@@ -287,62 +290,57 @@ unlock_and_exit: | |||
287 | ******************************************************************************/ | 290 | ******************************************************************************/ |
288 | 291 | ||
289 | acpi_status | 292 | acpi_status |
290 | acpi_ns_lookup ( | 293 | acpi_ns_lookup(union acpi_generic_state *scope_info, |
291 | union acpi_generic_state *scope_info, | 294 | char *pathname, |
292 | char *pathname, | 295 | acpi_object_type type, |
293 | acpi_object_type type, | 296 | acpi_interpreter_mode interpreter_mode, |
294 | acpi_interpreter_mode interpreter_mode, | 297 | u32 flags, |
295 | u32 flags, | 298 | struct acpi_walk_state *walk_state, |
296 | struct acpi_walk_state *walk_state, | 299 | struct acpi_namespace_node **return_node) |
297 | struct acpi_namespace_node **return_node) | ||
298 | { | 300 | { |
299 | acpi_status status; | 301 | acpi_status status; |
300 | char *path = pathname; | 302 | char *path = pathname; |
301 | struct acpi_namespace_node *prefix_node; | 303 | struct acpi_namespace_node *prefix_node; |
302 | struct acpi_namespace_node *current_node = NULL; | 304 | struct acpi_namespace_node *current_node = NULL; |
303 | struct acpi_namespace_node *this_node = NULL; | 305 | struct acpi_namespace_node *this_node = NULL; |
304 | u32 num_segments; | 306 | u32 num_segments; |
305 | u32 num_carats; | 307 | u32 num_carats; |
306 | acpi_name simple_name; | 308 | acpi_name simple_name; |
307 | acpi_object_type type_to_check_for; | 309 | acpi_object_type type_to_check_for; |
308 | acpi_object_type this_search_type; | 310 | acpi_object_type this_search_type; |
309 | u32 search_parent_flag = ACPI_NS_SEARCH_PARENT; | 311 | u32 search_parent_flag = ACPI_NS_SEARCH_PARENT; |
310 | u32 local_flags = flags & ~(ACPI_NS_ERROR_IF_FOUND | | 312 | u32 local_flags = flags & ~(ACPI_NS_ERROR_IF_FOUND | |
311 | ACPI_NS_SEARCH_PARENT); | 313 | ACPI_NS_SEARCH_PARENT); |
312 | 314 | ||
313 | 315 | ACPI_FUNCTION_TRACE("ns_lookup"); | |
314 | ACPI_FUNCTION_TRACE ("ns_lookup"); | ||
315 | |||
316 | 316 | ||
317 | if (!return_node) { | 317 | if (!return_node) { |
318 | return_ACPI_STATUS (AE_BAD_PARAMETER); | 318 | return_ACPI_STATUS(AE_BAD_PARAMETER); |
319 | } | 319 | } |
320 | 320 | ||
321 | acpi_gbl_ns_lookup_count++; | 321 | acpi_gbl_ns_lookup_count++; |
322 | *return_node = ACPI_ENTRY_NOT_FOUND; | 322 | *return_node = ACPI_ENTRY_NOT_FOUND; |
323 | 323 | ||
324 | if (!acpi_gbl_root_node) { | 324 | if (!acpi_gbl_root_node) { |
325 | return_ACPI_STATUS (AE_NO_NAMESPACE); | 325 | return_ACPI_STATUS(AE_NO_NAMESPACE); |
326 | } | 326 | } |
327 | 327 | ||
328 | /* | 328 | /* |
329 | * Get the prefix scope. | 329 | * Get the prefix scope. |
330 | * A null scope means use the root scope | 330 | * A null scope means use the root scope |
331 | */ | 331 | */ |
332 | if ((!scope_info) || | 332 | if ((!scope_info) || (!scope_info->scope.node)) { |
333 | (!scope_info->scope.node)) { | 333 | ACPI_DEBUG_PRINT((ACPI_DB_NAMES, |
334 | ACPI_DEBUG_PRINT ((ACPI_DB_NAMES, | 334 | "Null scope prefix, using root node (%p)\n", |
335 | "Null scope prefix, using root node (%p)\n", | 335 | acpi_gbl_root_node)); |
336 | acpi_gbl_root_node)); | ||
337 | 336 | ||
338 | prefix_node = acpi_gbl_root_node; | 337 | prefix_node = acpi_gbl_root_node; |
339 | } | 338 | } else { |
340 | else { | ||
341 | prefix_node = scope_info->scope.node; | 339 | prefix_node = scope_info->scope.node; |
342 | if (ACPI_GET_DESCRIPTOR_TYPE (prefix_node) != ACPI_DESC_TYPE_NAMED) { | 340 | if (ACPI_GET_DESCRIPTOR_TYPE(prefix_node) != |
343 | ACPI_REPORT_ERROR (("ns_lookup: %p is not a namespace node [%s]\n", | 341 | ACPI_DESC_TYPE_NAMED) { |
344 | prefix_node, acpi_ut_get_descriptor_name (prefix_node))); | 342 | ACPI_REPORT_ERROR(("ns_lookup: %p is not a namespace node [%s]\n", prefix_node, acpi_ut_get_descriptor_name(prefix_node))); |
345 | return_ACPI_STATUS (AE_AML_INTERNAL); | 343 | return_ACPI_STATUS(AE_AML_INTERNAL); |
346 | } | 344 | } |
347 | 345 | ||
348 | /* | 346 | /* |
@@ -350,9 +348,9 @@ acpi_ns_lookup ( | |||
350 | * Device/Method, etc.) It could be a Package or other object node. | 348 | * Device/Method, etc.) It could be a Package or other object node. |
351 | * Backup up the tree to find the containing scope node. | 349 | * Backup up the tree to find the containing scope node. |
352 | */ | 350 | */ |
353 | while (!acpi_ns_opens_scope (prefix_node->type) && | 351 | while (!acpi_ns_opens_scope(prefix_node->type) && |
354 | prefix_node->type != ACPI_TYPE_ANY) { | 352 | prefix_node->type != ACPI_TYPE_ANY) { |
355 | prefix_node = acpi_ns_get_parent_node (prefix_node); | 353 | prefix_node = acpi_ns_get_parent_node(prefix_node); |
356 | } | 354 | } |
357 | } | 355 | } |
358 | 356 | ||
@@ -367,13 +365,13 @@ acpi_ns_lookup ( | |||
367 | /* A Null name_path is allowed and refers to the root */ | 365 | /* A Null name_path is allowed and refers to the root */ |
368 | 366 | ||
369 | num_segments = 0; | 367 | num_segments = 0; |
370 | this_node = acpi_gbl_root_node; | 368 | this_node = acpi_gbl_root_node; |
371 | path = ""; | 369 | path = ""; |
372 | 370 | ||
373 | ACPI_DEBUG_PRINT ((ACPI_DB_NAMES, | 371 | ACPI_DEBUG_PRINT((ACPI_DB_NAMES, |
374 | "Null Pathname (Zero segments), Flags=%X\n", flags)); | 372 | "Null Pathname (Zero segments), Flags=%X\n", |
375 | } | 373 | flags)); |
376 | else { | 374 | } else { |
377 | /* | 375 | /* |
378 | * Name pointer is valid (and must be in internal name format) | 376 | * Name pointer is valid (and must be in internal name format) |
379 | * | 377 | * |
@@ -397,15 +395,16 @@ acpi_ns_lookup ( | |||
397 | 395 | ||
398 | path++; | 396 | path++; |
399 | 397 | ||
400 | ACPI_DEBUG_PRINT ((ACPI_DB_NAMES, | 398 | ACPI_DEBUG_PRINT((ACPI_DB_NAMES, |
401 | "Path is absolute from root [%p]\n", this_node)); | 399 | "Path is absolute from root [%p]\n", |
402 | } | 400 | this_node)); |
403 | else { | 401 | } else { |
404 | /* Pathname is relative to current scope, start there */ | 402 | /* Pathname is relative to current scope, start there */ |
405 | 403 | ||
406 | ACPI_DEBUG_PRINT ((ACPI_DB_NAMES, | 404 | ACPI_DEBUG_PRINT((ACPI_DB_NAMES, |
407 | "Searching relative to prefix scope [%4.4s] (%p)\n", | 405 | "Searching relative to prefix scope [%4.4s] (%p)\n", |
408 | acpi_ut_get_node_name (prefix_node), prefix_node)); | 406 | acpi_ut_get_node_name(prefix_node), |
407 | prefix_node)); | ||
409 | 408 | ||
410 | /* | 409 | /* |
411 | * Handle multiple Parent Prefixes (carat) by just getting | 410 | * Handle multiple Parent Prefixes (carat) by just getting |
@@ -426,20 +425,20 @@ acpi_ns_lookup ( | |||
426 | /* Backup to the parent node */ | 425 | /* Backup to the parent node */ |
427 | 426 | ||
428 | num_carats++; | 427 | num_carats++; |
429 | this_node = acpi_ns_get_parent_node (this_node); | 428 | this_node = acpi_ns_get_parent_node(this_node); |
430 | if (!this_node) { | 429 | if (!this_node) { |
431 | /* Current scope has no parent scope */ | 430 | /* Current scope has no parent scope */ |
432 | 431 | ||
433 | ACPI_REPORT_ERROR ( | 432 | ACPI_REPORT_ERROR(("ACPI path has too many parent prefixes (^) - reached beyond root node\n")); |
434 | ("ACPI path has too many parent prefixes (^) - reached beyond root node\n")); | 433 | return_ACPI_STATUS(AE_NOT_FOUND); |
435 | return_ACPI_STATUS (AE_NOT_FOUND); | ||
436 | } | 434 | } |
437 | } | 435 | } |
438 | 436 | ||
439 | if (search_parent_flag == ACPI_NS_NO_UPSEARCH) { | 437 | if (search_parent_flag == ACPI_NS_NO_UPSEARCH) { |
440 | ACPI_DEBUG_PRINT ((ACPI_DB_NAMES, | 438 | ACPI_DEBUG_PRINT((ACPI_DB_NAMES, |
441 | "Search scope is [%4.4s], path has %d carat(s)\n", | 439 | "Search scope is [%4.4s], path has %d carat(s)\n", |
442 | acpi_ut_get_node_name (this_node), num_carats)); | 440 | acpi_ut_get_node_name |
441 | (this_node), num_carats)); | ||
443 | } | 442 | } |
444 | } | 443 | } |
445 | 444 | ||
@@ -465,9 +464,9 @@ acpi_ns_lookup ( | |||
465 | num_segments = 0; | 464 | num_segments = 0; |
466 | type = this_node->type; | 465 | type = this_node->type; |
467 | 466 | ||
468 | ACPI_DEBUG_PRINT ((ACPI_DB_NAMES, | 467 | ACPI_DEBUG_PRINT((ACPI_DB_NAMES, |
469 | "Prefix-only Pathname (Zero name segments), Flags=%X\n", | 468 | "Prefix-only Pathname (Zero name segments), Flags=%X\n", |
470 | flags)); | 469 | flags)); |
471 | break; | 470 | break; |
472 | 471 | ||
473 | case AML_DUAL_NAME_PREFIX: | 472 | case AML_DUAL_NAME_PREFIX: |
@@ -481,8 +480,9 @@ acpi_ns_lookup ( | |||
481 | num_segments = 2; | 480 | num_segments = 2; |
482 | path++; | 481 | path++; |
483 | 482 | ||
484 | ACPI_DEBUG_PRINT ((ACPI_DB_NAMES, | 483 | ACPI_DEBUG_PRINT((ACPI_DB_NAMES, |
485 | "Dual Pathname (2 segments, Flags=%X)\n", flags)); | 484 | "Dual Pathname (2 segments, Flags=%X)\n", |
485 | flags)); | ||
486 | break; | 486 | break; |
487 | 487 | ||
488 | case AML_MULTI_NAME_PREFIX_OP: | 488 | case AML_MULTI_NAME_PREFIX_OP: |
@@ -494,12 +494,12 @@ acpi_ns_lookup ( | |||
494 | /* Extract segment count, point to first name segment */ | 494 | /* Extract segment count, point to first name segment */ |
495 | 495 | ||
496 | path++; | 496 | path++; |
497 | num_segments = (u32) (u8) *path; | 497 | num_segments = (u32) (u8) * path; |
498 | path++; | 498 | path++; |
499 | 499 | ||
500 | ACPI_DEBUG_PRINT ((ACPI_DB_NAMES, | 500 | ACPI_DEBUG_PRINT((ACPI_DB_NAMES, |
501 | "Multi Pathname (%d Segments, Flags=%X) \n", | 501 | "Multi Pathname (%d Segments, Flags=%X) \n", |
502 | num_segments, flags)); | 502 | num_segments, flags)); |
503 | break; | 503 | break; |
504 | 504 | ||
505 | default: | 505 | default: |
@@ -509,15 +509,15 @@ acpi_ns_lookup ( | |||
509 | */ | 509 | */ |
510 | num_segments = 1; | 510 | num_segments = 1; |
511 | 511 | ||
512 | ACPI_DEBUG_PRINT ((ACPI_DB_NAMES, | 512 | ACPI_DEBUG_PRINT((ACPI_DB_NAMES, |
513 | "Simple Pathname (1 segment, Flags=%X)\n", flags)); | 513 | "Simple Pathname (1 segment, Flags=%X)\n", |
514 | flags)); | ||
514 | break; | 515 | break; |
515 | } | 516 | } |
516 | 517 | ||
517 | ACPI_DEBUG_EXEC (acpi_ns_print_pathname (num_segments, path)); | 518 | ACPI_DEBUG_EXEC(acpi_ns_print_pathname(num_segments, path)); |
518 | } | 519 | } |
519 | 520 | ||
520 | |||
521 | /* | 521 | /* |
522 | * Search namespace for each segment of the name. Loop through and | 522 | * Search namespace for each segment of the name. Loop through and |
523 | * verify (or add to the namespace) each name segment. | 523 | * verify (or add to the namespace) each name segment. |
@@ -541,7 +541,7 @@ acpi_ns_lookup ( | |||
541 | * requested it AND we have a single, non-fully-qualified name_seg | 541 | * requested it AND we have a single, non-fully-qualified name_seg |
542 | */ | 542 | */ |
543 | if ((search_parent_flag != ACPI_NS_NO_UPSEARCH) && | 543 | if ((search_parent_flag != ACPI_NS_NO_UPSEARCH) && |
544 | (flags & ACPI_NS_SEARCH_PARENT)) { | 544 | (flags & ACPI_NS_SEARCH_PARENT)) { |
545 | local_flags |= ACPI_NS_SEARCH_PARENT; | 545 | local_flags |= ACPI_NS_SEARCH_PARENT; |
546 | } | 546 | } |
547 | 547 | ||
@@ -554,24 +554,28 @@ acpi_ns_lookup ( | |||
554 | 554 | ||
555 | /* Extract one ACPI name from the front of the pathname */ | 555 | /* Extract one ACPI name from the front of the pathname */ |
556 | 556 | ||
557 | ACPI_MOVE_32_TO_32 (&simple_name, path); | 557 | ACPI_MOVE_32_TO_32(&simple_name, path); |
558 | 558 | ||
559 | /* Try to find the single (4 character) ACPI name */ | 559 | /* Try to find the single (4 character) ACPI name */ |
560 | 560 | ||
561 | status = acpi_ns_search_and_enter (simple_name, walk_state, current_node, | 561 | status = |
562 | interpreter_mode, this_search_type, local_flags, &this_node); | 562 | acpi_ns_search_and_enter(simple_name, walk_state, |
563 | if (ACPI_FAILURE (status)) { | 563 | current_node, interpreter_mode, |
564 | this_search_type, local_flags, | ||
565 | &this_node); | ||
566 | if (ACPI_FAILURE(status)) { | ||
564 | if (status == AE_NOT_FOUND) { | 567 | if (status == AE_NOT_FOUND) { |
565 | /* Name not found in ACPI namespace */ | 568 | /* Name not found in ACPI namespace */ |
566 | 569 | ||
567 | ACPI_DEBUG_PRINT ((ACPI_DB_NAMES, | 570 | ACPI_DEBUG_PRINT((ACPI_DB_NAMES, |
568 | "Name [%4.4s] not found in scope [%4.4s] %p\n", | 571 | "Name [%4.4s] not found in scope [%4.4s] %p\n", |
569 | (char *) &simple_name, (char *) ¤t_node->name, | 572 | (char *)&simple_name, |
570 | current_node)); | 573 | (char *)¤t_node->name, |
574 | current_node)); | ||
571 | } | 575 | } |
572 | 576 | ||
573 | *return_node = this_node; | 577 | *return_node = this_node; |
574 | return_ACPI_STATUS (status); | 578 | return_ACPI_STATUS(status); |
575 | } | 579 | } |
576 | 580 | ||
577 | /* | 581 | /* |
@@ -587,19 +591,16 @@ acpi_ns_lookup ( | |||
587 | * | 591 | * |
588 | * Then we have a type mismatch. Just warn and ignore it. | 592 | * Then we have a type mismatch. Just warn and ignore it. |
589 | */ | 593 | */ |
590 | if ((num_segments == 0) && | 594 | if ((num_segments == 0) && |
591 | (type_to_check_for != ACPI_TYPE_ANY) && | 595 | (type_to_check_for != ACPI_TYPE_ANY) && |
592 | (type_to_check_for != ACPI_TYPE_LOCAL_ALIAS) && | 596 | (type_to_check_for != ACPI_TYPE_LOCAL_ALIAS) && |
593 | (type_to_check_for != ACPI_TYPE_LOCAL_METHOD_ALIAS) && | 597 | (type_to_check_for != ACPI_TYPE_LOCAL_METHOD_ALIAS) && |
594 | (type_to_check_for != ACPI_TYPE_LOCAL_SCOPE) && | 598 | (type_to_check_for != ACPI_TYPE_LOCAL_SCOPE) && |
595 | (this_node->type != ACPI_TYPE_ANY) && | 599 | (this_node->type != ACPI_TYPE_ANY) && |
596 | (this_node->type != type_to_check_for)) { | 600 | (this_node->type != type_to_check_for)) { |
597 | /* Complain about a type mismatch */ | 601 | /* Complain about a type mismatch */ |
598 | 602 | ||
599 | ACPI_REPORT_WARNING ( | 603 | ACPI_REPORT_WARNING(("ns_lookup: Type mismatch on %4.4s (%s), searching for (%s)\n", (char *)&simple_name, acpi_ut_get_type_name(this_node->type), acpi_ut_get_type_name(type_to_check_for))); |
600 | ("ns_lookup: Type mismatch on %4.4s (%s), searching for (%s)\n", | ||
601 | (char *) &simple_name, acpi_ut_get_type_name (this_node->type), | ||
602 | acpi_ut_get_type_name (type_to_check_for))); | ||
603 | } | 604 | } |
604 | 605 | ||
605 | /* | 606 | /* |
@@ -625,15 +626,16 @@ acpi_ns_lookup ( | |||
625 | * If entry is a type which opens a scope, push the new scope on the | 626 | * If entry is a type which opens a scope, push the new scope on the |
626 | * scope stack. | 627 | * scope stack. |
627 | */ | 628 | */ |
628 | if (acpi_ns_opens_scope (type)) { | 629 | if (acpi_ns_opens_scope(type)) { |
629 | status = acpi_ds_scope_stack_push (this_node, type, walk_state); | 630 | status = |
630 | if (ACPI_FAILURE (status)) { | 631 | acpi_ds_scope_stack_push(this_node, type, |
631 | return_ACPI_STATUS (status); | 632 | walk_state); |
633 | if (ACPI_FAILURE(status)) { | ||
634 | return_ACPI_STATUS(status); | ||
632 | } | 635 | } |
633 | } | 636 | } |
634 | } | 637 | } |
635 | 638 | ||
636 | *return_node = this_node; | 639 | *return_node = this_node; |
637 | return_ACPI_STATUS (AE_OK); | 640 | return_ACPI_STATUS(AE_OK); |
638 | } | 641 | } |
639 | |||
diff --git a/drivers/acpi/namespace/nsalloc.c b/drivers/acpi/namespace/nsalloc.c index 21d560decbf9..cc7a85f8cfe6 100644 --- a/drivers/acpi/namespace/nsalloc.c +++ b/drivers/acpi/namespace/nsalloc.c | |||
@@ -41,20 +41,14 @@ | |||
41 | * POSSIBILITY OF SUCH DAMAGES. | 41 | * POSSIBILITY OF SUCH DAMAGES. |
42 | */ | 42 | */ |
43 | 43 | ||
44 | |||
45 | #include <acpi/acpi.h> | 44 | #include <acpi/acpi.h> |
46 | #include <acpi/acnamesp.h> | 45 | #include <acpi/acnamesp.h> |
47 | 46 | ||
48 | |||
49 | #define _COMPONENT ACPI_NAMESPACE | 47 | #define _COMPONENT ACPI_NAMESPACE |
50 | ACPI_MODULE_NAME ("nsalloc") | 48 | ACPI_MODULE_NAME("nsalloc") |
51 | 49 | ||
52 | /* Local prototypes */ | 50 | /* Local prototypes */ |
53 | 51 | static void acpi_ns_remove_reference(struct acpi_namespace_node *node); | |
54 | static void | ||
55 | acpi_ns_remove_reference ( | ||
56 | struct acpi_namespace_node *node); | ||
57 | |||
58 | 52 | ||
59 | /******************************************************************************* | 53 | /******************************************************************************* |
60 | * | 54 | * |
@@ -68,31 +62,26 @@ acpi_ns_remove_reference ( | |||
68 | * | 62 | * |
69 | ******************************************************************************/ | 63 | ******************************************************************************/ |
70 | 64 | ||
71 | struct acpi_namespace_node * | 65 | struct acpi_namespace_node *acpi_ns_create_node(u32 name) |
72 | acpi_ns_create_node ( | ||
73 | u32 name) | ||
74 | { | 66 | { |
75 | struct acpi_namespace_node *node; | 67 | struct acpi_namespace_node *node; |
76 | |||
77 | 68 | ||
78 | ACPI_FUNCTION_TRACE ("ns_create_node"); | 69 | ACPI_FUNCTION_TRACE("ns_create_node"); |
79 | 70 | ||
80 | 71 | node = ACPI_MEM_CALLOCATE(sizeof(struct acpi_namespace_node)); | |
81 | node = ACPI_MEM_CALLOCATE (sizeof (struct acpi_namespace_node)); | ||
82 | if (!node) { | 72 | if (!node) { |
83 | return_PTR (NULL); | 73 | return_PTR(NULL); |
84 | } | 74 | } |
85 | 75 | ||
86 | ACPI_MEM_TRACKING (acpi_gbl_ns_node_list->total_allocated++); | 76 | ACPI_MEM_TRACKING(acpi_gbl_ns_node_list->total_allocated++); |
87 | 77 | ||
88 | node->name.integer = name; | 78 | node->name.integer = name; |
89 | node->reference_count = 1; | 79 | node->reference_count = 1; |
90 | ACPI_SET_DESCRIPTOR_TYPE (node, ACPI_DESC_TYPE_NAMED); | 80 | ACPI_SET_DESCRIPTOR_TYPE(node, ACPI_DESC_TYPE_NAMED); |
91 | 81 | ||
92 | return_PTR (node); | 82 | return_PTR(node); |
93 | } | 83 | } |
94 | 84 | ||
95 | |||
96 | /******************************************************************************* | 85 | /******************************************************************************* |
97 | * | 86 | * |
98 | * FUNCTION: acpi_ns_delete_node | 87 | * FUNCTION: acpi_ns_delete_node |
@@ -105,19 +94,15 @@ acpi_ns_create_node ( | |||
105 | * | 94 | * |
106 | ******************************************************************************/ | 95 | ******************************************************************************/ |
107 | 96 | ||
108 | void | 97 | void acpi_ns_delete_node(struct acpi_namespace_node *node) |
109 | acpi_ns_delete_node ( | ||
110 | struct acpi_namespace_node *node) | ||
111 | { | 98 | { |
112 | struct acpi_namespace_node *parent_node; | 99 | struct acpi_namespace_node *parent_node; |
113 | struct acpi_namespace_node *prev_node; | 100 | struct acpi_namespace_node *prev_node; |
114 | struct acpi_namespace_node *next_node; | 101 | struct acpi_namespace_node *next_node; |
115 | |||
116 | |||
117 | ACPI_FUNCTION_TRACE_PTR ("ns_delete_node", node); | ||
118 | 102 | ||
103 | ACPI_FUNCTION_TRACE_PTR("ns_delete_node", node); | ||
119 | 104 | ||
120 | parent_node = acpi_ns_get_parent_node (node); | 105 | parent_node = acpi_ns_get_parent_node(node); |
121 | 106 | ||
122 | prev_node = NULL; | 107 | prev_node = NULL; |
123 | next_node = parent_node->child; | 108 | next_node = parent_node->child; |
@@ -136,32 +121,29 @@ acpi_ns_delete_node ( | |||
136 | if (next_node->flags & ANOBJ_END_OF_PEER_LIST) { | 121 | if (next_node->flags & ANOBJ_END_OF_PEER_LIST) { |
137 | prev_node->flags |= ANOBJ_END_OF_PEER_LIST; | 122 | prev_node->flags |= ANOBJ_END_OF_PEER_LIST; |
138 | } | 123 | } |
139 | } | 124 | } else { |
140 | else { | ||
141 | /* Node is first child (has no previous peer) */ | 125 | /* Node is first child (has no previous peer) */ |
142 | 126 | ||
143 | if (next_node->flags & ANOBJ_END_OF_PEER_LIST) { | 127 | if (next_node->flags & ANOBJ_END_OF_PEER_LIST) { |
144 | /* No peers at all */ | 128 | /* No peers at all */ |
145 | 129 | ||
146 | parent_node->child = NULL; | 130 | parent_node->child = NULL; |
147 | } | 131 | } else { /* Link peer list to parent */ |
148 | else { /* Link peer list to parent */ | ||
149 | 132 | ||
150 | parent_node->child = next_node->peer; | 133 | parent_node->child = next_node->peer; |
151 | } | 134 | } |
152 | } | 135 | } |
153 | 136 | ||
154 | ACPI_MEM_TRACKING (acpi_gbl_ns_node_list->total_freed++); | 137 | ACPI_MEM_TRACKING(acpi_gbl_ns_node_list->total_freed++); |
155 | 138 | ||
156 | /* | 139 | /* |
157 | * Detach an object if there is one then delete the node | 140 | * Detach an object if there is one then delete the node |
158 | */ | 141 | */ |
159 | acpi_ns_detach_object (node); | 142 | acpi_ns_detach_object(node); |
160 | ACPI_MEM_FREE (node); | 143 | ACPI_MEM_FREE(node); |
161 | return_VOID; | 144 | return_VOID; |
162 | } | 145 | } |
163 | 146 | ||
164 | |||
165 | /******************************************************************************* | 147 | /******************************************************************************* |
166 | * | 148 | * |
167 | * FUNCTION: acpi_ns_install_node | 149 | * FUNCTION: acpi_ns_install_node |
@@ -182,19 +164,14 @@ acpi_ns_delete_node ( | |||
182 | * | 164 | * |
183 | ******************************************************************************/ | 165 | ******************************************************************************/ |
184 | 166 | ||
185 | void | 167 | void acpi_ns_install_node(struct acpi_walk_state *walk_state, struct acpi_namespace_node *parent_node, /* Parent */ |
186 | acpi_ns_install_node ( | 168 | struct acpi_namespace_node *node, /* New Child */ |
187 | struct acpi_walk_state *walk_state, | 169 | acpi_object_type type) |
188 | struct acpi_namespace_node *parent_node, /* Parent */ | ||
189 | struct acpi_namespace_node *node, /* New Child*/ | ||
190 | acpi_object_type type) | ||
191 | { | 170 | { |
192 | acpi_owner_id owner_id = 0; | 171 | acpi_owner_id owner_id = 0; |
193 | struct acpi_namespace_node *child_node; | 172 | struct acpi_namespace_node *child_node; |
194 | |||
195 | |||
196 | ACPI_FUNCTION_TRACE ("ns_install_node"); | ||
197 | 173 | ||
174 | ACPI_FUNCTION_TRACE("ns_install_node"); | ||
198 | 175 | ||
199 | /* | 176 | /* |
200 | * Get the owner ID from the Walk state | 177 | * Get the owner ID from the Walk state |
@@ -212,8 +189,7 @@ acpi_ns_install_node ( | |||
212 | parent_node->child = node; | 189 | parent_node->child = node; |
213 | node->flags |= ANOBJ_END_OF_PEER_LIST; | 190 | node->flags |= ANOBJ_END_OF_PEER_LIST; |
214 | node->peer = parent_node; | 191 | node->peer = parent_node; |
215 | } | 192 | } else { |
216 | else { | ||
217 | while (!(child_node->flags & ANOBJ_END_OF_PEER_LIST)) { | 193 | while (!(child_node->flags & ANOBJ_END_OF_PEER_LIST)) { |
218 | child_node = child_node->peer; | 194 | child_node = child_node->peer; |
219 | } | 195 | } |
@@ -232,24 +208,25 @@ acpi_ns_install_node ( | |||
232 | node->owner_id = owner_id; | 208 | node->owner_id = owner_id; |
233 | node->type = (u8) type; | 209 | node->type = (u8) type; |
234 | 210 | ||
235 | ACPI_DEBUG_PRINT ((ACPI_DB_NAMES, | 211 | ACPI_DEBUG_PRINT((ACPI_DB_NAMES, |
236 | "%4.4s (%s) [Node %p Owner %X] added to %4.4s (%s) [Node %p]\n", | 212 | "%4.4s (%s) [Node %p Owner %X] added to %4.4s (%s) [Node %p]\n", |
237 | acpi_ut_get_node_name (node), acpi_ut_get_type_name (node->type), node, owner_id, | 213 | acpi_ut_get_node_name(node), |
238 | acpi_ut_get_node_name (parent_node), acpi_ut_get_type_name (parent_node->type), | 214 | acpi_ut_get_type_name(node->type), node, owner_id, |
239 | parent_node)); | 215 | acpi_ut_get_node_name(parent_node), |
216 | acpi_ut_get_type_name(parent_node->type), | ||
217 | parent_node)); | ||
240 | 218 | ||
241 | /* | 219 | /* |
242 | * Increment the reference count(s) of all parents up to | 220 | * Increment the reference count(s) of all parents up to |
243 | * the root! | 221 | * the root! |
244 | */ | 222 | */ |
245 | while ((node = acpi_ns_get_parent_node (node)) != NULL) { | 223 | while ((node = acpi_ns_get_parent_node(node)) != NULL) { |
246 | node->reference_count++; | 224 | node->reference_count++; |
247 | } | 225 | } |
248 | 226 | ||
249 | return_VOID; | 227 | return_VOID; |
250 | } | 228 | } |
251 | 229 | ||
252 | |||
253 | /******************************************************************************* | 230 | /******************************************************************************* |
254 | * | 231 | * |
255 | * FUNCTION: acpi_ns_delete_children | 232 | * FUNCTION: acpi_ns_delete_children |
@@ -263,18 +240,14 @@ acpi_ns_install_node ( | |||
263 | * | 240 | * |
264 | ******************************************************************************/ | 241 | ******************************************************************************/ |
265 | 242 | ||
266 | void | 243 | void acpi_ns_delete_children(struct acpi_namespace_node *parent_node) |
267 | acpi_ns_delete_children ( | ||
268 | struct acpi_namespace_node *parent_node) | ||
269 | { | 244 | { |
270 | struct acpi_namespace_node *child_node; | 245 | struct acpi_namespace_node *child_node; |
271 | struct acpi_namespace_node *next_node; | 246 | struct acpi_namespace_node *next_node; |
272 | struct acpi_namespace_node *node; | 247 | struct acpi_namespace_node *node; |
273 | u8 flags; | 248 | u8 flags; |
274 | |||
275 | |||
276 | ACPI_FUNCTION_TRACE_PTR ("ns_delete_children", parent_node); | ||
277 | 249 | ||
250 | ACPI_FUNCTION_TRACE_PTR("ns_delete_children", parent_node); | ||
278 | 251 | ||
279 | if (!parent_node) { | 252 | if (!parent_node) { |
280 | return_VOID; | 253 | return_VOID; |
@@ -293,48 +266,48 @@ acpi_ns_delete_children ( | |||
293 | do { | 266 | do { |
294 | /* Get the things we need */ | 267 | /* Get the things we need */ |
295 | 268 | ||
296 | next_node = child_node->peer; | 269 | next_node = child_node->peer; |
297 | flags = child_node->flags; | 270 | flags = child_node->flags; |
298 | 271 | ||
299 | /* Grandchildren should have all been deleted already */ | 272 | /* Grandchildren should have all been deleted already */ |
300 | 273 | ||
301 | if (child_node->child) { | 274 | if (child_node->child) { |
302 | ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, "Found a grandchild! P=%p C=%p\n", | 275 | ACPI_DEBUG_PRINT((ACPI_DB_ERROR, |
303 | parent_node, child_node)); | 276 | "Found a grandchild! P=%p C=%p\n", |
277 | parent_node, child_node)); | ||
304 | } | 278 | } |
305 | 279 | ||
306 | /* Now we can free this child object */ | 280 | /* Now we can free this child object */ |
307 | 281 | ||
308 | ACPI_MEM_TRACKING (acpi_gbl_ns_node_list->total_freed++); | 282 | ACPI_MEM_TRACKING(acpi_gbl_ns_node_list->total_freed++); |
309 | 283 | ||
310 | ACPI_DEBUG_PRINT ((ACPI_DB_ALLOCATIONS, "Object %p, Remaining %X\n", | 284 | ACPI_DEBUG_PRINT((ACPI_DB_ALLOCATIONS, |
311 | child_node, acpi_gbl_current_node_count)); | 285 | "Object %p, Remaining %X\n", child_node, |
286 | acpi_gbl_current_node_count)); | ||
312 | 287 | ||
313 | /* | 288 | /* |
314 | * Detach an object if there is one, then free the child node | 289 | * Detach an object if there is one, then free the child node |
315 | */ | 290 | */ |
316 | acpi_ns_detach_object (child_node); | 291 | acpi_ns_detach_object(child_node); |
317 | 292 | ||
318 | /* | 293 | /* |
319 | * Decrement the reference count(s) of all parents up to | 294 | * Decrement the reference count(s) of all parents up to |
320 | * the root! (counts were incremented when the node was created) | 295 | * the root! (counts were incremented when the node was created) |
321 | */ | 296 | */ |
322 | node = child_node; | 297 | node = child_node; |
323 | while ((node = acpi_ns_get_parent_node (node)) != NULL) { | 298 | while ((node = acpi_ns_get_parent_node(node)) != NULL) { |
324 | node->reference_count--; | 299 | node->reference_count--; |
325 | } | 300 | } |
326 | 301 | ||
327 | /* There should be only one reference remaining on this node */ | 302 | /* There should be only one reference remaining on this node */ |
328 | 303 | ||
329 | if (child_node->reference_count != 1) { | 304 | if (child_node->reference_count != 1) { |
330 | ACPI_REPORT_WARNING (( | 305 | ACPI_REPORT_WARNING(("Existing references (%d) on node being deleted (%p)\n", child_node->reference_count, child_node)); |
331 | "Existing references (%d) on node being deleted (%p)\n", | ||
332 | child_node->reference_count, child_node)); | ||
333 | } | 306 | } |
334 | 307 | ||
335 | /* Now we can delete the node */ | 308 | /* Now we can delete the node */ |
336 | 309 | ||
337 | ACPI_MEM_FREE (child_node); | 310 | ACPI_MEM_FREE(child_node); |
338 | 311 | ||
339 | /* And move on to the next child in the list */ | 312 | /* And move on to the next child in the list */ |
340 | 313 | ||
@@ -342,7 +315,6 @@ acpi_ns_delete_children ( | |||
342 | 315 | ||
343 | } while (!(flags & ANOBJ_END_OF_PEER_LIST)); | 316 | } while (!(flags & ANOBJ_END_OF_PEER_LIST)); |
344 | 317 | ||
345 | |||
346 | /* Clear the parent's child pointer */ | 318 | /* Clear the parent's child pointer */ |
347 | 319 | ||
348 | parent_node->child = NULL; | 320 | parent_node->child = NULL; |
@@ -350,7 +322,6 @@ acpi_ns_delete_children ( | |||
350 | return_VOID; | 322 | return_VOID; |
351 | } | 323 | } |
352 | 324 | ||
353 | |||
354 | /******************************************************************************* | 325 | /******************************************************************************* |
355 | * | 326 | * |
356 | * FUNCTION: acpi_ns_delete_namespace_subtree | 327 | * FUNCTION: acpi_ns_delete_namespace_subtree |
@@ -364,16 +335,12 @@ acpi_ns_delete_children ( | |||
364 | * | 335 | * |
365 | ******************************************************************************/ | 336 | ******************************************************************************/ |
366 | 337 | ||
367 | void | 338 | void acpi_ns_delete_namespace_subtree(struct acpi_namespace_node *parent_node) |
368 | acpi_ns_delete_namespace_subtree ( | ||
369 | struct acpi_namespace_node *parent_node) | ||
370 | { | 339 | { |
371 | struct acpi_namespace_node *child_node = NULL; | 340 | struct acpi_namespace_node *child_node = NULL; |
372 | u32 level = 1; | 341 | u32 level = 1; |
373 | |||
374 | |||
375 | ACPI_FUNCTION_TRACE ("ns_delete_namespace_subtree"); | ||
376 | 342 | ||
343 | ACPI_FUNCTION_TRACE("ns_delete_namespace_subtree"); | ||
377 | 344 | ||
378 | if (!parent_node) { | 345 | if (!parent_node) { |
379 | return_VOID; | 346 | return_VOID; |
@@ -386,16 +353,17 @@ acpi_ns_delete_namespace_subtree ( | |||
386 | while (level > 0) { | 353 | while (level > 0) { |
387 | /* Get the next node in this scope (NULL if none) */ | 354 | /* Get the next node in this scope (NULL if none) */ |
388 | 355 | ||
389 | child_node = acpi_ns_get_next_node (ACPI_TYPE_ANY, parent_node, | 356 | child_node = acpi_ns_get_next_node(ACPI_TYPE_ANY, parent_node, |
390 | child_node); | 357 | child_node); |
391 | if (child_node) { | 358 | if (child_node) { |
392 | /* Found a child node - detach any attached object */ | 359 | /* Found a child node - detach any attached object */ |
393 | 360 | ||
394 | acpi_ns_detach_object (child_node); | 361 | acpi_ns_detach_object(child_node); |
395 | 362 | ||
396 | /* Check if this node has any children */ | 363 | /* Check if this node has any children */ |
397 | 364 | ||
398 | if (acpi_ns_get_next_node (ACPI_TYPE_ANY, child_node, NULL)) { | 365 | if (acpi_ns_get_next_node |
366 | (ACPI_TYPE_ANY, child_node, NULL)) { | ||
399 | /* | 367 | /* |
400 | * There is at least one child of this node, | 368 | * There is at least one child of this node, |
401 | * visit the node | 369 | * visit the node |
@@ -404,8 +372,7 @@ acpi_ns_delete_namespace_subtree ( | |||
404 | parent_node = child_node; | 372 | parent_node = child_node; |
405 | child_node = NULL; | 373 | child_node = NULL; |
406 | } | 374 | } |
407 | } | 375 | } else { |
408 | else { | ||
409 | /* | 376 | /* |
410 | * No more children of this parent node. | 377 | * No more children of this parent node. |
411 | * Move up to the grandparent. | 378 | * Move up to the grandparent. |
@@ -416,7 +383,7 @@ acpi_ns_delete_namespace_subtree ( | |||
416 | * Now delete all of the children of this parent | 383 | * Now delete all of the children of this parent |
417 | * all at the same time. | 384 | * all at the same time. |
418 | */ | 385 | */ |
419 | acpi_ns_delete_children (parent_node); | 386 | acpi_ns_delete_children(parent_node); |
420 | 387 | ||
421 | /* New "last child" is this parent node */ | 388 | /* New "last child" is this parent node */ |
422 | 389 | ||
@@ -424,14 +391,13 @@ acpi_ns_delete_namespace_subtree ( | |||
424 | 391 | ||
425 | /* Move up the tree to the grandparent */ | 392 | /* Move up the tree to the grandparent */ |
426 | 393 | ||
427 | parent_node = acpi_ns_get_parent_node (parent_node); | 394 | parent_node = acpi_ns_get_parent_node(parent_node); |
428 | } | 395 | } |
429 | } | 396 | } |
430 | 397 | ||
431 | return_VOID; | 398 | return_VOID; |
432 | } | 399 | } |
433 | 400 | ||
434 | |||
435 | /******************************************************************************* | 401 | /******************************************************************************* |
436 | * | 402 | * |
437 | * FUNCTION: acpi_ns_remove_reference | 403 | * FUNCTION: acpi_ns_remove_reference |
@@ -447,16 +413,12 @@ acpi_ns_delete_namespace_subtree ( | |||
447 | * | 413 | * |
448 | ******************************************************************************/ | 414 | ******************************************************************************/ |
449 | 415 | ||
450 | static void | 416 | static void acpi_ns_remove_reference(struct acpi_namespace_node *node) |
451 | acpi_ns_remove_reference ( | ||
452 | struct acpi_namespace_node *node) | ||
453 | { | 417 | { |
454 | struct acpi_namespace_node *parent_node; | 418 | struct acpi_namespace_node *parent_node; |
455 | struct acpi_namespace_node *this_node; | 419 | struct acpi_namespace_node *this_node; |
456 | |||
457 | |||
458 | ACPI_FUNCTION_ENTRY (); | ||
459 | 420 | ||
421 | ACPI_FUNCTION_ENTRY(); | ||
460 | 422 | ||
461 | /* | 423 | /* |
462 | * Decrement the reference count(s) of this node and all | 424 | * Decrement the reference count(s) of this node and all |
@@ -466,7 +428,7 @@ acpi_ns_remove_reference ( | |||
466 | while (this_node) { | 428 | while (this_node) { |
467 | /* Prepare to move up to parent */ | 429 | /* Prepare to move up to parent */ |
468 | 430 | ||
469 | parent_node = acpi_ns_get_parent_node (this_node); | 431 | parent_node = acpi_ns_get_parent_node(this_node); |
470 | 432 | ||
471 | /* Decrement the reference count on this node */ | 433 | /* Decrement the reference count on this node */ |
472 | 434 | ||
@@ -477,15 +439,14 @@ acpi_ns_remove_reference ( | |||
477 | if (!this_node->reference_count) { | 439 | if (!this_node->reference_count) { |
478 | /* Delete all children and delete the node */ | 440 | /* Delete all children and delete the node */ |
479 | 441 | ||
480 | acpi_ns_delete_children (this_node); | 442 | acpi_ns_delete_children(this_node); |
481 | acpi_ns_delete_node (this_node); | 443 | acpi_ns_delete_node(this_node); |
482 | } | 444 | } |
483 | 445 | ||
484 | this_node = parent_node; | 446 | this_node = parent_node; |
485 | } | 447 | } |
486 | } | 448 | } |
487 | 449 | ||
488 | |||
489 | /******************************************************************************* | 450 | /******************************************************************************* |
490 | * | 451 | * |
491 | * FUNCTION: acpi_ns_delete_namespace_by_owner | 452 | * FUNCTION: acpi_ns_delete_namespace_by_owner |
@@ -500,27 +461,23 @@ acpi_ns_remove_reference ( | |||
500 | * | 461 | * |
501 | ******************************************************************************/ | 462 | ******************************************************************************/ |
502 | 463 | ||
503 | void | 464 | void acpi_ns_delete_namespace_by_owner(acpi_owner_id owner_id) |
504 | acpi_ns_delete_namespace_by_owner ( | ||
505 | acpi_owner_id owner_id) | ||
506 | { | 465 | { |
507 | struct acpi_namespace_node *child_node; | 466 | struct acpi_namespace_node *child_node; |
508 | struct acpi_namespace_node *deletion_node; | 467 | struct acpi_namespace_node *deletion_node; |
509 | u32 level; | 468 | u32 level; |
510 | struct acpi_namespace_node *parent_node; | 469 | struct acpi_namespace_node *parent_node; |
511 | |||
512 | |||
513 | ACPI_FUNCTION_TRACE_U32 ("ns_delete_namespace_by_owner", owner_id); | ||
514 | 470 | ||
471 | ACPI_FUNCTION_TRACE_U32("ns_delete_namespace_by_owner", owner_id); | ||
515 | 472 | ||
516 | if (owner_id == 0) { | 473 | if (owner_id == 0) { |
517 | return_VOID; | 474 | return_VOID; |
518 | } | 475 | } |
519 | 476 | ||
520 | parent_node = acpi_gbl_root_node; | 477 | parent_node = acpi_gbl_root_node; |
521 | child_node = NULL; | 478 | child_node = NULL; |
522 | deletion_node = NULL; | 479 | deletion_node = NULL; |
523 | level = 1; | 480 | level = 1; |
524 | 481 | ||
525 | /* | 482 | /* |
526 | * Traverse the tree of nodes until we bubble back up | 483 | * Traverse the tree of nodes until we bubble back up |
@@ -531,10 +488,12 @@ acpi_ns_delete_namespace_by_owner ( | |||
531 | * Get the next child of this parent node. When child_node is NULL, | 488 | * Get the next child of this parent node. When child_node is NULL, |
532 | * the first child of the parent is returned | 489 | * the first child of the parent is returned |
533 | */ | 490 | */ |
534 | child_node = acpi_ns_get_next_node (ACPI_TYPE_ANY, parent_node, child_node); | 491 | child_node = |
492 | acpi_ns_get_next_node(ACPI_TYPE_ANY, parent_node, | ||
493 | child_node); | ||
535 | 494 | ||
536 | if (deletion_node) { | 495 | if (deletion_node) { |
537 | acpi_ns_remove_reference (deletion_node); | 496 | acpi_ns_remove_reference(deletion_node); |
538 | deletion_node = NULL; | 497 | deletion_node = NULL; |
539 | } | 498 | } |
540 | 499 | ||
@@ -542,12 +501,13 @@ acpi_ns_delete_namespace_by_owner ( | |||
542 | if (child_node->owner_id == owner_id) { | 501 | if (child_node->owner_id == owner_id) { |
543 | /* Found a matching child node - detach any attached object */ | 502 | /* Found a matching child node - detach any attached object */ |
544 | 503 | ||
545 | acpi_ns_detach_object (child_node); | 504 | acpi_ns_detach_object(child_node); |
546 | } | 505 | } |
547 | 506 | ||
548 | /* Check if this node has any children */ | 507 | /* Check if this node has any children */ |
549 | 508 | ||
550 | if (acpi_ns_get_next_node (ACPI_TYPE_ANY, child_node, NULL)) { | 509 | if (acpi_ns_get_next_node |
510 | (ACPI_TYPE_ANY, child_node, NULL)) { | ||
551 | /* | 511 | /* |
552 | * There is at least one child of this node, | 512 | * There is at least one child of this node, |
553 | * visit the node | 513 | * visit the node |
@@ -555,12 +515,10 @@ acpi_ns_delete_namespace_by_owner ( | |||
555 | level++; | 515 | level++; |
556 | parent_node = child_node; | 516 | parent_node = child_node; |
557 | child_node = NULL; | 517 | child_node = NULL; |
558 | } | 518 | } else if (child_node->owner_id == owner_id) { |
559 | else if (child_node->owner_id == owner_id) { | ||
560 | deletion_node = child_node; | 519 | deletion_node = child_node; |
561 | } | 520 | } |
562 | } | 521 | } else { |
563 | else { | ||
564 | /* | 522 | /* |
565 | * No more children of this parent node. | 523 | * No more children of this parent node. |
566 | * Move up to the grandparent. | 524 | * Move up to the grandparent. |
@@ -578,11 +536,9 @@ acpi_ns_delete_namespace_by_owner ( | |||
578 | 536 | ||
579 | /* Move up the tree to the grandparent */ | 537 | /* Move up the tree to the grandparent */ |
580 | 538 | ||
581 | parent_node = acpi_ns_get_parent_node (parent_node); | 539 | parent_node = acpi_ns_get_parent_node(parent_node); |
582 | } | 540 | } |
583 | } | 541 | } |
584 | 542 | ||
585 | return_VOID; | 543 | return_VOID; |
586 | } | 544 | } |
587 | |||
588 | |||
diff --git a/drivers/acpi/namespace/nsdump.c b/drivers/acpi/namespace/nsdump.c index 5d25add6b031..9faf1d5c86ed 100644 --- a/drivers/acpi/namespace/nsdump.c +++ b/drivers/acpi/namespace/nsdump.c | |||
@@ -41,31 +41,22 @@ | |||
41 | * POSSIBILITY OF SUCH DAMAGES. | 41 | * POSSIBILITY OF SUCH DAMAGES. |
42 | */ | 42 | */ |
43 | 43 | ||
44 | |||
45 | #include <acpi/acpi.h> | 44 | #include <acpi/acpi.h> |
46 | #include <acpi/acnamesp.h> | 45 | #include <acpi/acnamesp.h> |
47 | #include <acpi/acparser.h> | 46 | #include <acpi/acparser.h> |
48 | 47 | ||
49 | |||
50 | #define _COMPONENT ACPI_NAMESPACE | 48 | #define _COMPONENT ACPI_NAMESPACE |
51 | ACPI_MODULE_NAME ("nsdump") | 49 | ACPI_MODULE_NAME("nsdump") |
52 | 50 | ||
53 | /* Local prototypes */ | 51 | /* Local prototypes */ |
54 | |||
55 | #ifdef ACPI_OBSOLETE_FUNCTIONS | 52 | #ifdef ACPI_OBSOLETE_FUNCTIONS |
56 | void | 53 | void acpi_ns_dump_root_devices(void); |
57 | acpi_ns_dump_root_devices ( | ||
58 | void); | ||
59 | 54 | ||
60 | static acpi_status | 55 | static acpi_status |
61 | acpi_ns_dump_one_device ( | 56 | acpi_ns_dump_one_device(acpi_handle obj_handle, |
62 | acpi_handle obj_handle, | 57 | u32 level, void *context, void **return_value); |
63 | u32 level, | ||
64 | void *context, | ||
65 | void **return_value); | ||
66 | #endif | 58 | #endif |
67 | 59 | ||
68 | |||
69 | #if defined(ACPI_DEBUG_OUTPUT) || defined(ACPI_DEBUGGER) | 60 | #if defined(ACPI_DEBUG_OUTPUT) || defined(ACPI_DEBUGGER) |
70 | /******************************************************************************* | 61 | /******************************************************************************* |
71 | * | 62 | * |
@@ -80,43 +71,38 @@ acpi_ns_dump_one_device ( | |||
80 | * | 71 | * |
81 | ******************************************************************************/ | 72 | ******************************************************************************/ |
82 | 73 | ||
83 | void | 74 | void acpi_ns_print_pathname(u32 num_segments, char *pathname) |
84 | acpi_ns_print_pathname ( | ||
85 | u32 num_segments, | ||
86 | char *pathname) | ||
87 | { | 75 | { |
88 | acpi_native_uint i; | 76 | acpi_native_uint i; |
89 | 77 | ||
78 | ACPI_FUNCTION_NAME("ns_print_pathname"); | ||
90 | 79 | ||
91 | ACPI_FUNCTION_NAME ("ns_print_pathname"); | 80 | if (!(acpi_dbg_level & ACPI_LV_NAMES) |
92 | 81 | || !(acpi_dbg_layer & ACPI_NAMESPACE)) { | |
93 | |||
94 | if (!(acpi_dbg_level & ACPI_LV_NAMES) || !(acpi_dbg_layer & ACPI_NAMESPACE)) { | ||
95 | return; | 82 | return; |
96 | } | 83 | } |
97 | 84 | ||
98 | /* Print the entire name */ | 85 | /* Print the entire name */ |
99 | 86 | ||
100 | ACPI_DEBUG_PRINT ((ACPI_DB_NAMES, "[")); | 87 | ACPI_DEBUG_PRINT((ACPI_DB_NAMES, "[")); |
101 | 88 | ||
102 | while (num_segments) { | 89 | while (num_segments) { |
103 | for (i = 0; i < 4; i++) { | 90 | for (i = 0; i < 4; i++) { |
104 | ACPI_IS_PRINT (pathname[i]) ? | 91 | ACPI_IS_PRINT(pathname[i]) ? |
105 | acpi_os_printf ("%c", pathname[i]) : | 92 | acpi_os_printf("%c", pathname[i]) : |
106 | acpi_os_printf ("?"); | 93 | acpi_os_printf("?"); |
107 | } | 94 | } |
108 | 95 | ||
109 | pathname += ACPI_NAME_SIZE; | 96 | pathname += ACPI_NAME_SIZE; |
110 | num_segments--; | 97 | num_segments--; |
111 | if (num_segments) { | 98 | if (num_segments) { |
112 | acpi_os_printf ("."); | 99 | acpi_os_printf("."); |
113 | } | 100 | } |
114 | } | 101 | } |
115 | 102 | ||
116 | acpi_os_printf ("]\n"); | 103 | acpi_os_printf("]\n"); |
117 | } | 104 | } |
118 | 105 | ||
119 | |||
120 | /******************************************************************************* | 106 | /******************************************************************************* |
121 | * | 107 | * |
122 | * FUNCTION: acpi_ns_dump_pathname | 108 | * FUNCTION: acpi_ns_dump_pathname |
@@ -134,15 +120,10 @@ acpi_ns_print_pathname ( | |||
134 | ******************************************************************************/ | 120 | ******************************************************************************/ |
135 | 121 | ||
136 | void | 122 | void |
137 | acpi_ns_dump_pathname ( | 123 | acpi_ns_dump_pathname(acpi_handle handle, char *msg, u32 level, u32 component) |
138 | acpi_handle handle, | ||
139 | char *msg, | ||
140 | u32 level, | ||
141 | u32 component) | ||
142 | { | 124 | { |
143 | 125 | ||
144 | ACPI_FUNCTION_TRACE ("ns_dump_pathname"); | 126 | ACPI_FUNCTION_TRACE("ns_dump_pathname"); |
145 | |||
146 | 127 | ||
147 | /* Do this only if the requested debug level and component are enabled */ | 128 | /* Do this only if the requested debug level and component are enabled */ |
148 | 129 | ||
@@ -152,12 +133,11 @@ acpi_ns_dump_pathname ( | |||
152 | 133 | ||
153 | /* Convert handle to a full pathname and print it (with supplied message) */ | 134 | /* Convert handle to a full pathname and print it (with supplied message) */ |
154 | 135 | ||
155 | acpi_ns_print_node_pathname (handle, msg); | 136 | acpi_ns_print_node_pathname(handle, msg); |
156 | acpi_os_printf ("\n"); | 137 | acpi_os_printf("\n"); |
157 | return_VOID; | 138 | return_VOID; |
158 | } | 139 | } |
159 | 140 | ||
160 | |||
161 | /******************************************************************************* | 141 | /******************************************************************************* |
162 | * | 142 | * |
163 | * FUNCTION: acpi_ns_dump_one_object | 143 | * FUNCTION: acpi_ns_dump_one_object |
@@ -175,24 +155,19 @@ acpi_ns_dump_pathname ( | |||
175 | ******************************************************************************/ | 155 | ******************************************************************************/ |
176 | 156 | ||
177 | acpi_status | 157 | acpi_status |
178 | acpi_ns_dump_one_object ( | 158 | acpi_ns_dump_one_object(acpi_handle obj_handle, |
179 | acpi_handle obj_handle, | 159 | u32 level, void *context, void **return_value) |
180 | u32 level, | ||
181 | void *context, | ||
182 | void **return_value) | ||
183 | { | 160 | { |
184 | struct acpi_walk_info *info = (struct acpi_walk_info *) context; | 161 | struct acpi_walk_info *info = (struct acpi_walk_info *)context; |
185 | struct acpi_namespace_node *this_node; | 162 | struct acpi_namespace_node *this_node; |
186 | union acpi_operand_object *obj_desc = NULL; | 163 | union acpi_operand_object *obj_desc = NULL; |
187 | acpi_object_type obj_type; | 164 | acpi_object_type obj_type; |
188 | acpi_object_type type; | 165 | acpi_object_type type; |
189 | u32 bytes_to_dump; | 166 | u32 bytes_to_dump; |
190 | u32 dbg_level; | 167 | u32 dbg_level; |
191 | u32 i; | 168 | u32 i; |
192 | |||
193 | |||
194 | ACPI_FUNCTION_NAME ("ns_dump_one_object"); | ||
195 | 169 | ||
170 | ACPI_FUNCTION_NAME("ns_dump_one_object"); | ||
196 | 171 | ||
197 | /* Is output enabled? */ | 172 | /* Is output enabled? */ |
198 | 173 | ||
@@ -201,48 +176,47 @@ acpi_ns_dump_one_object ( | |||
201 | } | 176 | } |
202 | 177 | ||
203 | if (!obj_handle) { | 178 | if (!obj_handle) { |
204 | ACPI_DEBUG_PRINT ((ACPI_DB_INFO, "Null object handle\n")); | 179 | ACPI_DEBUG_PRINT((ACPI_DB_INFO, "Null object handle\n")); |
205 | return (AE_OK); | 180 | return (AE_OK); |
206 | } | 181 | } |
207 | 182 | ||
208 | this_node = acpi_ns_map_handle_to_node (obj_handle); | 183 | this_node = acpi_ns_map_handle_to_node(obj_handle); |
209 | type = this_node->type; | 184 | type = this_node->type; |
210 | 185 | ||
211 | /* Check if the owner matches */ | 186 | /* Check if the owner matches */ |
212 | 187 | ||
213 | if ((info->owner_id != ACPI_OWNER_ID_MAX) && | 188 | if ((info->owner_id != ACPI_OWNER_ID_MAX) && |
214 | (info->owner_id != this_node->owner_id)) { | 189 | (info->owner_id != this_node->owner_id)) { |
215 | return (AE_OK); | 190 | return (AE_OK); |
216 | } | 191 | } |
217 | 192 | ||
218 | if (!(info->display_type & ACPI_DISPLAY_SHORT)) { | 193 | if (!(info->display_type & ACPI_DISPLAY_SHORT)) { |
219 | /* Indent the object according to the level */ | 194 | /* Indent the object according to the level */ |
220 | 195 | ||
221 | acpi_os_printf ("%2d%*s", (u32) level - 1, (int) level * 2, " "); | 196 | acpi_os_printf("%2d%*s", (u32) level - 1, (int)level * 2, " "); |
222 | 197 | ||
223 | /* Check the node type and name */ | 198 | /* Check the node type and name */ |
224 | 199 | ||
225 | if (type > ACPI_TYPE_LOCAL_MAX) { | 200 | if (type > ACPI_TYPE_LOCAL_MAX) { |
226 | ACPI_REPORT_WARNING (("Invalid ACPI Type %08X\n", type)); | 201 | ACPI_REPORT_WARNING(("Invalid ACPI Type %08X\n", type)); |
227 | } | 202 | } |
228 | 203 | ||
229 | if (!acpi_ut_valid_acpi_name (this_node->name.integer)) { | 204 | if (!acpi_ut_valid_acpi_name(this_node->name.integer)) { |
230 | ACPI_REPORT_WARNING (("Invalid ACPI Name %08X\n", | 205 | ACPI_REPORT_WARNING(("Invalid ACPI Name %08X\n", |
231 | this_node->name.integer)); | 206 | this_node->name.integer)); |
232 | } | 207 | } |
233 | 208 | ||
234 | acpi_os_printf ("%4.4s", acpi_ut_get_node_name (this_node)); | 209 | acpi_os_printf("%4.4s", acpi_ut_get_node_name(this_node)); |
235 | } | 210 | } |
236 | 211 | ||
237 | /* | 212 | /* |
238 | * Now we can print out the pertinent information | 213 | * Now we can print out the pertinent information |
239 | */ | 214 | */ |
240 | acpi_os_printf (" %-12s %p ", | 215 | acpi_os_printf(" %-12s %p ", acpi_ut_get_type_name(type), this_node); |
241 | acpi_ut_get_type_name (type), this_node); | ||
242 | 216 | ||
243 | dbg_level = acpi_dbg_level; | 217 | dbg_level = acpi_dbg_level; |
244 | acpi_dbg_level = 0; | 218 | acpi_dbg_level = 0; |
245 | obj_desc = acpi_ns_get_attached_object (this_node); | 219 | obj_desc = acpi_ns_get_attached_object(this_node); |
246 | acpi_dbg_level = dbg_level; | 220 | acpi_dbg_level = dbg_level; |
247 | 221 | ||
248 | switch (info->display_type & ACPI_DISPLAY_MASK) { | 222 | switch (info->display_type & ACPI_DISPLAY_MASK) { |
@@ -251,147 +225,166 @@ acpi_ns_dump_one_object ( | |||
251 | if (!obj_desc) { | 225 | if (!obj_desc) { |
252 | /* No attached object, we are done */ | 226 | /* No attached object, we are done */ |
253 | 227 | ||
254 | acpi_os_printf ("\n"); | 228 | acpi_os_printf("\n"); |
255 | return (AE_OK); | 229 | return (AE_OK); |
256 | } | 230 | } |
257 | 231 | ||
258 | switch (type) { | 232 | switch (type) { |
259 | case ACPI_TYPE_PROCESSOR: | 233 | case ACPI_TYPE_PROCESSOR: |
260 | 234 | ||
261 | acpi_os_printf ("ID %X Len %.4X Addr %p\n", | 235 | acpi_os_printf("ID %X Len %.4X Addr %p\n", |
262 | obj_desc->processor.proc_id, obj_desc->processor.length, | 236 | obj_desc->processor.proc_id, |
263 | (char *) obj_desc->processor.address); | 237 | obj_desc->processor.length, |
238 | (char *)obj_desc->processor.address); | ||
264 | break; | 239 | break; |
265 | 240 | ||
266 | |||
267 | case ACPI_TYPE_DEVICE: | 241 | case ACPI_TYPE_DEVICE: |
268 | 242 | ||
269 | acpi_os_printf ("Notify Object: %p\n", obj_desc); | 243 | acpi_os_printf("Notify Object: %p\n", obj_desc); |
270 | break; | 244 | break; |
271 | 245 | ||
272 | |||
273 | case ACPI_TYPE_METHOD: | 246 | case ACPI_TYPE_METHOD: |
274 | 247 | ||
275 | acpi_os_printf ("Args %X Len %.4X Aml %p\n", | 248 | acpi_os_printf("Args %X Len %.4X Aml %p\n", |
276 | (u32) obj_desc->method.param_count, | 249 | (u32) obj_desc->method.param_count, |
277 | obj_desc->method.aml_length, obj_desc->method.aml_start); | 250 | obj_desc->method.aml_length, |
251 | obj_desc->method.aml_start); | ||
278 | break; | 252 | break; |
279 | 253 | ||
280 | |||
281 | case ACPI_TYPE_INTEGER: | 254 | case ACPI_TYPE_INTEGER: |
282 | 255 | ||
283 | acpi_os_printf ("= %8.8X%8.8X\n", | 256 | acpi_os_printf("= %8.8X%8.8X\n", |
284 | ACPI_FORMAT_UINT64 (obj_desc->integer.value)); | 257 | ACPI_FORMAT_UINT64(obj_desc->integer. |
258 | value)); | ||
285 | break; | 259 | break; |
286 | 260 | ||
287 | |||
288 | case ACPI_TYPE_PACKAGE: | 261 | case ACPI_TYPE_PACKAGE: |
289 | 262 | ||
290 | if (obj_desc->common.flags & AOPOBJ_DATA_VALID) { | 263 | if (obj_desc->common.flags & AOPOBJ_DATA_VALID) { |
291 | acpi_os_printf ("Elements %.2X\n", | 264 | acpi_os_printf("Elements %.2X\n", |
292 | obj_desc->package.count); | 265 | obj_desc->package.count); |
293 | } | 266 | } else { |
294 | else { | 267 | acpi_os_printf("[Length not yet evaluated]\n"); |
295 | acpi_os_printf ("[Length not yet evaluated]\n"); | ||
296 | } | 268 | } |
297 | break; | 269 | break; |
298 | 270 | ||
299 | |||
300 | case ACPI_TYPE_BUFFER: | 271 | case ACPI_TYPE_BUFFER: |
301 | 272 | ||
302 | if (obj_desc->common.flags & AOPOBJ_DATA_VALID) { | 273 | if (obj_desc->common.flags & AOPOBJ_DATA_VALID) { |
303 | acpi_os_printf ("Len %.2X", | 274 | acpi_os_printf("Len %.2X", |
304 | obj_desc->buffer.length); | 275 | obj_desc->buffer.length); |
305 | 276 | ||
306 | /* Dump some of the buffer */ | 277 | /* Dump some of the buffer */ |
307 | 278 | ||
308 | if (obj_desc->buffer.length > 0) { | 279 | if (obj_desc->buffer.length > 0) { |
309 | acpi_os_printf (" ="); | 280 | acpi_os_printf(" ="); |
310 | for (i = 0; (i < obj_desc->buffer.length && i < 12); i++) { | 281 | for (i = 0; |
311 | acpi_os_printf (" %.2hX", obj_desc->buffer.pointer[i]); | 282 | (i < obj_desc->buffer.length |
283 | && i < 12); i++) { | ||
284 | acpi_os_printf(" %.2hX", | ||
285 | obj_desc->buffer. | ||
286 | pointer[i]); | ||
312 | } | 287 | } |
313 | } | 288 | } |
314 | acpi_os_printf ("\n"); | 289 | acpi_os_printf("\n"); |
315 | } | 290 | } else { |
316 | else { | 291 | acpi_os_printf("[Length not yet evaluated]\n"); |
317 | acpi_os_printf ("[Length not yet evaluated]\n"); | ||
318 | } | 292 | } |
319 | break; | 293 | break; |
320 | 294 | ||
321 | |||
322 | case ACPI_TYPE_STRING: | 295 | case ACPI_TYPE_STRING: |
323 | 296 | ||
324 | acpi_os_printf ("Len %.2X ", obj_desc->string.length); | 297 | acpi_os_printf("Len %.2X ", obj_desc->string.length); |
325 | acpi_ut_print_string (obj_desc->string.pointer, 32); | 298 | acpi_ut_print_string(obj_desc->string.pointer, 32); |
326 | acpi_os_printf ("\n"); | 299 | acpi_os_printf("\n"); |
327 | break; | 300 | break; |
328 | 301 | ||
329 | |||
330 | case ACPI_TYPE_REGION: | 302 | case ACPI_TYPE_REGION: |
331 | 303 | ||
332 | acpi_os_printf ("[%s]", | 304 | acpi_os_printf("[%s]", |
333 | acpi_ut_get_region_name (obj_desc->region.space_id)); | 305 | acpi_ut_get_region_name(obj_desc->region. |
306 | space_id)); | ||
334 | if (obj_desc->region.flags & AOPOBJ_DATA_VALID) { | 307 | if (obj_desc->region.flags & AOPOBJ_DATA_VALID) { |
335 | acpi_os_printf (" Addr %8.8X%8.8X Len %.4X\n", | 308 | acpi_os_printf(" Addr %8.8X%8.8X Len %.4X\n", |
336 | ACPI_FORMAT_UINT64 (obj_desc->region.address), | 309 | ACPI_FORMAT_UINT64(obj_desc-> |
337 | obj_desc->region.length); | 310 | region. |
338 | } | 311 | address), |
339 | else { | 312 | obj_desc->region.length); |
340 | acpi_os_printf (" [Address/Length not yet evaluated]\n"); | 313 | } else { |
314 | acpi_os_printf | ||
315 | (" [Address/Length not yet evaluated]\n"); | ||
341 | } | 316 | } |
342 | break; | 317 | break; |
343 | 318 | ||
344 | |||
345 | case ACPI_TYPE_LOCAL_REFERENCE: | 319 | case ACPI_TYPE_LOCAL_REFERENCE: |
346 | 320 | ||
347 | acpi_os_printf ("[%s]\n", | 321 | acpi_os_printf("[%s]\n", |
348 | acpi_ps_get_opcode_name (obj_desc->reference.opcode)); | 322 | acpi_ps_get_opcode_name(obj_desc-> |
323 | reference. | ||
324 | opcode)); | ||
349 | break; | 325 | break; |
350 | 326 | ||
351 | |||
352 | case ACPI_TYPE_BUFFER_FIELD: | 327 | case ACPI_TYPE_BUFFER_FIELD: |
353 | 328 | ||
354 | if (obj_desc->buffer_field.buffer_obj && | 329 | if (obj_desc->buffer_field.buffer_obj && |
355 | obj_desc->buffer_field.buffer_obj->buffer.node) { | 330 | obj_desc->buffer_field.buffer_obj->buffer.node) { |
356 | acpi_os_printf ("Buf [%4.4s]", | 331 | acpi_os_printf("Buf [%4.4s]", |
357 | acpi_ut_get_node_name (obj_desc->buffer_field.buffer_obj->buffer.node)); | 332 | acpi_ut_get_node_name(obj_desc-> |
333 | buffer_field. | ||
334 | buffer_obj-> | ||
335 | buffer. | ||
336 | node)); | ||
358 | } | 337 | } |
359 | break; | 338 | break; |
360 | 339 | ||
361 | |||
362 | case ACPI_TYPE_LOCAL_REGION_FIELD: | 340 | case ACPI_TYPE_LOCAL_REGION_FIELD: |
363 | 341 | ||
364 | acpi_os_printf ("Rgn [%4.4s]", | 342 | acpi_os_printf("Rgn [%4.4s]", |
365 | acpi_ut_get_node_name (obj_desc->common_field.region_obj->region.node)); | 343 | acpi_ut_get_node_name(obj_desc-> |
344 | common_field. | ||
345 | region_obj->region. | ||
346 | node)); | ||
366 | break; | 347 | break; |
367 | 348 | ||
368 | |||
369 | case ACPI_TYPE_LOCAL_BANK_FIELD: | 349 | case ACPI_TYPE_LOCAL_BANK_FIELD: |
370 | 350 | ||
371 | acpi_os_printf ("Rgn [%4.4s] Bnk [%4.4s]", | 351 | acpi_os_printf("Rgn [%4.4s] Bnk [%4.4s]", |
372 | acpi_ut_get_node_name (obj_desc->common_field.region_obj->region.node), | 352 | acpi_ut_get_node_name(obj_desc-> |
373 | acpi_ut_get_node_name (obj_desc->bank_field.bank_obj->common_field.node)); | 353 | common_field. |
354 | region_obj->region. | ||
355 | node), | ||
356 | acpi_ut_get_node_name(obj_desc-> | ||
357 | bank_field. | ||
358 | bank_obj-> | ||
359 | common_field. | ||
360 | node)); | ||
374 | break; | 361 | break; |
375 | 362 | ||
376 | |||
377 | case ACPI_TYPE_LOCAL_INDEX_FIELD: | 363 | case ACPI_TYPE_LOCAL_INDEX_FIELD: |
378 | 364 | ||
379 | acpi_os_printf ("Idx [%4.4s] Dat [%4.4s]", | 365 | acpi_os_printf("Idx [%4.4s] Dat [%4.4s]", |
380 | acpi_ut_get_node_name (obj_desc->index_field.index_obj->common_field.node), | 366 | acpi_ut_get_node_name(obj_desc-> |
381 | acpi_ut_get_node_name (obj_desc->index_field.data_obj->common_field.node)); | 367 | index_field. |
368 | index_obj-> | ||
369 | common_field.node), | ||
370 | acpi_ut_get_node_name(obj_desc-> | ||
371 | index_field. | ||
372 | data_obj-> | ||
373 | common_field. | ||
374 | node)); | ||
382 | break; | 375 | break; |
383 | 376 | ||
384 | |||
385 | case ACPI_TYPE_LOCAL_ALIAS: | 377 | case ACPI_TYPE_LOCAL_ALIAS: |
386 | case ACPI_TYPE_LOCAL_METHOD_ALIAS: | 378 | case ACPI_TYPE_LOCAL_METHOD_ALIAS: |
387 | 379 | ||
388 | acpi_os_printf ("Target %4.4s (%p)\n", | 380 | acpi_os_printf("Target %4.4s (%p)\n", |
389 | acpi_ut_get_node_name (obj_desc), obj_desc); | 381 | acpi_ut_get_node_name(obj_desc), |
382 | obj_desc); | ||
390 | break; | 383 | break; |
391 | 384 | ||
392 | default: | 385 | default: |
393 | 386 | ||
394 | acpi_os_printf ("Object %p\n", obj_desc); | 387 | acpi_os_printf("Object %p\n", obj_desc); |
395 | break; | 388 | break; |
396 | } | 389 | } |
397 | 390 | ||
@@ -403,11 +396,15 @@ acpi_ns_dump_one_object ( | |||
403 | case ACPI_TYPE_LOCAL_BANK_FIELD: | 396 | case ACPI_TYPE_LOCAL_BANK_FIELD: |
404 | case ACPI_TYPE_LOCAL_INDEX_FIELD: | 397 | case ACPI_TYPE_LOCAL_INDEX_FIELD: |
405 | 398 | ||
406 | acpi_os_printf (" Off %.3X Len %.2X Acc %.2hd\n", | 399 | acpi_os_printf(" Off %.3X Len %.2X Acc %.2hd\n", |
407 | (obj_desc->common_field.base_byte_offset * 8) | 400 | (obj_desc->common_field. |
408 | + obj_desc->common_field.start_field_bit_offset, | 401 | base_byte_offset * 8) |
409 | obj_desc->common_field.bit_length, | 402 | + |
410 | obj_desc->common_field.access_byte_width); | 403 | obj_desc->common_field. |
404 | start_field_bit_offset, | ||
405 | obj_desc->common_field.bit_length, | ||
406 | obj_desc->common_field. | ||
407 | access_byte_width); | ||
411 | break; | 408 | break; |
412 | 409 | ||
413 | default: | 410 | default: |
@@ -415,56 +412,55 @@ acpi_ns_dump_one_object ( | |||
415 | } | 412 | } |
416 | break; | 413 | break; |
417 | 414 | ||
418 | |||
419 | case ACPI_DISPLAY_OBJECTS: | 415 | case ACPI_DISPLAY_OBJECTS: |
420 | 416 | ||
421 | acpi_os_printf ("O:%p", obj_desc); | 417 | acpi_os_printf("O:%p", obj_desc); |
422 | if (!obj_desc) { | 418 | if (!obj_desc) { |
423 | /* No attached object, we are done */ | 419 | /* No attached object, we are done */ |
424 | 420 | ||
425 | acpi_os_printf ("\n"); | 421 | acpi_os_printf("\n"); |
426 | return (AE_OK); | 422 | return (AE_OK); |
427 | } | 423 | } |
428 | 424 | ||
429 | acpi_os_printf ("(R%d)", obj_desc->common.reference_count); | 425 | acpi_os_printf("(R%d)", obj_desc->common.reference_count); |
430 | 426 | ||
431 | switch (type) { | 427 | switch (type) { |
432 | case ACPI_TYPE_METHOD: | 428 | case ACPI_TYPE_METHOD: |
433 | 429 | ||
434 | /* Name is a Method and its AML offset/length are set */ | 430 | /* Name is a Method and its AML offset/length are set */ |
435 | 431 | ||
436 | acpi_os_printf (" M:%p-%X\n", obj_desc->method.aml_start, | 432 | acpi_os_printf(" M:%p-%X\n", obj_desc->method.aml_start, |
437 | obj_desc->method.aml_length); | 433 | obj_desc->method.aml_length); |
438 | break; | 434 | break; |
439 | 435 | ||
440 | case ACPI_TYPE_INTEGER: | 436 | case ACPI_TYPE_INTEGER: |
441 | 437 | ||
442 | acpi_os_printf (" I:%8.8X8.8%X\n", | 438 | acpi_os_printf(" I:%8.8X8.8%X\n", |
443 | ACPI_FORMAT_UINT64 (obj_desc->integer.value)); | 439 | ACPI_FORMAT_UINT64(obj_desc->integer. |
440 | value)); | ||
444 | break; | 441 | break; |
445 | 442 | ||
446 | case ACPI_TYPE_STRING: | 443 | case ACPI_TYPE_STRING: |
447 | 444 | ||
448 | acpi_os_printf (" S:%p-%X\n", obj_desc->string.pointer, | 445 | acpi_os_printf(" S:%p-%X\n", obj_desc->string.pointer, |
449 | obj_desc->string.length); | 446 | obj_desc->string.length); |
450 | break; | 447 | break; |
451 | 448 | ||
452 | case ACPI_TYPE_BUFFER: | 449 | case ACPI_TYPE_BUFFER: |
453 | 450 | ||
454 | acpi_os_printf (" B:%p-%X\n", obj_desc->buffer.pointer, | 451 | acpi_os_printf(" B:%p-%X\n", obj_desc->buffer.pointer, |
455 | obj_desc->buffer.length); | 452 | obj_desc->buffer.length); |
456 | break; | 453 | break; |
457 | 454 | ||
458 | default: | 455 | default: |
459 | 456 | ||
460 | acpi_os_printf ("\n"); | 457 | acpi_os_printf("\n"); |
461 | break; | 458 | break; |
462 | } | 459 | } |
463 | break; | 460 | break; |
464 | 461 | ||
465 | |||
466 | default: | 462 | default: |
467 | acpi_os_printf ("\n"); | 463 | acpi_os_printf("\n"); |
468 | break; | 464 | break; |
469 | } | 465 | } |
470 | 466 | ||
@@ -474,46 +470,47 @@ acpi_ns_dump_one_object ( | |||
474 | return (AE_OK); | 470 | return (AE_OK); |
475 | } | 471 | } |
476 | 472 | ||
477 | |||
478 | /* If there is an attached object, display it */ | 473 | /* If there is an attached object, display it */ |
479 | 474 | ||
480 | dbg_level = acpi_dbg_level; | 475 | dbg_level = acpi_dbg_level; |
481 | acpi_dbg_level = 0; | 476 | acpi_dbg_level = 0; |
482 | obj_desc = acpi_ns_get_attached_object (this_node); | 477 | obj_desc = acpi_ns_get_attached_object(this_node); |
483 | acpi_dbg_level = dbg_level; | 478 | acpi_dbg_level = dbg_level; |
484 | 479 | ||
485 | /* Dump attached objects */ | 480 | /* Dump attached objects */ |
486 | 481 | ||
487 | while (obj_desc) { | 482 | while (obj_desc) { |
488 | obj_type = ACPI_TYPE_INVALID; | 483 | obj_type = ACPI_TYPE_INVALID; |
489 | acpi_os_printf ("Attached Object %p: ", obj_desc); | 484 | acpi_os_printf("Attached Object %p: ", obj_desc); |
490 | 485 | ||
491 | /* Decode the type of attached object and dump the contents */ | 486 | /* Decode the type of attached object and dump the contents */ |
492 | 487 | ||
493 | switch (ACPI_GET_DESCRIPTOR_TYPE (obj_desc)) { | 488 | switch (ACPI_GET_DESCRIPTOR_TYPE(obj_desc)) { |
494 | case ACPI_DESC_TYPE_NAMED: | 489 | case ACPI_DESC_TYPE_NAMED: |
495 | 490 | ||
496 | acpi_os_printf ("(Ptr to Node)\n"); | 491 | acpi_os_printf("(Ptr to Node)\n"); |
497 | bytes_to_dump = sizeof (struct acpi_namespace_node); | 492 | bytes_to_dump = sizeof(struct acpi_namespace_node); |
498 | ACPI_DUMP_BUFFER (obj_desc, bytes_to_dump); | 493 | ACPI_DUMP_BUFFER(obj_desc, bytes_to_dump); |
499 | break; | 494 | break; |
500 | 495 | ||
501 | case ACPI_DESC_TYPE_OPERAND: | 496 | case ACPI_DESC_TYPE_OPERAND: |
502 | 497 | ||
503 | obj_type = ACPI_GET_OBJECT_TYPE (obj_desc); | 498 | obj_type = ACPI_GET_OBJECT_TYPE(obj_desc); |
504 | 499 | ||
505 | if (obj_type > ACPI_TYPE_LOCAL_MAX) { | 500 | if (obj_type > ACPI_TYPE_LOCAL_MAX) { |
506 | acpi_os_printf ("(Ptr to ACPI Object type %X [UNKNOWN])\n", | 501 | acpi_os_printf |
507 | obj_type); | 502 | ("(Ptr to ACPI Object type %X [UNKNOWN])\n", |
503 | obj_type); | ||
508 | bytes_to_dump = 32; | 504 | bytes_to_dump = 32; |
509 | } | 505 | } else { |
510 | else { | 506 | acpi_os_printf |
511 | acpi_os_printf ("(Ptr to ACPI Object type %X [%s])\n", | 507 | ("(Ptr to ACPI Object type %X [%s])\n", |
512 | obj_type, acpi_ut_get_type_name (obj_type)); | 508 | obj_type, acpi_ut_get_type_name(obj_type)); |
513 | bytes_to_dump = sizeof (union acpi_operand_object); | 509 | bytes_to_dump = |
510 | sizeof(union acpi_operand_object); | ||
514 | } | 511 | } |
515 | 512 | ||
516 | ACPI_DUMP_BUFFER (obj_desc, bytes_to_dump); | 513 | ACPI_DUMP_BUFFER(obj_desc, bytes_to_dump); |
517 | break; | 514 | break; |
518 | 515 | ||
519 | default: | 516 | default: |
@@ -523,7 +520,8 @@ acpi_ns_dump_one_object ( | |||
523 | 520 | ||
524 | /* If value is NOT an internal object, we are done */ | 521 | /* If value is NOT an internal object, we are done */ |
525 | 522 | ||
526 | if (ACPI_GET_DESCRIPTOR_TYPE (obj_desc) != ACPI_DESC_TYPE_OPERAND) { | 523 | if (ACPI_GET_DESCRIPTOR_TYPE(obj_desc) != |
524 | ACPI_DESC_TYPE_OPERAND) { | ||
527 | goto cleanup; | 525 | goto cleanup; |
528 | } | 526 | } |
529 | 527 | ||
@@ -537,49 +535,50 @@ acpi_ns_dump_one_object ( | |||
537 | * NOTE: takes advantage of common fields between string/buffer | 535 | * NOTE: takes advantage of common fields between string/buffer |
538 | */ | 536 | */ |
539 | bytes_to_dump = obj_desc->string.length; | 537 | bytes_to_dump = obj_desc->string.length; |
540 | obj_desc = (void *) obj_desc->string.pointer; | 538 | obj_desc = (void *)obj_desc->string.pointer; |
541 | acpi_os_printf ( "(Buffer/String pointer %p length %X)\n", | 539 | acpi_os_printf("(Buffer/String pointer %p length %X)\n", |
542 | obj_desc, bytes_to_dump); | 540 | obj_desc, bytes_to_dump); |
543 | ACPI_DUMP_BUFFER (obj_desc, bytes_to_dump); | 541 | ACPI_DUMP_BUFFER(obj_desc, bytes_to_dump); |
544 | goto cleanup; | 542 | goto cleanup; |
545 | 543 | ||
546 | case ACPI_TYPE_BUFFER_FIELD: | 544 | case ACPI_TYPE_BUFFER_FIELD: |
547 | obj_desc = (union acpi_operand_object *) obj_desc->buffer_field.buffer_obj; | 545 | obj_desc = |
546 | (union acpi_operand_object *)obj_desc->buffer_field. | ||
547 | buffer_obj; | ||
548 | break; | 548 | break; |
549 | 549 | ||
550 | case ACPI_TYPE_PACKAGE: | 550 | case ACPI_TYPE_PACKAGE: |
551 | obj_desc = (void *) obj_desc->package.elements; | 551 | obj_desc = (void *)obj_desc->package.elements; |
552 | break; | 552 | break; |
553 | 553 | ||
554 | case ACPI_TYPE_METHOD: | 554 | case ACPI_TYPE_METHOD: |
555 | obj_desc = (void *) obj_desc->method.aml_start; | 555 | obj_desc = (void *)obj_desc->method.aml_start; |
556 | break; | 556 | break; |
557 | 557 | ||
558 | case ACPI_TYPE_LOCAL_REGION_FIELD: | 558 | case ACPI_TYPE_LOCAL_REGION_FIELD: |
559 | obj_desc = (void *) obj_desc->field.region_obj; | 559 | obj_desc = (void *)obj_desc->field.region_obj; |
560 | break; | 560 | break; |
561 | 561 | ||
562 | case ACPI_TYPE_LOCAL_BANK_FIELD: | 562 | case ACPI_TYPE_LOCAL_BANK_FIELD: |
563 | obj_desc = (void *) obj_desc->bank_field.region_obj; | 563 | obj_desc = (void *)obj_desc->bank_field.region_obj; |
564 | break; | 564 | break; |
565 | 565 | ||
566 | case ACPI_TYPE_LOCAL_INDEX_FIELD: | 566 | case ACPI_TYPE_LOCAL_INDEX_FIELD: |
567 | obj_desc = (void *) obj_desc->index_field.index_obj; | 567 | obj_desc = (void *)obj_desc->index_field.index_obj; |
568 | break; | 568 | break; |
569 | 569 | ||
570 | default: | 570 | default: |
571 | goto cleanup; | 571 | goto cleanup; |
572 | } | 572 | } |
573 | 573 | ||
574 | obj_type = ACPI_TYPE_INVALID; /* Terminate loop after next pass */ | 574 | obj_type = ACPI_TYPE_INVALID; /* Terminate loop after next pass */ |
575 | } | 575 | } |
576 | 576 | ||
577 | cleanup: | 577 | cleanup: |
578 | acpi_os_printf ("\n"); | 578 | acpi_os_printf("\n"); |
579 | return (AE_OK); | 579 | return (AE_OK); |
580 | } | 580 | } |
581 | 581 | ||
582 | |||
583 | #ifdef ACPI_FUTURE_USAGE | 582 | #ifdef ACPI_FUTURE_USAGE |
584 | /******************************************************************************* | 583 | /******************************************************************************* |
585 | * | 584 | * |
@@ -601,29 +600,25 @@ cleanup: | |||
601 | ******************************************************************************/ | 600 | ******************************************************************************/ |
602 | 601 | ||
603 | void | 602 | void |
604 | acpi_ns_dump_objects ( | 603 | acpi_ns_dump_objects(acpi_object_type type, |
605 | acpi_object_type type, | 604 | u8 display_type, |
606 | u8 display_type, | 605 | u32 max_depth, |
607 | u32 max_depth, | 606 | acpi_owner_id owner_id, acpi_handle start_handle) |
608 | acpi_owner_id owner_id, | ||
609 | acpi_handle start_handle) | ||
610 | { | 607 | { |
611 | struct acpi_walk_info info; | 608 | struct acpi_walk_info info; |
612 | |||
613 | |||
614 | ACPI_FUNCTION_ENTRY (); | ||
615 | 609 | ||
610 | ACPI_FUNCTION_ENTRY(); | ||
616 | 611 | ||
617 | info.debug_level = ACPI_LV_TABLES; | 612 | info.debug_level = ACPI_LV_TABLES; |
618 | info.owner_id = owner_id; | 613 | info.owner_id = owner_id; |
619 | info.display_type = display_type; | 614 | info.display_type = display_type; |
620 | 615 | ||
621 | (void) acpi_ns_walk_namespace (type, start_handle, max_depth, | 616 | (void)acpi_ns_walk_namespace(type, start_handle, max_depth, |
622 | ACPI_NS_WALK_NO_UNLOCK, acpi_ns_dump_one_object, | 617 | ACPI_NS_WALK_NO_UNLOCK, |
623 | (void *) &info, NULL); | 618 | acpi_ns_dump_one_object, (void *)&info, |
619 | NULL); | ||
624 | } | 620 | } |
625 | #endif /* ACPI_FUTURE_USAGE */ | 621 | #endif /* ACPI_FUTURE_USAGE */ |
626 | |||
627 | 622 | ||
628 | /******************************************************************************* | 623 | /******************************************************************************* |
629 | * | 624 | * |
@@ -638,25 +633,19 @@ acpi_ns_dump_objects ( | |||
638 | * | 633 | * |
639 | ******************************************************************************/ | 634 | ******************************************************************************/ |
640 | 635 | ||
641 | void | 636 | void acpi_ns_dump_entry(acpi_handle handle, u32 debug_level) |
642 | acpi_ns_dump_entry ( | ||
643 | acpi_handle handle, | ||
644 | u32 debug_level) | ||
645 | { | 637 | { |
646 | struct acpi_walk_info info; | 638 | struct acpi_walk_info info; |
647 | |||
648 | |||
649 | ACPI_FUNCTION_ENTRY (); | ||
650 | 639 | ||
640 | ACPI_FUNCTION_ENTRY(); | ||
651 | 641 | ||
652 | info.debug_level = debug_level; | 642 | info.debug_level = debug_level; |
653 | info.owner_id = ACPI_OWNER_ID_MAX; | 643 | info.owner_id = ACPI_OWNER_ID_MAX; |
654 | info.display_type = ACPI_DISPLAY_SUMMARY; | 644 | info.display_type = ACPI_DISPLAY_SUMMARY; |
655 | 645 | ||
656 | (void) acpi_ns_dump_one_object (handle, 1, &info, NULL); | 646 | (void)acpi_ns_dump_one_object(handle, 1, &info, NULL); |
657 | } | 647 | } |
658 | 648 | ||
659 | |||
660 | #ifdef ACPI_ASL_COMPILER | 649 | #ifdef ACPI_ASL_COMPILER |
661 | /******************************************************************************* | 650 | /******************************************************************************* |
662 | * | 651 | * |
@@ -673,23 +662,19 @@ acpi_ns_dump_entry ( | |||
673 | * | 662 | * |
674 | ******************************************************************************/ | 663 | ******************************************************************************/ |
675 | 664 | ||
676 | void | 665 | void acpi_ns_dump_tables(acpi_handle search_base, u32 max_depth) |
677 | acpi_ns_dump_tables ( | ||
678 | acpi_handle search_base, | ||
679 | u32 max_depth) | ||
680 | { | 666 | { |
681 | acpi_handle search_handle = search_base; | 667 | acpi_handle search_handle = search_base; |
682 | |||
683 | |||
684 | ACPI_FUNCTION_TRACE ("ns_dump_tables"); | ||
685 | 668 | ||
669 | ACPI_FUNCTION_TRACE("ns_dump_tables"); | ||
686 | 670 | ||
687 | if (!acpi_gbl_root_node) { | 671 | if (!acpi_gbl_root_node) { |
688 | /* | 672 | /* |
689 | * If the name space has not been initialized, | 673 | * If the name space has not been initialized, |
690 | * there is nothing to dump. | 674 | * there is nothing to dump. |
691 | */ | 675 | */ |
692 | ACPI_DEBUG_PRINT ((ACPI_DB_TABLES, "namespace not initialized!\n")); | 676 | ACPI_DEBUG_PRINT((ACPI_DB_TABLES, |
677 | "namespace not initialized!\n")); | ||
693 | return_VOID; | 678 | return_VOID; |
694 | } | 679 | } |
695 | 680 | ||
@@ -697,12 +682,12 @@ acpi_ns_dump_tables ( | |||
697 | /* Entire namespace */ | 682 | /* Entire namespace */ |
698 | 683 | ||
699 | search_handle = acpi_gbl_root_node; | 684 | search_handle = acpi_gbl_root_node; |
700 | ACPI_DEBUG_PRINT ((ACPI_DB_TABLES, "\\\n")); | 685 | ACPI_DEBUG_PRINT((ACPI_DB_TABLES, "\\\n")); |
701 | } | 686 | } |
702 | 687 | ||
703 | acpi_ns_dump_objects (ACPI_TYPE_ANY, ACPI_DISPLAY_OBJECTS, max_depth, | 688 | acpi_ns_dump_objects(ACPI_TYPE_ANY, ACPI_DISPLAY_OBJECTS, max_depth, |
704 | ACPI_OWNER_ID_MAX, search_handle); | 689 | ACPI_OWNER_ID_MAX, search_handle); |
705 | return_VOID; | 690 | return_VOID; |
706 | } | 691 | } |
707 | #endif /* _ACPI_ASL_COMPILER */ | 692 | #endif /* _ACPI_ASL_COMPILER */ |
708 | #endif /* defined(ACPI_DEBUG_OUTPUT) || defined(ACPI_DEBUGGER) */ | 693 | #endif /* defined(ACPI_DEBUG_OUTPUT) || defined(ACPI_DEBUGGER) */ |
diff --git a/drivers/acpi/namespace/nsdumpdv.c b/drivers/acpi/namespace/nsdumpdv.c index 27c4f7cd2a43..55de883943d6 100644 --- a/drivers/acpi/namespace/nsdumpdv.c +++ b/drivers/acpi/namespace/nsdumpdv.c | |||
@@ -41,20 +41,15 @@ | |||
41 | * POSSIBILITY OF SUCH DAMAGES. | 41 | * POSSIBILITY OF SUCH DAMAGES. |
42 | */ | 42 | */ |
43 | 43 | ||
44 | |||
45 | #include <acpi/acpi.h> | 44 | #include <acpi/acpi.h> |
46 | 45 | ||
47 | |||
48 | /* TBD: This entire module is apparently obsolete and should be removed */ | 46 | /* TBD: This entire module is apparently obsolete and should be removed */ |
49 | 47 | ||
50 | #define _COMPONENT ACPI_NAMESPACE | 48 | #define _COMPONENT ACPI_NAMESPACE |
51 | ACPI_MODULE_NAME ("nsdumpdv") | 49 | ACPI_MODULE_NAME("nsdumpdv") |
52 | |||
53 | #ifdef ACPI_OBSOLETE_FUNCTIONS | 50 | #ifdef ACPI_OBSOLETE_FUNCTIONS |
54 | #if defined(ACPI_DEBUG_OUTPUT) || defined(ACPI_DEBUGGER) | 51 | #if defined(ACPI_DEBUG_OUTPUT) || defined(ACPI_DEBUGGER) |
55 | |||
56 | #include <acpi/acnamesp.h> | 52 | #include <acpi/acnamesp.h> |
57 | |||
58 | /******************************************************************************* | 53 | /******************************************************************************* |
59 | * | 54 | * |
60 | * FUNCTION: acpi_ns_dump_one_device | 55 | * FUNCTION: acpi_ns_dump_one_device |
@@ -70,44 +65,39 @@ | |||
70 | * This procedure is a user_function called by acpi_ns_walk_namespace. | 65 | * This procedure is a user_function called by acpi_ns_walk_namespace. |
71 | * | 66 | * |
72 | ******************************************************************************/ | 67 | ******************************************************************************/ |
73 | |||
74 | static acpi_status | 68 | static acpi_status |
75 | acpi_ns_dump_one_device ( | 69 | acpi_ns_dump_one_device(acpi_handle obj_handle, |
76 | acpi_handle obj_handle, | 70 | u32 level, void *context, void **return_value) |
77 | u32 level, | ||
78 | void *context, | ||
79 | void **return_value) | ||
80 | { | 71 | { |
81 | struct acpi_buffer buffer; | 72 | struct acpi_buffer buffer; |
82 | struct acpi_device_info *info; | 73 | struct acpi_device_info *info; |
83 | acpi_status status; | 74 | acpi_status status; |
84 | u32 i; | 75 | u32 i; |
85 | |||
86 | 76 | ||
87 | ACPI_FUNCTION_NAME ("ns_dump_one_device"); | 77 | ACPI_FUNCTION_NAME("ns_dump_one_device"); |
88 | 78 | ||
89 | 79 | status = | |
90 | status = acpi_ns_dump_one_object (obj_handle, level, context, return_value); | 80 | acpi_ns_dump_one_object(obj_handle, level, context, return_value); |
91 | 81 | ||
92 | buffer.length = ACPI_ALLOCATE_LOCAL_BUFFER; | 82 | buffer.length = ACPI_ALLOCATE_LOCAL_BUFFER; |
93 | status = acpi_get_object_info (obj_handle, &buffer); | 83 | status = acpi_get_object_info(obj_handle, &buffer); |
94 | if (ACPI_SUCCESS (status)) { | 84 | if (ACPI_SUCCESS(status)) { |
95 | info = buffer.pointer; | 85 | info = buffer.pointer; |
96 | for (i = 0; i < level; i++) { | 86 | for (i = 0; i < level; i++) { |
97 | ACPI_DEBUG_PRINT_RAW ((ACPI_DB_TABLES, " ")); | 87 | ACPI_DEBUG_PRINT_RAW((ACPI_DB_TABLES, " ")); |
98 | } | 88 | } |
99 | 89 | ||
100 | ACPI_DEBUG_PRINT_RAW ((ACPI_DB_TABLES, | 90 | ACPI_DEBUG_PRINT_RAW((ACPI_DB_TABLES, |
101 | " HID: %s, ADR: %8.8X%8.8X, Status: %X\n", | 91 | " HID: %s, ADR: %8.8X%8.8X, Status: %X\n", |
102 | info->hardware_id.value, ACPI_FORMAT_UINT64 (info->address), | 92 | info->hardware_id.value, |
103 | info->current_status)); | 93 | ACPI_FORMAT_UINT64(info->address), |
104 | ACPI_MEM_FREE (info); | 94 | info->current_status)); |
95 | ACPI_MEM_FREE(info); | ||
105 | } | 96 | } |
106 | 97 | ||
107 | return (status); | 98 | return (status); |
108 | } | 99 | } |
109 | 100 | ||
110 | |||
111 | /******************************************************************************* | 101 | /******************************************************************************* |
112 | * | 102 | * |
113 | * FUNCTION: acpi_ns_dump_root_devices | 103 | * FUNCTION: acpi_ns_dump_root_devices |
@@ -120,16 +110,12 @@ acpi_ns_dump_one_device ( | |||
120 | * | 110 | * |
121 | ******************************************************************************/ | 111 | ******************************************************************************/ |
122 | 112 | ||
123 | void | 113 | void acpi_ns_dump_root_devices(void) |
124 | acpi_ns_dump_root_devices ( | ||
125 | void) | ||
126 | { | 114 | { |
127 | acpi_handle sys_bus_handle; | 115 | acpi_handle sys_bus_handle; |
128 | acpi_status status; | 116 | acpi_status status; |
129 | |||
130 | |||
131 | ACPI_FUNCTION_NAME ("ns_dump_root_devices"); | ||
132 | 117 | ||
118 | ACPI_FUNCTION_NAME("ns_dump_root_devices"); | ||
133 | 119 | ||
134 | /* Only dump the table if tracing is enabled */ | 120 | /* Only dump the table if tracing is enabled */ |
135 | 121 | ||
@@ -138,19 +124,17 @@ acpi_ns_dump_root_devices ( | |||
138 | } | 124 | } |
139 | 125 | ||
140 | status = acpi_get_handle(NULL, ACPI_NS_SYSTEM_BUS, &sys_bus_handle); | 126 | status = acpi_get_handle(NULL, ACPI_NS_SYSTEM_BUS, &sys_bus_handle); |
141 | if (ACPI_FAILURE (status)) { | 127 | if (ACPI_FAILURE(status)) { |
142 | return; | 128 | return; |
143 | } | 129 | } |
144 | 130 | ||
145 | ACPI_DEBUG_PRINT ((ACPI_DB_TABLES, | 131 | ACPI_DEBUG_PRINT((ACPI_DB_TABLES, |
146 | "Display of all devices in the namespace:\n")); | 132 | "Display of all devices in the namespace:\n")); |
147 | 133 | ||
148 | status = acpi_ns_walk_namespace (ACPI_TYPE_DEVICE, sys_bus_handle, | 134 | status = acpi_ns_walk_namespace(ACPI_TYPE_DEVICE, sys_bus_handle, |
149 | ACPI_UINT32_MAX, ACPI_NS_WALK_NO_UNLOCK, | 135 | ACPI_UINT32_MAX, ACPI_NS_WALK_NO_UNLOCK, |
150 | acpi_ns_dump_one_device, NULL, NULL); | 136 | acpi_ns_dump_one_device, NULL, NULL); |
151 | } | 137 | } |
152 | 138 | ||
153 | #endif | 139 | #endif |
154 | #endif | 140 | #endif |
155 | |||
156 | |||
diff --git a/drivers/acpi/namespace/nseval.c b/drivers/acpi/namespace/nseval.c index 908cffd5e720..0191c7d92824 100644 --- a/drivers/acpi/namespace/nseval.c +++ b/drivers/acpi/namespace/nseval.c | |||
@@ -42,26 +42,19 @@ | |||
42 | * POSSIBILITY OF SUCH DAMAGES. | 42 | * POSSIBILITY OF SUCH DAMAGES. |
43 | */ | 43 | */ |
44 | 44 | ||
45 | |||
46 | #include <acpi/acpi.h> | 45 | #include <acpi/acpi.h> |
47 | #include <acpi/acparser.h> | 46 | #include <acpi/acparser.h> |
48 | #include <acpi/acinterp.h> | 47 | #include <acpi/acinterp.h> |
49 | #include <acpi/acnamesp.h> | 48 | #include <acpi/acnamesp.h> |
50 | 49 | ||
51 | |||
52 | #define _COMPONENT ACPI_NAMESPACE | 50 | #define _COMPONENT ACPI_NAMESPACE |
53 | ACPI_MODULE_NAME ("nseval") | 51 | ACPI_MODULE_NAME("nseval") |
54 | 52 | ||
55 | /* Local prototypes */ | 53 | /* Local prototypes */ |
56 | |||
57 | static acpi_status | 54 | static acpi_status |
58 | acpi_ns_execute_control_method ( | 55 | acpi_ns_execute_control_method(struct acpi_parameter_info *info); |
59 | struct acpi_parameter_info *info); | ||
60 | |||
61 | static acpi_status | ||
62 | acpi_ns_get_object_value ( | ||
63 | struct acpi_parameter_info *info); | ||
64 | 56 | ||
57 | static acpi_status acpi_ns_get_object_value(struct acpi_parameter_info *info); | ||
65 | 58 | ||
66 | /******************************************************************************* | 59 | /******************************************************************************* |
67 | * | 60 | * |
@@ -85,48 +78,44 @@ acpi_ns_get_object_value ( | |||
85 | ******************************************************************************/ | 78 | ******************************************************************************/ |
86 | 79 | ||
87 | acpi_status | 80 | acpi_status |
88 | acpi_ns_evaluate_relative ( | 81 | acpi_ns_evaluate_relative(char *pathname, struct acpi_parameter_info *info) |
89 | char *pathname, | ||
90 | struct acpi_parameter_info *info) | ||
91 | { | 82 | { |
92 | acpi_status status; | 83 | acpi_status status; |
93 | struct acpi_namespace_node *node = NULL; | 84 | struct acpi_namespace_node *node = NULL; |
94 | union acpi_generic_state *scope_info; | 85 | union acpi_generic_state *scope_info; |
95 | char *internal_path = NULL; | 86 | char *internal_path = NULL; |
96 | |||
97 | |||
98 | ACPI_FUNCTION_TRACE ("ns_evaluate_relative"); | ||
99 | 87 | ||
88 | ACPI_FUNCTION_TRACE("ns_evaluate_relative"); | ||
100 | 89 | ||
101 | /* | 90 | /* |
102 | * Must have a valid object handle | 91 | * Must have a valid object handle |
103 | */ | 92 | */ |
104 | if (!info || !info->node) { | 93 | if (!info || !info->node) { |
105 | return_ACPI_STATUS (AE_BAD_PARAMETER); | 94 | return_ACPI_STATUS(AE_BAD_PARAMETER); |
106 | } | 95 | } |
107 | 96 | ||
108 | /* Build an internal name string for the method */ | 97 | /* Build an internal name string for the method */ |
109 | 98 | ||
110 | status = acpi_ns_internalize_name (pathname, &internal_path); | 99 | status = acpi_ns_internalize_name(pathname, &internal_path); |
111 | if (ACPI_FAILURE (status)) { | 100 | if (ACPI_FAILURE(status)) { |
112 | return_ACPI_STATUS (status); | 101 | return_ACPI_STATUS(status); |
113 | } | 102 | } |
114 | 103 | ||
115 | scope_info = acpi_ut_create_generic_state (); | 104 | scope_info = acpi_ut_create_generic_state(); |
116 | if (!scope_info) { | 105 | if (!scope_info) { |
117 | goto cleanup1; | 106 | goto cleanup1; |
118 | } | 107 | } |
119 | 108 | ||
120 | /* Get the prefix handle and Node */ | 109 | /* Get the prefix handle and Node */ |
121 | 110 | ||
122 | status = acpi_ut_acquire_mutex (ACPI_MTX_NAMESPACE); | 111 | status = acpi_ut_acquire_mutex(ACPI_MTX_NAMESPACE); |
123 | if (ACPI_FAILURE (status)) { | 112 | if (ACPI_FAILURE(status)) { |
124 | goto cleanup; | 113 | goto cleanup; |
125 | } | 114 | } |
126 | 115 | ||
127 | info->node = acpi_ns_map_handle_to_node (info->node); | 116 | info->node = acpi_ns_map_handle_to_node(info->node); |
128 | if (!info->node) { | 117 | if (!info->node) { |
129 | (void) acpi_ut_release_mutex (ACPI_MTX_NAMESPACE); | 118 | (void)acpi_ut_release_mutex(ACPI_MTX_NAMESPACE); |
130 | status = AE_BAD_PARAMETER; | 119 | status = AE_BAD_PARAMETER; |
131 | goto cleanup; | 120 | goto cleanup; |
132 | } | 121 | } |
@@ -134,39 +123,38 @@ acpi_ns_evaluate_relative ( | |||
134 | /* Lookup the name in the namespace */ | 123 | /* Lookup the name in the namespace */ |
135 | 124 | ||
136 | scope_info->scope.node = info->node; | 125 | scope_info->scope.node = info->node; |
137 | status = acpi_ns_lookup (scope_info, internal_path, ACPI_TYPE_ANY, | 126 | status = acpi_ns_lookup(scope_info, internal_path, ACPI_TYPE_ANY, |
138 | ACPI_IMODE_EXECUTE, ACPI_NS_NO_UPSEARCH, NULL, | 127 | ACPI_IMODE_EXECUTE, ACPI_NS_NO_UPSEARCH, NULL, |
139 | &node); | 128 | &node); |
140 | 129 | ||
141 | (void) acpi_ut_release_mutex (ACPI_MTX_NAMESPACE); | 130 | (void)acpi_ut_release_mutex(ACPI_MTX_NAMESPACE); |
142 | 131 | ||
143 | if (ACPI_FAILURE (status)) { | 132 | if (ACPI_FAILURE(status)) { |
144 | ACPI_DEBUG_PRINT ((ACPI_DB_NAMES, "Object [%s] not found [%s]\n", | 133 | ACPI_DEBUG_PRINT((ACPI_DB_NAMES, "Object [%s] not found [%s]\n", |
145 | pathname, acpi_format_exception (status))); | 134 | pathname, acpi_format_exception(status))); |
146 | goto cleanup; | 135 | goto cleanup; |
147 | } | 136 | } |
148 | 137 | ||
149 | /* | 138 | /* |
150 | * Now that we have a handle to the object, we can attempt to evaluate it. | 139 | * Now that we have a handle to the object, we can attempt to evaluate it. |
151 | */ | 140 | */ |
152 | ACPI_DEBUG_PRINT ((ACPI_DB_NAMES, "%s [%p] Value %p\n", | 141 | ACPI_DEBUG_PRINT((ACPI_DB_NAMES, "%s [%p] Value %p\n", |
153 | pathname, node, acpi_ns_get_attached_object (node))); | 142 | pathname, node, acpi_ns_get_attached_object(node))); |
154 | 143 | ||
155 | info->node = node; | 144 | info->node = node; |
156 | status = acpi_ns_evaluate_by_handle (info); | 145 | status = acpi_ns_evaluate_by_handle(info); |
157 | 146 | ||
158 | ACPI_DEBUG_PRINT ((ACPI_DB_NAMES, "*** Completed eval of object %s ***\n", | 147 | ACPI_DEBUG_PRINT((ACPI_DB_NAMES, |
159 | pathname)); | 148 | "*** Completed eval of object %s ***\n", pathname)); |
160 | 149 | ||
161 | cleanup: | 150 | cleanup: |
162 | acpi_ut_delete_generic_state (scope_info); | 151 | acpi_ut_delete_generic_state(scope_info); |
163 | 152 | ||
164 | cleanup1: | 153 | cleanup1: |
165 | ACPI_MEM_FREE (internal_path); | 154 | ACPI_MEM_FREE(internal_path); |
166 | return_ACPI_STATUS (status); | 155 | return_ACPI_STATUS(status); |
167 | } | 156 | } |
168 | 157 | ||
169 | |||
170 | /******************************************************************************* | 158 | /******************************************************************************* |
171 | * | 159 | * |
172 | * FUNCTION: acpi_ns_evaluate_by_name | 160 | * FUNCTION: acpi_ns_evaluate_by_name |
@@ -189,68 +177,63 @@ cleanup1: | |||
189 | ******************************************************************************/ | 177 | ******************************************************************************/ |
190 | 178 | ||
191 | acpi_status | 179 | acpi_status |
192 | acpi_ns_evaluate_by_name ( | 180 | acpi_ns_evaluate_by_name(char *pathname, struct acpi_parameter_info *info) |
193 | char *pathname, | ||
194 | struct acpi_parameter_info *info) | ||
195 | { | 181 | { |
196 | acpi_status status; | 182 | acpi_status status; |
197 | char *internal_path = NULL; | 183 | char *internal_path = NULL; |
198 | |||
199 | |||
200 | ACPI_FUNCTION_TRACE ("ns_evaluate_by_name"); | ||
201 | 184 | ||
185 | ACPI_FUNCTION_TRACE("ns_evaluate_by_name"); | ||
202 | 186 | ||
203 | /* Build an internal name string for the method */ | 187 | /* Build an internal name string for the method */ |
204 | 188 | ||
205 | status = acpi_ns_internalize_name (pathname, &internal_path); | 189 | status = acpi_ns_internalize_name(pathname, &internal_path); |
206 | if (ACPI_FAILURE (status)) { | 190 | if (ACPI_FAILURE(status)) { |
207 | return_ACPI_STATUS (status); | 191 | return_ACPI_STATUS(status); |
208 | } | 192 | } |
209 | 193 | ||
210 | status = acpi_ut_acquire_mutex (ACPI_MTX_NAMESPACE); | 194 | status = acpi_ut_acquire_mutex(ACPI_MTX_NAMESPACE); |
211 | if (ACPI_FAILURE (status)) { | 195 | if (ACPI_FAILURE(status)) { |
212 | goto cleanup; | 196 | goto cleanup; |
213 | } | 197 | } |
214 | 198 | ||
215 | /* Lookup the name in the namespace */ | 199 | /* Lookup the name in the namespace */ |
216 | 200 | ||
217 | status = acpi_ns_lookup (NULL, internal_path, ACPI_TYPE_ANY, | 201 | status = acpi_ns_lookup(NULL, internal_path, ACPI_TYPE_ANY, |
218 | ACPI_IMODE_EXECUTE, ACPI_NS_NO_UPSEARCH, NULL, | 202 | ACPI_IMODE_EXECUTE, ACPI_NS_NO_UPSEARCH, NULL, |
219 | &info->node); | 203 | &info->node); |
220 | 204 | ||
221 | (void) acpi_ut_release_mutex (ACPI_MTX_NAMESPACE); | 205 | (void)acpi_ut_release_mutex(ACPI_MTX_NAMESPACE); |
222 | 206 | ||
223 | if (ACPI_FAILURE (status)) { | 207 | if (ACPI_FAILURE(status)) { |
224 | ACPI_DEBUG_PRINT ((ACPI_DB_NAMES, | 208 | ACPI_DEBUG_PRINT((ACPI_DB_NAMES, |
225 | "Object at [%s] was not found, status=%.4X\n", | 209 | "Object at [%s] was not found, status=%.4X\n", |
226 | pathname, status)); | 210 | pathname, status)); |
227 | goto cleanup; | 211 | goto cleanup; |
228 | } | 212 | } |
229 | 213 | ||
230 | /* | 214 | /* |
231 | * Now that we have a handle to the object, we can attempt to evaluate it. | 215 | * Now that we have a handle to the object, we can attempt to evaluate it. |
232 | */ | 216 | */ |
233 | ACPI_DEBUG_PRINT ((ACPI_DB_NAMES, "%s [%p] Value %p\n", | 217 | ACPI_DEBUG_PRINT((ACPI_DB_NAMES, "%s [%p] Value %p\n", |
234 | pathname, info->node, acpi_ns_get_attached_object (info->node))); | 218 | pathname, info->node, |
235 | 219 | acpi_ns_get_attached_object(info->node))); | |
236 | status = acpi_ns_evaluate_by_handle (info); | ||
237 | 220 | ||
238 | ACPI_DEBUG_PRINT ((ACPI_DB_NAMES, "*** Completed eval of object %s ***\n", | 221 | status = acpi_ns_evaluate_by_handle(info); |
239 | pathname)); | ||
240 | 222 | ||
223 | ACPI_DEBUG_PRINT((ACPI_DB_NAMES, | ||
224 | "*** Completed eval of object %s ***\n", pathname)); | ||
241 | 225 | ||
242 | cleanup: | 226 | cleanup: |
243 | 227 | ||
244 | /* Cleanup */ | 228 | /* Cleanup */ |
245 | 229 | ||
246 | if (internal_path) { | 230 | if (internal_path) { |
247 | ACPI_MEM_FREE (internal_path); | 231 | ACPI_MEM_FREE(internal_path); |
248 | } | 232 | } |
249 | 233 | ||
250 | return_ACPI_STATUS (status); | 234 | return_ACPI_STATUS(status); |
251 | } | 235 | } |
252 | 236 | ||
253 | |||
254 | /******************************************************************************* | 237 | /******************************************************************************* |
255 | * | 238 | * |
256 | * FUNCTION: acpi_ns_evaluate_by_handle | 239 | * FUNCTION: acpi_ns_evaluate_by_handle |
@@ -275,26 +258,22 @@ cleanup: | |||
275 | * | 258 | * |
276 | ******************************************************************************/ | 259 | ******************************************************************************/ |
277 | 260 | ||
278 | acpi_status | 261 | acpi_status acpi_ns_evaluate_by_handle(struct acpi_parameter_info *info) |
279 | acpi_ns_evaluate_by_handle ( | ||
280 | struct acpi_parameter_info *info) | ||
281 | { | 262 | { |
282 | acpi_status status; | 263 | acpi_status status; |
283 | |||
284 | |||
285 | ACPI_FUNCTION_TRACE ("ns_evaluate_by_handle"); | ||
286 | 264 | ||
265 | ACPI_FUNCTION_TRACE("ns_evaluate_by_handle"); | ||
287 | 266 | ||
288 | /* Check if namespace has been initialized */ | 267 | /* Check if namespace has been initialized */ |
289 | 268 | ||
290 | if (!acpi_gbl_root_node) { | 269 | if (!acpi_gbl_root_node) { |
291 | return_ACPI_STATUS (AE_NO_NAMESPACE); | 270 | return_ACPI_STATUS(AE_NO_NAMESPACE); |
292 | } | 271 | } |
293 | 272 | ||
294 | /* Parameter Validation */ | 273 | /* Parameter Validation */ |
295 | 274 | ||
296 | if (!info) { | 275 | if (!info) { |
297 | return_ACPI_STATUS (AE_BAD_PARAMETER); | 276 | return_ACPI_STATUS(AE_BAD_PARAMETER); |
298 | } | 277 | } |
299 | 278 | ||
300 | /* Initialize the return value to an invalid object */ | 279 | /* Initialize the return value to an invalid object */ |
@@ -303,23 +282,25 @@ acpi_ns_evaluate_by_handle ( | |||
303 | 282 | ||
304 | /* Get the prefix handle and Node */ | 283 | /* Get the prefix handle and Node */ |
305 | 284 | ||
306 | status = acpi_ut_acquire_mutex (ACPI_MTX_NAMESPACE); | 285 | status = acpi_ut_acquire_mutex(ACPI_MTX_NAMESPACE); |
307 | if (ACPI_FAILURE (status)) { | 286 | if (ACPI_FAILURE(status)) { |
308 | return_ACPI_STATUS (status); | 287 | return_ACPI_STATUS(status); |
309 | } | 288 | } |
310 | 289 | ||
311 | info->node = acpi_ns_map_handle_to_node (info->node); | 290 | info->node = acpi_ns_map_handle_to_node(info->node); |
312 | if (!info->node) { | 291 | if (!info->node) { |
313 | (void) acpi_ut_release_mutex (ACPI_MTX_NAMESPACE); | 292 | (void)acpi_ut_release_mutex(ACPI_MTX_NAMESPACE); |
314 | return_ACPI_STATUS (AE_BAD_PARAMETER); | 293 | return_ACPI_STATUS(AE_BAD_PARAMETER); |
315 | } | 294 | } |
316 | 295 | ||
317 | /* | 296 | /* |
318 | * For a method alias, we must grab the actual method node so that proper | 297 | * For a method alias, we must grab the actual method node so that proper |
319 | * scoping context will be established before execution. | 298 | * scoping context will be established before execution. |
320 | */ | 299 | */ |
321 | if (acpi_ns_get_type (info->node) == ACPI_TYPE_LOCAL_METHOD_ALIAS) { | 300 | if (acpi_ns_get_type(info->node) == ACPI_TYPE_LOCAL_METHOD_ALIAS) { |
322 | info->node = ACPI_CAST_PTR (struct acpi_namespace_node, info->node->object); | 301 | info->node = |
302 | ACPI_CAST_PTR(struct acpi_namespace_node, | ||
303 | info->node->object); | ||
323 | } | 304 | } |
324 | 305 | ||
325 | /* | 306 | /* |
@@ -329,17 +310,16 @@ acpi_ns_evaluate_by_handle ( | |||
329 | * | 310 | * |
330 | * In both cases, the namespace is unlocked by the acpi_ns* procedure | 311 | * In both cases, the namespace is unlocked by the acpi_ns* procedure |
331 | */ | 312 | */ |
332 | if (acpi_ns_get_type (info->node) == ACPI_TYPE_METHOD) { | 313 | if (acpi_ns_get_type(info->node) == ACPI_TYPE_METHOD) { |
333 | /* | 314 | /* |
334 | * Case 1) We have an actual control method to execute | 315 | * Case 1) We have an actual control method to execute |
335 | */ | 316 | */ |
336 | status = acpi_ns_execute_control_method (info); | 317 | status = acpi_ns_execute_control_method(info); |
337 | } | 318 | } else { |
338 | else { | ||
339 | /* | 319 | /* |
340 | * Case 2) Object is NOT a method, just return its current value | 320 | * Case 2) Object is NOT a method, just return its current value |
341 | */ | 321 | */ |
342 | status = acpi_ns_get_object_value (info); | 322 | status = acpi_ns_get_object_value(info); |
343 | } | 323 | } |
344 | 324 | ||
345 | /* | 325 | /* |
@@ -355,10 +335,9 @@ acpi_ns_evaluate_by_handle ( | |||
355 | * Namespace was unlocked by the handling acpi_ns* function, so we | 335 | * Namespace was unlocked by the handling acpi_ns* function, so we |
356 | * just return | 336 | * just return |
357 | */ | 337 | */ |
358 | return_ACPI_STATUS (status); | 338 | return_ACPI_STATUS(status); |
359 | } | 339 | } |
360 | 340 | ||
361 | |||
362 | /******************************************************************************* | 341 | /******************************************************************************* |
363 | * | 342 | * |
364 | * FUNCTION: acpi_ns_execute_control_method | 343 | * FUNCTION: acpi_ns_execute_control_method |
@@ -384,30 +363,29 @@ acpi_ns_evaluate_by_handle ( | |||
384 | ******************************************************************************/ | 363 | ******************************************************************************/ |
385 | 364 | ||
386 | static acpi_status | 365 | static acpi_status |
387 | acpi_ns_execute_control_method ( | 366 | acpi_ns_execute_control_method(struct acpi_parameter_info *info) |
388 | struct acpi_parameter_info *info) | ||
389 | { | 367 | { |
390 | acpi_status status; | 368 | acpi_status status; |
391 | |||
392 | |||
393 | ACPI_FUNCTION_TRACE ("ns_execute_control_method"); | ||
394 | 369 | ||
370 | ACPI_FUNCTION_TRACE("ns_execute_control_method"); | ||
395 | 371 | ||
396 | /* Verify that there is a method associated with this object */ | 372 | /* Verify that there is a method associated with this object */ |
397 | 373 | ||
398 | info->obj_desc = acpi_ns_get_attached_object (info->node); | 374 | info->obj_desc = acpi_ns_get_attached_object(info->node); |
399 | if (!info->obj_desc) { | 375 | if (!info->obj_desc) { |
400 | ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, "No attached method object\n")); | 376 | ACPI_DEBUG_PRINT((ACPI_DB_ERROR, |
377 | "No attached method object\n")); | ||
401 | 378 | ||
402 | (void) acpi_ut_release_mutex (ACPI_MTX_NAMESPACE); | 379 | (void)acpi_ut_release_mutex(ACPI_MTX_NAMESPACE); |
403 | return_ACPI_STATUS (AE_NULL_OBJECT); | 380 | return_ACPI_STATUS(AE_NULL_OBJECT); |
404 | } | 381 | } |
405 | 382 | ||
406 | ACPI_DUMP_PATHNAME (info->node, "Execute Method:", | 383 | ACPI_DUMP_PATHNAME(info->node, "Execute Method:", |
407 | ACPI_LV_INFO, _COMPONENT); | 384 | ACPI_LV_INFO, _COMPONENT); |
408 | 385 | ||
409 | ACPI_DEBUG_PRINT ((ACPI_DB_EXEC, "Method at AML address %p Length %X\n", | 386 | ACPI_DEBUG_PRINT((ACPI_DB_EXEC, "Method at AML address %p Length %X\n", |
410 | info->obj_desc->method.aml_start + 1, info->obj_desc->method.aml_length - 1)); | 387 | info->obj_desc->method.aml_start + 1, |
388 | info->obj_desc->method.aml_length - 1)); | ||
411 | 389 | ||
412 | /* | 390 | /* |
413 | * Unlock the namespace before execution. This allows namespace access | 391 | * Unlock the namespace before execution. This allows namespace access |
@@ -416,27 +394,26 @@ acpi_ns_execute_control_method ( | |||
416 | * interpreter locks to ensure that no thread is using the portion of the | 394 | * interpreter locks to ensure that no thread is using the portion of the |
417 | * namespace that is being deleted. | 395 | * namespace that is being deleted. |
418 | */ | 396 | */ |
419 | status = acpi_ut_release_mutex (ACPI_MTX_NAMESPACE); | 397 | status = acpi_ut_release_mutex(ACPI_MTX_NAMESPACE); |
420 | if (ACPI_FAILURE (status)) { | 398 | if (ACPI_FAILURE(status)) { |
421 | return_ACPI_STATUS (status); | 399 | return_ACPI_STATUS(status); |
422 | } | 400 | } |
423 | 401 | ||
424 | /* | 402 | /* |
425 | * Execute the method via the interpreter. The interpreter is locked | 403 | * Execute the method via the interpreter. The interpreter is locked |
426 | * here before calling into the AML parser | 404 | * here before calling into the AML parser |
427 | */ | 405 | */ |
428 | status = acpi_ex_enter_interpreter (); | 406 | status = acpi_ex_enter_interpreter(); |
429 | if (ACPI_FAILURE (status)) { | 407 | if (ACPI_FAILURE(status)) { |
430 | return_ACPI_STATUS (status); | 408 | return_ACPI_STATUS(status); |
431 | } | 409 | } |
432 | 410 | ||
433 | status = acpi_ps_execute_method (info); | 411 | status = acpi_ps_execute_method(info); |
434 | acpi_ex_exit_interpreter (); | 412 | acpi_ex_exit_interpreter(); |
435 | 413 | ||
436 | return_ACPI_STATUS (status); | 414 | return_ACPI_STATUS(status); |
437 | } | 415 | } |
438 | 416 | ||
439 | |||
440 | /******************************************************************************* | 417 | /******************************************************************************* |
441 | * | 418 | * |
442 | * FUNCTION: acpi_ns_get_object_value | 419 | * FUNCTION: acpi_ns_get_object_value |
@@ -454,16 +431,12 @@ acpi_ns_execute_control_method ( | |||
454 | * | 431 | * |
455 | ******************************************************************************/ | 432 | ******************************************************************************/ |
456 | 433 | ||
457 | static acpi_status | 434 | static acpi_status acpi_ns_get_object_value(struct acpi_parameter_info *info) |
458 | acpi_ns_get_object_value ( | ||
459 | struct acpi_parameter_info *info) | ||
460 | { | 435 | { |
461 | acpi_status status = AE_OK; | 436 | acpi_status status = AE_OK; |
462 | struct acpi_namespace_node *resolved_node = info->node; | 437 | struct acpi_namespace_node *resolved_node = info->node; |
463 | |||
464 | |||
465 | ACPI_FUNCTION_TRACE ("ns_get_object_value"); | ||
466 | 438 | ||
439 | ACPI_FUNCTION_TRACE("ns_get_object_value"); | ||
467 | 440 | ||
468 | /* | 441 | /* |
469 | * Objects require additional resolution steps (e.g., the Node may be a | 442 | * Objects require additional resolution steps (e.g., the Node may be a |
@@ -486,32 +459,33 @@ acpi_ns_get_object_value ( | |||
486 | * | 459 | * |
487 | * We must release the namespace lock before entering the intepreter. | 460 | * We must release the namespace lock before entering the intepreter. |
488 | */ | 461 | */ |
489 | status = acpi_ut_release_mutex (ACPI_MTX_NAMESPACE); | 462 | status = acpi_ut_release_mutex(ACPI_MTX_NAMESPACE); |
490 | if (ACPI_FAILURE (status)) { | 463 | if (ACPI_FAILURE(status)) { |
491 | return_ACPI_STATUS (status); | 464 | return_ACPI_STATUS(status); |
492 | } | 465 | } |
493 | 466 | ||
494 | status = acpi_ex_enter_interpreter (); | 467 | status = acpi_ex_enter_interpreter(); |
495 | if (ACPI_SUCCESS (status)) { | 468 | if (ACPI_SUCCESS(status)) { |
496 | status = acpi_ex_resolve_node_to_value (&resolved_node, NULL); | 469 | status = acpi_ex_resolve_node_to_value(&resolved_node, NULL); |
497 | /* | 470 | /* |
498 | * If acpi_ex_resolve_node_to_value() succeeded, the return value was placed | 471 | * If acpi_ex_resolve_node_to_value() succeeded, the return value was placed |
499 | * in resolved_node. | 472 | * in resolved_node. |
500 | */ | 473 | */ |
501 | acpi_ex_exit_interpreter (); | 474 | acpi_ex_exit_interpreter(); |
502 | 475 | ||
503 | if (ACPI_SUCCESS (status)) { | 476 | if (ACPI_SUCCESS(status)) { |
504 | status = AE_CTRL_RETURN_VALUE; | 477 | status = AE_CTRL_RETURN_VALUE; |
505 | info->return_object = ACPI_CAST_PTR | 478 | info->return_object = ACPI_CAST_PTR |
506 | (union acpi_operand_object, resolved_node); | 479 | (union acpi_operand_object, resolved_node); |
507 | ACPI_DEBUG_PRINT ((ACPI_DB_NAMES, "Returning object %p [%s]\n", | 480 | ACPI_DEBUG_PRINT((ACPI_DB_NAMES, |
508 | info->return_object, | 481 | "Returning object %p [%s]\n", |
509 | acpi_ut_get_object_type_name (info->return_object))); | 482 | info->return_object, |
483 | acpi_ut_get_object_type_name(info-> | ||
484 | return_object))); | ||
510 | } | 485 | } |
511 | } | 486 | } |
512 | 487 | ||
513 | /* Namespace is unlocked */ | 488 | /* Namespace is unlocked */ |
514 | 489 | ||
515 | return_ACPI_STATUS (status); | 490 | return_ACPI_STATUS(status); |
516 | } | 491 | } |
517 | |||
diff --git a/drivers/acpi/namespace/nsinit.c b/drivers/acpi/namespace/nsinit.c index 362802ae29a2..0a08d2f04a06 100644 --- a/drivers/acpi/namespace/nsinit.c +++ b/drivers/acpi/namespace/nsinit.c | |||
@@ -41,31 +41,22 @@ | |||
41 | * POSSIBILITY OF SUCH DAMAGES. | 41 | * POSSIBILITY OF SUCH DAMAGES. |
42 | */ | 42 | */ |
43 | 43 | ||
44 | |||
45 | #include <acpi/acpi.h> | 44 | #include <acpi/acpi.h> |
46 | #include <acpi/acnamesp.h> | 45 | #include <acpi/acnamesp.h> |
47 | #include <acpi/acdispat.h> | 46 | #include <acpi/acdispat.h> |
48 | #include <acpi/acinterp.h> | 47 | #include <acpi/acinterp.h> |
49 | 48 | ||
50 | #define _COMPONENT ACPI_NAMESPACE | 49 | #define _COMPONENT ACPI_NAMESPACE |
51 | ACPI_MODULE_NAME ("nsinit") | 50 | ACPI_MODULE_NAME("nsinit") |
52 | 51 | ||
53 | /* Local prototypes */ | 52 | /* Local prototypes */ |
54 | |||
55 | static acpi_status | 53 | static acpi_status |
56 | acpi_ns_init_one_object ( | 54 | acpi_ns_init_one_object(acpi_handle obj_handle, |
57 | acpi_handle obj_handle, | 55 | u32 level, void *context, void **return_value); |
58 | u32 level, | ||
59 | void *context, | ||
60 | void **return_value); | ||
61 | 56 | ||
62 | static acpi_status | 57 | static acpi_status |
63 | acpi_ns_init_one_device ( | 58 | acpi_ns_init_one_device(acpi_handle obj_handle, |
64 | acpi_handle obj_handle, | 59 | u32 nesting_level, void *context, void **return_value); |
65 | u32 nesting_level, | ||
66 | void *context, | ||
67 | void **return_value); | ||
68 | |||
69 | 60 | ||
70 | /******************************************************************************* | 61 | /******************************************************************************* |
71 | * | 62 | * |
@@ -80,52 +71,48 @@ acpi_ns_init_one_device ( | |||
80 | * | 71 | * |
81 | ******************************************************************************/ | 72 | ******************************************************************************/ |
82 | 73 | ||
83 | acpi_status | 74 | acpi_status acpi_ns_initialize_objects(void) |
84 | acpi_ns_initialize_objects ( | ||
85 | void) | ||
86 | { | 75 | { |
87 | acpi_status status; | 76 | acpi_status status; |
88 | struct acpi_init_walk_info info; | 77 | struct acpi_init_walk_info info; |
89 | |||
90 | 78 | ||
91 | ACPI_FUNCTION_TRACE ("ns_initialize_objects"); | 79 | ACPI_FUNCTION_TRACE("ns_initialize_objects"); |
92 | 80 | ||
93 | 81 | ACPI_DEBUG_PRINT((ACPI_DB_DISPATCH, | |
94 | ACPI_DEBUG_PRINT ((ACPI_DB_DISPATCH, | 82 | "**** Starting initialization of namespace objects ****\n")); |
95 | "**** Starting initialization of namespace objects ****\n")); | 83 | ACPI_DEBUG_PRINT_RAW((ACPI_DB_INIT, |
96 | ACPI_DEBUG_PRINT_RAW ((ACPI_DB_INIT, | 84 | "Completing Region/Field/Buffer/Package initialization:")); |
97 | "Completing Region/Field/Buffer/Package initialization:")); | ||
98 | 85 | ||
99 | /* Set all init info to zero */ | 86 | /* Set all init info to zero */ |
100 | 87 | ||
101 | ACPI_MEMSET (&info, 0, sizeof (struct acpi_init_walk_info)); | 88 | ACPI_MEMSET(&info, 0, sizeof(struct acpi_init_walk_info)); |
102 | 89 | ||
103 | /* Walk entire namespace from the supplied root */ | 90 | /* Walk entire namespace from the supplied root */ |
104 | 91 | ||
105 | status = acpi_walk_namespace (ACPI_TYPE_ANY, ACPI_ROOT_OBJECT, | 92 | status = acpi_walk_namespace(ACPI_TYPE_ANY, ACPI_ROOT_OBJECT, |
106 | ACPI_UINT32_MAX, acpi_ns_init_one_object, | 93 | ACPI_UINT32_MAX, acpi_ns_init_one_object, |
107 | &info, NULL); | 94 | &info, NULL); |
108 | if (ACPI_FAILURE (status)) { | 95 | if (ACPI_FAILURE(status)) { |
109 | ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, "walk_namespace failed! %s\n", | 96 | ACPI_DEBUG_PRINT((ACPI_DB_ERROR, "walk_namespace failed! %s\n", |
110 | acpi_format_exception (status))); | 97 | acpi_format_exception(status))); |
111 | } | 98 | } |
112 | 99 | ||
113 | ACPI_DEBUG_PRINT_RAW ((ACPI_DB_INIT, | 100 | ACPI_DEBUG_PRINT_RAW((ACPI_DB_INIT, |
114 | "\nInitialized %hd/%hd Regions %hd/%hd Fields %hd/%hd Buffers %hd/%hd Packages (%hd nodes)\n", | 101 | "\nInitialized %hd/%hd Regions %hd/%hd Fields %hd/%hd Buffers %hd/%hd Packages (%hd nodes)\n", |
115 | info.op_region_init, info.op_region_count, | 102 | info.op_region_init, info.op_region_count, |
116 | info.field_init, info.field_count, | 103 | info.field_init, info.field_count, |
117 | info.buffer_init, info.buffer_count, | 104 | info.buffer_init, info.buffer_count, |
118 | info.package_init, info.package_count, info.object_count)); | 105 | info.package_init, info.package_count, |
106 | info.object_count)); | ||
119 | 107 | ||
120 | ACPI_DEBUG_PRINT ((ACPI_DB_DISPATCH, | 108 | ACPI_DEBUG_PRINT((ACPI_DB_DISPATCH, |
121 | "%hd Control Methods found\n", info.method_count)); | 109 | "%hd Control Methods found\n", info.method_count)); |
122 | ACPI_DEBUG_PRINT ((ACPI_DB_DISPATCH, | 110 | ACPI_DEBUG_PRINT((ACPI_DB_DISPATCH, |
123 | "%hd Op Regions found\n", info.op_region_count)); | 111 | "%hd Op Regions found\n", info.op_region_count)); |
124 | 112 | ||
125 | return_ACPI_STATUS (AE_OK); | 113 | return_ACPI_STATUS(AE_OK); |
126 | } | 114 | } |
127 | 115 | ||
128 | |||
129 | /******************************************************************************* | 116 | /******************************************************************************* |
130 | * | 117 | * |
131 | * FUNCTION: acpi_ns_initialize_devices | 118 | * FUNCTION: acpi_ns_initialize_devices |
@@ -142,16 +129,12 @@ acpi_ns_initialize_objects ( | |||
142 | * | 129 | * |
143 | ******************************************************************************/ | 130 | ******************************************************************************/ |
144 | 131 | ||
145 | acpi_status | 132 | acpi_status acpi_ns_initialize_devices(void) |
146 | acpi_ns_initialize_devices ( | ||
147 | void) | ||
148 | { | 133 | { |
149 | acpi_status status; | 134 | acpi_status status; |
150 | struct acpi_device_walk_info info; | 135 | struct acpi_device_walk_info info; |
151 | |||
152 | |||
153 | ACPI_FUNCTION_TRACE ("ns_initialize_devices"); | ||
154 | 136 | ||
137 | ACPI_FUNCTION_TRACE("ns_initialize_devices"); | ||
155 | 138 | ||
156 | /* Init counters */ | 139 | /* Init counters */ |
157 | 140 | ||
@@ -159,34 +142,34 @@ acpi_ns_initialize_devices ( | |||
159 | info.num_STA = 0; | 142 | info.num_STA = 0; |
160 | info.num_INI = 0; | 143 | info.num_INI = 0; |
161 | 144 | ||
162 | ACPI_DEBUG_PRINT_RAW ((ACPI_DB_INIT, | 145 | ACPI_DEBUG_PRINT_RAW((ACPI_DB_INIT, |
163 | "Executing all Device _STA and_INI methods:")); | 146 | "Executing all Device _STA and_INI methods:")); |
164 | 147 | ||
165 | status = acpi_ut_acquire_mutex (ACPI_MTX_NAMESPACE); | 148 | status = acpi_ut_acquire_mutex(ACPI_MTX_NAMESPACE); |
166 | if (ACPI_FAILURE (status)) { | 149 | if (ACPI_FAILURE(status)) { |
167 | return_ACPI_STATUS (status); | 150 | return_ACPI_STATUS(status); |
168 | } | 151 | } |
169 | 152 | ||
170 | /* Walk namespace for all objects */ | 153 | /* Walk namespace for all objects */ |
171 | 154 | ||
172 | status = acpi_ns_walk_namespace (ACPI_TYPE_ANY, ACPI_ROOT_OBJECT, | 155 | status = acpi_ns_walk_namespace(ACPI_TYPE_ANY, ACPI_ROOT_OBJECT, |
173 | ACPI_UINT32_MAX, TRUE, acpi_ns_init_one_device, &info, NULL); | 156 | ACPI_UINT32_MAX, TRUE, |
157 | acpi_ns_init_one_device, &info, NULL); | ||
174 | 158 | ||
175 | (void) acpi_ut_release_mutex (ACPI_MTX_NAMESPACE); | 159 | (void)acpi_ut_release_mutex(ACPI_MTX_NAMESPACE); |
176 | 160 | ||
177 | if (ACPI_FAILURE (status)) { | 161 | if (ACPI_FAILURE(status)) { |
178 | ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, "walk_namespace failed! %s\n", | 162 | ACPI_DEBUG_PRINT((ACPI_DB_ERROR, "walk_namespace failed! %s\n", |
179 | acpi_format_exception (status))); | 163 | acpi_format_exception(status))); |
180 | } | 164 | } |
181 | 165 | ||
182 | ACPI_DEBUG_PRINT_RAW ((ACPI_DB_INIT, | 166 | ACPI_DEBUG_PRINT_RAW((ACPI_DB_INIT, |
183 | "\n%hd Devices found containing: %hd _STA, %hd _INI methods\n", | 167 | "\n%hd Devices found containing: %hd _STA, %hd _INI methods\n", |
184 | info.device_count, info.num_STA, info.num_INI)); | 168 | info.device_count, info.num_STA, info.num_INI)); |
185 | 169 | ||
186 | return_ACPI_STATUS (status); | 170 | return_ACPI_STATUS(status); |
187 | } | 171 | } |
188 | 172 | ||
189 | |||
190 | /******************************************************************************* | 173 | /******************************************************************************* |
191 | * | 174 | * |
192 | * FUNCTION: acpi_ns_init_one_object | 175 | * FUNCTION: acpi_ns_init_one_object |
@@ -208,28 +191,25 @@ acpi_ns_initialize_devices ( | |||
208 | ******************************************************************************/ | 191 | ******************************************************************************/ |
209 | 192 | ||
210 | static acpi_status | 193 | static acpi_status |
211 | acpi_ns_init_one_object ( | 194 | acpi_ns_init_one_object(acpi_handle obj_handle, |
212 | acpi_handle obj_handle, | 195 | u32 level, void *context, void **return_value) |
213 | u32 level, | ||
214 | void *context, | ||
215 | void **return_value) | ||
216 | { | 196 | { |
217 | acpi_object_type type; | 197 | acpi_object_type type; |
218 | acpi_status status; | 198 | acpi_status status; |
219 | struct acpi_init_walk_info *info = (struct acpi_init_walk_info *) context; | 199 | struct acpi_init_walk_info *info = |
220 | struct acpi_namespace_node *node = (struct acpi_namespace_node *) obj_handle; | 200 | (struct acpi_init_walk_info *)context; |
221 | union acpi_operand_object *obj_desc; | 201 | struct acpi_namespace_node *node = |
222 | 202 | (struct acpi_namespace_node *)obj_handle; | |
223 | 203 | union acpi_operand_object *obj_desc; | |
224 | ACPI_FUNCTION_NAME ("ns_init_one_object"); | ||
225 | 204 | ||
205 | ACPI_FUNCTION_NAME("ns_init_one_object"); | ||
226 | 206 | ||
227 | info->object_count++; | 207 | info->object_count++; |
228 | 208 | ||
229 | /* And even then, we are only interested in a few object types */ | 209 | /* And even then, we are only interested in a few object types */ |
230 | 210 | ||
231 | type = acpi_ns_get_type (obj_handle); | 211 | type = acpi_ns_get_type(obj_handle); |
232 | obj_desc = acpi_ns_get_attached_object (node); | 212 | obj_desc = acpi_ns_get_attached_object(node); |
233 | if (!obj_desc) { | 213 | if (!obj_desc) { |
234 | return (AE_OK); | 214 | return (AE_OK); |
235 | } | 215 | } |
@@ -269,8 +249,8 @@ acpi_ns_init_one_object ( | |||
269 | /* | 249 | /* |
270 | * Must lock the interpreter before executing AML code | 250 | * Must lock the interpreter before executing AML code |
271 | */ | 251 | */ |
272 | status = acpi_ex_enter_interpreter (); | 252 | status = acpi_ex_enter_interpreter(); |
273 | if (ACPI_FAILURE (status)) { | 253 | if (ACPI_FAILURE(status)) { |
274 | return (status); | 254 | return (status); |
275 | } | 255 | } |
276 | 256 | ||
@@ -282,25 +262,25 @@ acpi_ns_init_one_object ( | |||
282 | case ACPI_TYPE_REGION: | 262 | case ACPI_TYPE_REGION: |
283 | 263 | ||
284 | info->op_region_init++; | 264 | info->op_region_init++; |
285 | status = acpi_ds_get_region_arguments (obj_desc); | 265 | status = acpi_ds_get_region_arguments(obj_desc); |
286 | break; | 266 | break; |
287 | 267 | ||
288 | case ACPI_TYPE_BUFFER_FIELD: | 268 | case ACPI_TYPE_BUFFER_FIELD: |
289 | 269 | ||
290 | info->field_init++; | 270 | info->field_init++; |
291 | status = acpi_ds_get_buffer_field_arguments (obj_desc); | 271 | status = acpi_ds_get_buffer_field_arguments(obj_desc); |
292 | break; | 272 | break; |
293 | 273 | ||
294 | case ACPI_TYPE_BUFFER: | 274 | case ACPI_TYPE_BUFFER: |
295 | 275 | ||
296 | info->buffer_init++; | 276 | info->buffer_init++; |
297 | status = acpi_ds_get_buffer_arguments (obj_desc); | 277 | status = acpi_ds_get_buffer_arguments(obj_desc); |
298 | break; | 278 | break; |
299 | 279 | ||
300 | case ACPI_TYPE_PACKAGE: | 280 | case ACPI_TYPE_PACKAGE: |
301 | 281 | ||
302 | info->package_init++; | 282 | info->package_init++; |
303 | status = acpi_ds_get_package_arguments (obj_desc); | 283 | status = acpi_ds_get_package_arguments(obj_desc); |
304 | break; | 284 | break; |
305 | 285 | ||
306 | default: | 286 | default: |
@@ -308,12 +288,13 @@ acpi_ns_init_one_object ( | |||
308 | break; | 288 | break; |
309 | } | 289 | } |
310 | 290 | ||
311 | if (ACPI_FAILURE (status)) { | 291 | if (ACPI_FAILURE(status)) { |
312 | ACPI_DEBUG_PRINT_RAW ((ACPI_DB_ERROR, "\n")); | 292 | ACPI_DEBUG_PRINT_RAW((ACPI_DB_ERROR, "\n")); |
313 | ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, | 293 | ACPI_DEBUG_PRINT((ACPI_DB_ERROR, |
314 | "Could not execute arguments for [%4.4s] (%s), %s\n", | 294 | "Could not execute arguments for [%4.4s] (%s), %s\n", |
315 | acpi_ut_get_node_name (node), acpi_ut_get_type_name (type), | 295 | acpi_ut_get_node_name(node), |
316 | acpi_format_exception (status))); | 296 | acpi_ut_get_type_name(type), |
297 | acpi_format_exception(status))); | ||
317 | } | 298 | } |
318 | 299 | ||
319 | /* | 300 | /* |
@@ -321,18 +302,17 @@ acpi_ns_init_one_object ( | |||
321 | * pathname | 302 | * pathname |
322 | */ | 303 | */ |
323 | if (!(acpi_dbg_level & ACPI_LV_INIT_NAMES)) { | 304 | if (!(acpi_dbg_level & ACPI_LV_INIT_NAMES)) { |
324 | ACPI_DEBUG_PRINT_RAW ((ACPI_DB_INIT, ".")); | 305 | ACPI_DEBUG_PRINT_RAW((ACPI_DB_INIT, ".")); |
325 | } | 306 | } |
326 | 307 | ||
327 | /* | 308 | /* |
328 | * We ignore errors from above, and always return OK, since we don't want | 309 | * We ignore errors from above, and always return OK, since we don't want |
329 | * to abort the walk on any single error. | 310 | * to abort the walk on any single error. |
330 | */ | 311 | */ |
331 | acpi_ex_exit_interpreter (); | 312 | acpi_ex_exit_interpreter(); |
332 | return (AE_OK); | 313 | return (AE_OK); |
333 | } | 314 | } |
334 | 315 | ||
335 | |||
336 | /******************************************************************************* | 316 | /******************************************************************************* |
337 | * | 317 | * |
338 | * FUNCTION: acpi_ns_init_one_device | 318 | * FUNCTION: acpi_ns_init_one_device |
@@ -348,41 +328,37 @@ acpi_ns_init_one_object ( | |||
348 | ******************************************************************************/ | 328 | ******************************************************************************/ |
349 | 329 | ||
350 | static acpi_status | 330 | static acpi_status |
351 | acpi_ns_init_one_device ( | 331 | acpi_ns_init_one_device(acpi_handle obj_handle, |
352 | acpi_handle obj_handle, | 332 | u32 nesting_level, void *context, void **return_value) |
353 | u32 nesting_level, | ||
354 | void *context, | ||
355 | void **return_value) | ||
356 | { | 333 | { |
357 | struct acpi_device_walk_info *info = (struct acpi_device_walk_info *) context; | 334 | struct acpi_device_walk_info *info = |
358 | struct acpi_parameter_info pinfo; | 335 | (struct acpi_device_walk_info *)context; |
359 | u32 flags; | 336 | struct acpi_parameter_info pinfo; |
360 | acpi_status status; | 337 | u32 flags; |
361 | 338 | acpi_status status; | |
362 | |||
363 | ACPI_FUNCTION_TRACE ("ns_init_one_device"); | ||
364 | 339 | ||
340 | ACPI_FUNCTION_TRACE("ns_init_one_device"); | ||
365 | 341 | ||
366 | pinfo.parameters = NULL; | 342 | pinfo.parameters = NULL; |
367 | pinfo.parameter_type = ACPI_PARAM_ARGS; | 343 | pinfo.parameter_type = ACPI_PARAM_ARGS; |
368 | 344 | ||
369 | pinfo.node = acpi_ns_map_handle_to_node (obj_handle); | 345 | pinfo.node = acpi_ns_map_handle_to_node(obj_handle); |
370 | if (!pinfo.node) { | 346 | if (!pinfo.node) { |
371 | return_ACPI_STATUS (AE_BAD_PARAMETER); | 347 | return_ACPI_STATUS(AE_BAD_PARAMETER); |
372 | } | 348 | } |
373 | 349 | ||
374 | /* | 350 | /* |
375 | * We will run _STA/_INI on Devices, Processors and thermal_zones only | 351 | * We will run _STA/_INI on Devices, Processors and thermal_zones only |
376 | */ | 352 | */ |
377 | if ((pinfo.node->type != ACPI_TYPE_DEVICE) && | 353 | if ((pinfo.node->type != ACPI_TYPE_DEVICE) && |
378 | (pinfo.node->type != ACPI_TYPE_PROCESSOR) && | 354 | (pinfo.node->type != ACPI_TYPE_PROCESSOR) && |
379 | (pinfo.node->type != ACPI_TYPE_THERMAL)) { | 355 | (pinfo.node->type != ACPI_TYPE_THERMAL)) { |
380 | return_ACPI_STATUS (AE_OK); | 356 | return_ACPI_STATUS(AE_OK); |
381 | } | 357 | } |
382 | 358 | ||
383 | if ((acpi_dbg_level <= ACPI_LV_ALL_EXCEPTIONS) && | 359 | if ((acpi_dbg_level <= ACPI_LV_ALL_EXCEPTIONS) && |
384 | (!(acpi_dbg_level & ACPI_LV_INFO))) { | 360 | (!(acpi_dbg_level & ACPI_LV_INFO))) { |
385 | ACPI_DEBUG_PRINT_RAW ((ACPI_DB_INIT, ".")); | 361 | ACPI_DEBUG_PRINT_RAW((ACPI_DB_INIT, ".")); |
386 | } | 362 | } |
387 | 363 | ||
388 | info->device_count++; | 364 | info->device_count++; |
@@ -390,20 +366,20 @@ acpi_ns_init_one_device ( | |||
390 | /* | 366 | /* |
391 | * Run _STA to determine if we can run _INI on the device. | 367 | * Run _STA to determine if we can run _INI on the device. |
392 | */ | 368 | */ |
393 | ACPI_DEBUG_EXEC (acpi_ut_display_init_pathname (ACPI_TYPE_METHOD, | 369 | ACPI_DEBUG_EXEC(acpi_ut_display_init_pathname(ACPI_TYPE_METHOD, |
394 | pinfo.node, METHOD_NAME__STA)); | 370 | pinfo.node, |
395 | status = acpi_ut_execute_STA (pinfo.node, &flags); | 371 | METHOD_NAME__STA)); |
372 | status = acpi_ut_execute_STA(pinfo.node, &flags); | ||
396 | 373 | ||
397 | if (ACPI_FAILURE (status)) { | 374 | if (ACPI_FAILURE(status)) { |
398 | if (pinfo.node->type == ACPI_TYPE_DEVICE) { | 375 | if (pinfo.node->type == ACPI_TYPE_DEVICE) { |
399 | /* Ignore error and move on to next device */ | 376 | /* Ignore error and move on to next device */ |
400 | 377 | ||
401 | return_ACPI_STATUS (AE_OK); | 378 | return_ACPI_STATUS(AE_OK); |
402 | } | 379 | } |
403 | 380 | ||
404 | /* _STA is not required for Processor or thermal_zone objects */ | 381 | /* _STA is not required for Processor or thermal_zone objects */ |
405 | } | 382 | } else { |
406 | else { | ||
407 | info->num_STA++; | 383 | info->num_STA++; |
408 | 384 | ||
409 | if (!(flags & 0x01)) { | 385 | if (!(flags & 0x01)) { |
@@ -416,32 +392,34 @@ acpi_ns_init_one_device ( | |||
416 | /* | 392 | /* |
417 | * The device is present. Run _INI. | 393 | * The device is present. Run _INI. |
418 | */ | 394 | */ |
419 | ACPI_DEBUG_EXEC (acpi_ut_display_init_pathname (ACPI_TYPE_METHOD, | 395 | ACPI_DEBUG_EXEC(acpi_ut_display_init_pathname(ACPI_TYPE_METHOD, |
420 | pinfo.node, METHOD_NAME__INI)); | 396 | pinfo.node, |
421 | status = acpi_ns_evaluate_relative (METHOD_NAME__INI, &pinfo); | 397 | METHOD_NAME__INI)); |
422 | if (ACPI_FAILURE (status)) { | 398 | status = acpi_ns_evaluate_relative(METHOD_NAME__INI, &pinfo); |
399 | if (ACPI_FAILURE(status)) { | ||
423 | /* No _INI (AE_NOT_FOUND) means device requires no initialization */ | 400 | /* No _INI (AE_NOT_FOUND) means device requires no initialization */ |
424 | 401 | ||
425 | if (status != AE_NOT_FOUND) { | 402 | if (status != AE_NOT_FOUND) { |
426 | /* Ignore error and move on to next device */ | 403 | /* Ignore error and move on to next device */ |
427 | 404 | ||
428 | #ifdef ACPI_DEBUG_OUTPUT | 405 | #ifdef ACPI_DEBUG_OUTPUT |
429 | char *scope_name = acpi_ns_get_external_pathname (pinfo.node); | 406 | char *scope_name = |
407 | acpi_ns_get_external_pathname(pinfo.node); | ||
430 | 408 | ||
431 | ACPI_DEBUG_PRINT ((ACPI_DB_WARN, "%s._INI failed: %s\n", | 409 | ACPI_DEBUG_PRINT((ACPI_DB_WARN, "%s._INI failed: %s\n", |
432 | scope_name, acpi_format_exception (status))); | 410 | scope_name, |
411 | acpi_format_exception(status))); | ||
433 | 412 | ||
434 | ACPI_MEM_FREE (scope_name); | 413 | ACPI_MEM_FREE(scope_name); |
435 | #endif | 414 | #endif |
436 | } | 415 | } |
437 | 416 | ||
438 | status = AE_OK; | 417 | status = AE_OK; |
439 | } | 418 | } else { |
440 | else { | ||
441 | /* Delete any return object (especially if implicit_return is enabled) */ | 419 | /* Delete any return object (especially if implicit_return is enabled) */ |
442 | 420 | ||
443 | if (pinfo.return_object) { | 421 | if (pinfo.return_object) { |
444 | acpi_ut_remove_reference (pinfo.return_object); | 422 | acpi_ut_remove_reference(pinfo.return_object); |
445 | } | 423 | } |
446 | 424 | ||
447 | /* Count of successful INIs */ | 425 | /* Count of successful INIs */ |
@@ -452,8 +430,9 @@ acpi_ns_init_one_device ( | |||
452 | if (acpi_gbl_init_handler) { | 430 | if (acpi_gbl_init_handler) { |
453 | /* External initialization handler is present, call it */ | 431 | /* External initialization handler is present, call it */ |
454 | 432 | ||
455 | status = acpi_gbl_init_handler (pinfo.node, ACPI_INIT_DEVICE_INI); | 433 | status = |
434 | acpi_gbl_init_handler(pinfo.node, ACPI_INIT_DEVICE_INI); | ||
456 | } | 435 | } |
457 | 436 | ||
458 | return_ACPI_STATUS (status); | 437 | return_ACPI_STATUS(status); |
459 | } | 438 | } |
diff --git a/drivers/acpi/namespace/nsload.c b/drivers/acpi/namespace/nsload.c index 1428a84a31e6..c28849de465a 100644 --- a/drivers/acpi/namespace/nsload.c +++ b/drivers/acpi/namespace/nsload.c | |||
@@ -41,32 +41,22 @@ | |||
41 | * POSSIBILITY OF SUCH DAMAGES. | 41 | * POSSIBILITY OF SUCH DAMAGES. |
42 | */ | 42 | */ |
43 | 43 | ||
44 | |||
45 | #include <acpi/acpi.h> | 44 | #include <acpi/acpi.h> |
46 | #include <acpi/acnamesp.h> | 45 | #include <acpi/acnamesp.h> |
47 | #include <acpi/acdispat.h> | 46 | #include <acpi/acdispat.h> |
48 | 47 | ||
49 | |||
50 | #define _COMPONENT ACPI_NAMESPACE | 48 | #define _COMPONENT ACPI_NAMESPACE |
51 | ACPI_MODULE_NAME ("nsload") | 49 | ACPI_MODULE_NAME("nsload") |
52 | 50 | ||
53 | /* Local prototypes */ | 51 | /* Local prototypes */ |
54 | 52 | static acpi_status acpi_ns_load_table_by_type(acpi_table_type table_type); | |
55 | static acpi_status | ||
56 | acpi_ns_load_table_by_type ( | ||
57 | acpi_table_type table_type); | ||
58 | 53 | ||
59 | #ifdef ACPI_FUTURE_IMPLEMENTATION | 54 | #ifdef ACPI_FUTURE_IMPLEMENTATION |
60 | acpi_status | 55 | acpi_status acpi_ns_unload_namespace(acpi_handle handle); |
61 | acpi_ns_unload_namespace ( | ||
62 | acpi_handle handle); | ||
63 | 56 | ||
64 | static acpi_status | 57 | static acpi_status acpi_ns_delete_subtree(acpi_handle start_handle); |
65 | acpi_ns_delete_subtree ( | ||
66 | acpi_handle start_handle); | ||
67 | #endif | 58 | #endif |
68 | 59 | ||
69 | |||
70 | #ifndef ACPI_NO_METHOD_EXECUTION | 60 | #ifndef ACPI_NO_METHOD_EXECUTION |
71 | /******************************************************************************* | 61 | /******************************************************************************* |
72 | * | 62 | * |
@@ -82,40 +72,39 @@ acpi_ns_delete_subtree ( | |||
82 | ******************************************************************************/ | 72 | ******************************************************************************/ |
83 | 73 | ||
84 | acpi_status | 74 | acpi_status |
85 | acpi_ns_load_table ( | 75 | acpi_ns_load_table(struct acpi_table_desc *table_desc, |
86 | struct acpi_table_desc *table_desc, | 76 | struct acpi_namespace_node *node) |
87 | struct acpi_namespace_node *node) | ||
88 | { | 77 | { |
89 | acpi_status status; | 78 | acpi_status status; |
90 | |||
91 | |||
92 | ACPI_FUNCTION_TRACE ("ns_load_table"); | ||
93 | 79 | ||
80 | ACPI_FUNCTION_TRACE("ns_load_table"); | ||
94 | 81 | ||
95 | /* Check if table contains valid AML (must be DSDT, PSDT, SSDT, etc.) */ | 82 | /* Check if table contains valid AML (must be DSDT, PSDT, SSDT, etc.) */ |
96 | 83 | ||
97 | if (!(acpi_gbl_table_data[table_desc->type].flags & ACPI_TABLE_EXECUTABLE)) { | 84 | if (! |
85 | (acpi_gbl_table_data[table_desc->type]. | ||
86 | flags & ACPI_TABLE_EXECUTABLE)) { | ||
98 | /* Just ignore this table */ | 87 | /* Just ignore this table */ |
99 | 88 | ||
100 | return_ACPI_STATUS (AE_OK); | 89 | return_ACPI_STATUS(AE_OK); |
101 | } | 90 | } |
102 | 91 | ||
103 | /* Check validity of the AML start and length */ | 92 | /* Check validity of the AML start and length */ |
104 | 93 | ||
105 | if (!table_desc->aml_start) { | 94 | if (!table_desc->aml_start) { |
106 | ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, "Null AML pointer\n")); | 95 | ACPI_DEBUG_PRINT((ACPI_DB_ERROR, "Null AML pointer\n")); |
107 | return_ACPI_STATUS (AE_BAD_PARAMETER); | 96 | return_ACPI_STATUS(AE_BAD_PARAMETER); |
108 | } | 97 | } |
109 | 98 | ||
110 | ACPI_DEBUG_PRINT ((ACPI_DB_INFO, "AML block at %p\n", | 99 | ACPI_DEBUG_PRINT((ACPI_DB_INFO, "AML block at %p\n", |
111 | table_desc->aml_start)); | 100 | table_desc->aml_start)); |
112 | 101 | ||
113 | /* Ignore table if there is no AML contained within */ | 102 | /* Ignore table if there is no AML contained within */ |
114 | 103 | ||
115 | if (!table_desc->aml_length) { | 104 | if (!table_desc->aml_length) { |
116 | ACPI_REPORT_WARNING (("Zero-length AML block in table [%4.4s]\n", | 105 | ACPI_REPORT_WARNING(("Zero-length AML block in table [%4.4s]\n", |
117 | table_desc->pointer->signature)); | 106 | table_desc->pointer->signature)); |
118 | return_ACPI_STATUS (AE_OK); | 107 | return_ACPI_STATUS(AE_OK); |
119 | } | 108 | } |
120 | 109 | ||
121 | /* | 110 | /* |
@@ -127,19 +116,19 @@ acpi_ns_load_table ( | |||
127 | * to another control method, we can't continue parsing | 116 | * to another control method, we can't continue parsing |
128 | * because we don't know how many arguments to parse next! | 117 | * because we don't know how many arguments to parse next! |
129 | */ | 118 | */ |
130 | ACPI_DEBUG_PRINT ((ACPI_DB_INFO, | 119 | ACPI_DEBUG_PRINT((ACPI_DB_INFO, |
131 | "**** Loading table into namespace ****\n")); | 120 | "**** Loading table into namespace ****\n")); |
132 | 121 | ||
133 | status = acpi_ut_acquire_mutex (ACPI_MTX_NAMESPACE); | 122 | status = acpi_ut_acquire_mutex(ACPI_MTX_NAMESPACE); |
134 | if (ACPI_FAILURE (status)) { | 123 | if (ACPI_FAILURE(status)) { |
135 | return_ACPI_STATUS (status); | 124 | return_ACPI_STATUS(status); |
136 | } | 125 | } |
137 | 126 | ||
138 | status = acpi_ns_parse_table (table_desc, node->child); | 127 | status = acpi_ns_parse_table(table_desc, node->child); |
139 | (void) acpi_ut_release_mutex (ACPI_MTX_NAMESPACE); | 128 | (void)acpi_ut_release_mutex(ACPI_MTX_NAMESPACE); |
140 | 129 | ||
141 | if (ACPI_FAILURE (status)) { | 130 | if (ACPI_FAILURE(status)) { |
142 | return_ACPI_STATUS (status); | 131 | return_ACPI_STATUS(status); |
143 | } | 132 | } |
144 | 133 | ||
145 | /* | 134 | /* |
@@ -148,18 +137,17 @@ acpi_ns_load_table ( | |||
148 | * just-in-time parsing, we delete the control method | 137 | * just-in-time parsing, we delete the control method |
149 | * parse trees. | 138 | * parse trees. |
150 | */ | 139 | */ |
151 | ACPI_DEBUG_PRINT ((ACPI_DB_INFO, | 140 | ACPI_DEBUG_PRINT((ACPI_DB_INFO, |
152 | "**** Begin Table Method Parsing and Object Initialization ****\n")); | 141 | "**** Begin Table Method Parsing and Object Initialization ****\n")); |
153 | 142 | ||
154 | status = acpi_ds_initialize_objects (table_desc, node); | 143 | status = acpi_ds_initialize_objects(table_desc, node); |
155 | 144 | ||
156 | ACPI_DEBUG_PRINT ((ACPI_DB_INFO, | 145 | ACPI_DEBUG_PRINT((ACPI_DB_INFO, |
157 | "**** Completed Table Method Parsing and Object Initialization ****\n")); | 146 | "**** Completed Table Method Parsing and Object Initialization ****\n")); |
158 | 147 | ||
159 | return_ACPI_STATUS (status); | 148 | return_ACPI_STATUS(status); |
160 | } | 149 | } |
161 | 150 | ||
162 | |||
163 | /******************************************************************************* | 151 | /******************************************************************************* |
164 | * | 152 | * |
165 | * FUNCTION: acpi_ns_load_table_by_type | 153 | * FUNCTION: acpi_ns_load_table_by_type |
@@ -174,21 +162,17 @@ acpi_ns_load_table ( | |||
174 | * | 162 | * |
175 | ******************************************************************************/ | 163 | ******************************************************************************/ |
176 | 164 | ||
177 | static acpi_status | 165 | static acpi_status acpi_ns_load_table_by_type(acpi_table_type table_type) |
178 | acpi_ns_load_table_by_type ( | ||
179 | acpi_table_type table_type) | ||
180 | { | 166 | { |
181 | u32 i; | 167 | u32 i; |
182 | acpi_status status; | 168 | acpi_status status; |
183 | struct acpi_table_desc *table_desc; | 169 | struct acpi_table_desc *table_desc; |
184 | |||
185 | |||
186 | ACPI_FUNCTION_TRACE ("ns_load_table_by_type"); | ||
187 | 170 | ||
171 | ACPI_FUNCTION_TRACE("ns_load_table_by_type"); | ||
188 | 172 | ||
189 | status = acpi_ut_acquire_mutex (ACPI_MTX_TABLES); | 173 | status = acpi_ut_acquire_mutex(ACPI_MTX_TABLES); |
190 | if (ACPI_FAILURE (status)) { | 174 | if (ACPI_FAILURE(status)) { |
191 | return_ACPI_STATUS (status); | 175 | return_ACPI_STATUS(status); |
192 | } | 176 | } |
193 | 177 | ||
194 | /* | 178 | /* |
@@ -198,7 +182,7 @@ acpi_ns_load_table_by_type ( | |||
198 | switch (table_type) { | 182 | switch (table_type) { |
199 | case ACPI_TABLE_DSDT: | 183 | case ACPI_TABLE_DSDT: |
200 | 184 | ||
201 | ACPI_DEBUG_PRINT ((ACPI_DB_INFO, "Namespace load: DSDT\n")); | 185 | ACPI_DEBUG_PRINT((ACPI_DB_INFO, "Namespace load: DSDT\n")); |
202 | 186 | ||
203 | table_desc = acpi_gbl_table_lists[ACPI_TABLE_DSDT].next; | 187 | table_desc = acpi_gbl_table_lists[ACPI_TABLE_DSDT].next; |
204 | 188 | ||
@@ -210,18 +194,18 @@ acpi_ns_load_table_by_type ( | |||
210 | 194 | ||
211 | /* Now load the single DSDT */ | 195 | /* Now load the single DSDT */ |
212 | 196 | ||
213 | status = acpi_ns_load_table (table_desc, acpi_gbl_root_node); | 197 | status = acpi_ns_load_table(table_desc, acpi_gbl_root_node); |
214 | if (ACPI_SUCCESS (status)) { | 198 | if (ACPI_SUCCESS(status)) { |
215 | table_desc->loaded_into_namespace = TRUE; | 199 | table_desc->loaded_into_namespace = TRUE; |
216 | } | 200 | } |
217 | break; | 201 | break; |
218 | 202 | ||
219 | |||
220 | case ACPI_TABLE_SSDT: | 203 | case ACPI_TABLE_SSDT: |
221 | case ACPI_TABLE_PSDT: | 204 | case ACPI_TABLE_PSDT: |
222 | 205 | ||
223 | ACPI_DEBUG_PRINT ((ACPI_DB_INFO, "Namespace load: %d SSDT or PSDTs\n", | 206 | ACPI_DEBUG_PRINT((ACPI_DB_INFO, |
224 | acpi_gbl_table_lists[table_type].count)); | 207 | "Namespace load: %d SSDT or PSDTs\n", |
208 | acpi_gbl_table_lists[table_type].count)); | ||
225 | 209 | ||
226 | /* | 210 | /* |
227 | * Traverse list of SSDT or PSDT tables | 211 | * Traverse list of SSDT or PSDT tables |
@@ -233,8 +217,10 @@ acpi_ns_load_table_by_type ( | |||
233 | * already loaded! | 217 | * already loaded! |
234 | */ | 218 | */ |
235 | if (!table_desc->loaded_into_namespace) { | 219 | if (!table_desc->loaded_into_namespace) { |
236 | status = acpi_ns_load_table (table_desc, acpi_gbl_root_node); | 220 | status = |
237 | if (ACPI_FAILURE (status)) { | 221 | acpi_ns_load_table(table_desc, |
222 | acpi_gbl_root_node); | ||
223 | if (ACPI_FAILURE(status)) { | ||
238 | break; | 224 | break; |
239 | } | 225 | } |
240 | 226 | ||
@@ -245,19 +231,16 @@ acpi_ns_load_table_by_type ( | |||
245 | } | 231 | } |
246 | break; | 232 | break; |
247 | 233 | ||
248 | |||
249 | default: | 234 | default: |
250 | status = AE_SUPPORT; | 235 | status = AE_SUPPORT; |
251 | break; | 236 | break; |
252 | } | 237 | } |
253 | 238 | ||
254 | 239 | unlock_and_exit: | |
255 | unlock_and_exit: | 240 | (void)acpi_ut_release_mutex(ACPI_MTX_TABLES); |
256 | (void) acpi_ut_release_mutex (ACPI_MTX_TABLES); | 241 | return_ACPI_STATUS(status); |
257 | return_ACPI_STATUS (status); | ||
258 | } | 242 | } |
259 | 243 | ||
260 | |||
261 | /******************************************************************************* | 244 | /******************************************************************************* |
262 | * | 245 | * |
263 | * FUNCTION: acpi_load_namespace | 246 | * FUNCTION: acpi_load_namespace |
@@ -271,45 +254,40 @@ unlock_and_exit: | |||
271 | * | 254 | * |
272 | ******************************************************************************/ | 255 | ******************************************************************************/ |
273 | 256 | ||
274 | acpi_status | 257 | acpi_status acpi_ns_load_namespace(void) |
275 | acpi_ns_load_namespace ( | ||
276 | void) | ||
277 | { | 258 | { |
278 | acpi_status status; | 259 | acpi_status status; |
279 | |||
280 | |||
281 | ACPI_FUNCTION_TRACE ("acpi_load_name_space"); | ||
282 | 260 | ||
261 | ACPI_FUNCTION_TRACE("acpi_load_name_space"); | ||
283 | 262 | ||
284 | /* There must be at least a DSDT installed */ | 263 | /* There must be at least a DSDT installed */ |
285 | 264 | ||
286 | if (acpi_gbl_DSDT == NULL) { | 265 | if (acpi_gbl_DSDT == NULL) { |
287 | ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, "DSDT is not in memory\n")); | 266 | ACPI_DEBUG_PRINT((ACPI_DB_ERROR, "DSDT is not in memory\n")); |
288 | return_ACPI_STATUS (AE_NO_ACPI_TABLES); | 267 | return_ACPI_STATUS(AE_NO_ACPI_TABLES); |
289 | } | 268 | } |
290 | 269 | ||
291 | /* | 270 | /* |
292 | * Load the namespace. The DSDT is required, | 271 | * Load the namespace. The DSDT is required, |
293 | * but the SSDT and PSDT tables are optional. | 272 | * but the SSDT and PSDT tables are optional. |
294 | */ | 273 | */ |
295 | status = acpi_ns_load_table_by_type (ACPI_TABLE_DSDT); | 274 | status = acpi_ns_load_table_by_type(ACPI_TABLE_DSDT); |
296 | if (ACPI_FAILURE (status)) { | 275 | if (ACPI_FAILURE(status)) { |
297 | return_ACPI_STATUS (status); | 276 | return_ACPI_STATUS(status); |
298 | } | 277 | } |
299 | 278 | ||
300 | /* Ignore exceptions from these */ | 279 | /* Ignore exceptions from these */ |
301 | 280 | ||
302 | (void) acpi_ns_load_table_by_type (ACPI_TABLE_SSDT); | 281 | (void)acpi_ns_load_table_by_type(ACPI_TABLE_SSDT); |
303 | (void) acpi_ns_load_table_by_type (ACPI_TABLE_PSDT); | 282 | (void)acpi_ns_load_table_by_type(ACPI_TABLE_PSDT); |
304 | 283 | ||
305 | ACPI_DEBUG_PRINT_RAW ((ACPI_DB_INIT, | 284 | ACPI_DEBUG_PRINT_RAW((ACPI_DB_INIT, |
306 | "ACPI Namespace successfully loaded at root %p\n", | 285 | "ACPI Namespace successfully loaded at root %p\n", |
307 | acpi_gbl_root_node)); | 286 | acpi_gbl_root_node)); |
308 | 287 | ||
309 | return_ACPI_STATUS (status); | 288 | return_ACPI_STATUS(status); |
310 | } | 289 | } |
311 | 290 | ||
312 | |||
313 | #ifdef ACPI_FUTURE_IMPLEMENTATION | 291 | #ifdef ACPI_FUTURE_IMPLEMENTATION |
314 | /******************************************************************************* | 292 | /******************************************************************************* |
315 | * | 293 | * |
@@ -327,24 +305,20 @@ acpi_ns_load_namespace ( | |||
327 | * | 305 | * |
328 | ******************************************************************************/ | 306 | ******************************************************************************/ |
329 | 307 | ||
330 | static acpi_status | 308 | static acpi_status acpi_ns_delete_subtree(acpi_handle start_handle) |
331 | acpi_ns_delete_subtree ( | ||
332 | acpi_handle start_handle) | ||
333 | { | 309 | { |
334 | acpi_status status; | 310 | acpi_status status; |
335 | acpi_handle child_handle; | 311 | acpi_handle child_handle; |
336 | acpi_handle parent_handle; | 312 | acpi_handle parent_handle; |
337 | acpi_handle next_child_handle; | 313 | acpi_handle next_child_handle; |
338 | acpi_handle dummy; | 314 | acpi_handle dummy; |
339 | u32 level; | 315 | u32 level; |
340 | |||
341 | |||
342 | ACPI_FUNCTION_TRACE ("ns_delete_subtree"); | ||
343 | 316 | ||
317 | ACPI_FUNCTION_TRACE("ns_delete_subtree"); | ||
344 | 318 | ||
345 | parent_handle = start_handle; | 319 | parent_handle = start_handle; |
346 | child_handle = NULL; | 320 | child_handle = NULL; |
347 | level = 1; | 321 | level = 1; |
348 | 322 | ||
349 | /* | 323 | /* |
350 | * Traverse the tree of objects until we bubble back up | 324 | * Traverse the tree of objects until we bubble back up |
@@ -353,18 +327,19 @@ acpi_ns_delete_subtree ( | |||
353 | while (level > 0) { | 327 | while (level > 0) { |
354 | /* Attempt to get the next object in this scope */ | 328 | /* Attempt to get the next object in this scope */ |
355 | 329 | ||
356 | status = acpi_get_next_object (ACPI_TYPE_ANY, parent_handle, | 330 | status = acpi_get_next_object(ACPI_TYPE_ANY, parent_handle, |
357 | child_handle, &next_child_handle); | 331 | child_handle, &next_child_handle); |
358 | 332 | ||
359 | child_handle = next_child_handle; | 333 | child_handle = next_child_handle; |
360 | 334 | ||
361 | /* Did we get a new object? */ | 335 | /* Did we get a new object? */ |
362 | 336 | ||
363 | if (ACPI_SUCCESS (status)) { | 337 | if (ACPI_SUCCESS(status)) { |
364 | /* Check if this object has any children */ | 338 | /* Check if this object has any children */ |
365 | 339 | ||
366 | if (ACPI_SUCCESS (acpi_get_next_object (ACPI_TYPE_ANY, child_handle, | 340 | if (ACPI_SUCCESS |
367 | NULL, &dummy))) { | 341 | (acpi_get_next_object |
342 | (ACPI_TYPE_ANY, child_handle, NULL, &dummy))) { | ||
368 | /* | 343 | /* |
369 | * There is at least one child of this object, | 344 | * There is at least one child of this object, |
370 | * visit the object | 345 | * visit the object |
@@ -373,8 +348,7 @@ acpi_ns_delete_subtree ( | |||
373 | parent_handle = child_handle; | 348 | parent_handle = child_handle; |
374 | child_handle = NULL; | 349 | child_handle = NULL; |
375 | } | 350 | } |
376 | } | 351 | } else { |
377 | else { | ||
378 | /* | 352 | /* |
379 | * No more children in this object, go back up to | 353 | * No more children in this object, go back up to |
380 | * the object's parent | 354 | * the object's parent |
@@ -383,24 +357,23 @@ acpi_ns_delete_subtree ( | |||
383 | 357 | ||
384 | /* Delete all children now */ | 358 | /* Delete all children now */ |
385 | 359 | ||
386 | acpi_ns_delete_children (child_handle); | 360 | acpi_ns_delete_children(child_handle); |
387 | 361 | ||
388 | child_handle = parent_handle; | 362 | child_handle = parent_handle; |
389 | status = acpi_get_parent (parent_handle, &parent_handle); | 363 | status = acpi_get_parent(parent_handle, &parent_handle); |
390 | if (ACPI_FAILURE (status)) { | 364 | if (ACPI_FAILURE(status)) { |
391 | return_ACPI_STATUS (status); | 365 | return_ACPI_STATUS(status); |
392 | } | 366 | } |
393 | } | 367 | } |
394 | } | 368 | } |
395 | 369 | ||
396 | /* Now delete the starting object, and we are done */ | 370 | /* Now delete the starting object, and we are done */ |
397 | 371 | ||
398 | acpi_ns_delete_node (child_handle); | 372 | acpi_ns_delete_node(child_handle); |
399 | 373 | ||
400 | return_ACPI_STATUS (AE_OK); | 374 | return_ACPI_STATUS(AE_OK); |
401 | } | 375 | } |
402 | 376 | ||
403 | |||
404 | /******************************************************************************* | 377 | /******************************************************************************* |
405 | * | 378 | * |
406 | * FUNCTION: acpi_ns_unload_name_space | 379 | * FUNCTION: acpi_ns_unload_name_space |
@@ -415,32 +388,27 @@ acpi_ns_delete_subtree ( | |||
415 | * | 388 | * |
416 | ******************************************************************************/ | 389 | ******************************************************************************/ |
417 | 390 | ||
418 | acpi_status | 391 | acpi_status acpi_ns_unload_namespace(acpi_handle handle) |
419 | acpi_ns_unload_namespace ( | ||
420 | acpi_handle handle) | ||
421 | { | 392 | { |
422 | acpi_status status; | 393 | acpi_status status; |
423 | |||
424 | |||
425 | ACPI_FUNCTION_TRACE ("ns_unload_name_space"); | ||
426 | 394 | ||
395 | ACPI_FUNCTION_TRACE("ns_unload_name_space"); | ||
427 | 396 | ||
428 | /* Parameter validation */ | 397 | /* Parameter validation */ |
429 | 398 | ||
430 | if (!acpi_gbl_root_node) { | 399 | if (!acpi_gbl_root_node) { |
431 | return_ACPI_STATUS (AE_NO_NAMESPACE); | 400 | return_ACPI_STATUS(AE_NO_NAMESPACE); |
432 | } | 401 | } |
433 | 402 | ||
434 | if (!handle) { | 403 | if (!handle) { |
435 | return_ACPI_STATUS (AE_BAD_PARAMETER); | 404 | return_ACPI_STATUS(AE_BAD_PARAMETER); |
436 | } | 405 | } |
437 | 406 | ||
438 | /* This function does the real work */ | 407 | /* This function does the real work */ |
439 | 408 | ||
440 | status = acpi_ns_delete_subtree (handle); | 409 | status = acpi_ns_delete_subtree(handle); |
441 | 410 | ||
442 | return_ACPI_STATUS (status); | 411 | return_ACPI_STATUS(status); |
443 | } | 412 | } |
444 | #endif | 413 | #endif |
445 | #endif | 414 | #endif |
446 | |||
diff --git a/drivers/acpi/namespace/nsnames.c b/drivers/acpi/namespace/nsnames.c index d8ce7e39795f..d5e8dea61c27 100644 --- a/drivers/acpi/namespace/nsnames.c +++ b/drivers/acpi/namespace/nsnames.c | |||
@@ -41,23 +41,17 @@ | |||
41 | * POSSIBILITY OF SUCH DAMAGES. | 41 | * POSSIBILITY OF SUCH DAMAGES. |
42 | */ | 42 | */ |
43 | 43 | ||
44 | |||
45 | #include <acpi/acpi.h> | 44 | #include <acpi/acpi.h> |
46 | #include <acpi/amlcode.h> | 45 | #include <acpi/amlcode.h> |
47 | #include <acpi/acnamesp.h> | 46 | #include <acpi/acnamesp.h> |
48 | 47 | ||
49 | |||
50 | #define _COMPONENT ACPI_NAMESPACE | 48 | #define _COMPONENT ACPI_NAMESPACE |
51 | ACPI_MODULE_NAME ("nsnames") | 49 | ACPI_MODULE_NAME("nsnames") |
52 | 50 | ||
53 | /* Local prototypes */ | 51 | /* Local prototypes */ |
54 | |||
55 | static void | 52 | static void |
56 | acpi_ns_build_external_path ( | 53 | acpi_ns_build_external_path(struct acpi_namespace_node *node, |
57 | struct acpi_namespace_node *node, | 54 | acpi_size size, char *name_buffer); |
58 | acpi_size size, | ||
59 | char *name_buffer); | ||
60 | |||
61 | 55 | ||
62 | /******************************************************************************* | 56 | /******************************************************************************* |
63 | * | 57 | * |
@@ -75,17 +69,13 @@ acpi_ns_build_external_path ( | |||
75 | ******************************************************************************/ | 69 | ******************************************************************************/ |
76 | 70 | ||
77 | static void | 71 | static void |
78 | acpi_ns_build_external_path ( | 72 | acpi_ns_build_external_path(struct acpi_namespace_node *node, |
79 | struct acpi_namespace_node *node, | 73 | acpi_size size, char *name_buffer) |
80 | acpi_size size, | ||
81 | char *name_buffer) | ||
82 | { | 74 | { |
83 | acpi_size index; | 75 | acpi_size index; |
84 | struct acpi_namespace_node *parent_node; | 76 | struct acpi_namespace_node *parent_node; |
85 | |||
86 | |||
87 | ACPI_FUNCTION_NAME ("ns_build_external_path"); | ||
88 | 77 | ||
78 | ACPI_FUNCTION_NAME("ns_build_external_path"); | ||
89 | 79 | ||
90 | /* Special case for root */ | 80 | /* Special case for root */ |
91 | 81 | ||
@@ -106,8 +96,8 @@ acpi_ns_build_external_path ( | |||
106 | 96 | ||
107 | /* Put the name into the buffer */ | 97 | /* Put the name into the buffer */ |
108 | 98 | ||
109 | ACPI_MOVE_32_TO_32 ((name_buffer + index), &parent_node->name); | 99 | ACPI_MOVE_32_TO_32((name_buffer + index), &parent_node->name); |
110 | parent_node = acpi_ns_get_parent_node (parent_node); | 100 | parent_node = acpi_ns_get_parent_node(parent_node); |
111 | 101 | ||
112 | /* Prefix name with the path separator */ | 102 | /* Prefix name with the path separator */ |
113 | 103 | ||
@@ -120,15 +110,14 @@ acpi_ns_build_external_path ( | |||
120 | name_buffer[index] = AML_ROOT_PREFIX; | 110 | name_buffer[index] = AML_ROOT_PREFIX; |
121 | 111 | ||
122 | if (index != 0) { | 112 | if (index != 0) { |
123 | ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, | 113 | ACPI_DEBUG_PRINT((ACPI_DB_ERROR, |
124 | "Could not construct pathname; index=%X, size=%X, Path=%s\n", | 114 | "Could not construct pathname; index=%X, size=%X, Path=%s\n", |
125 | (u32) index, (u32) size, &name_buffer[size])); | 115 | (u32) index, (u32) size, &name_buffer[size])); |
126 | } | 116 | } |
127 | 117 | ||
128 | return; | 118 | return; |
129 | } | 119 | } |
130 | 120 | ||
131 | |||
132 | #ifdef ACPI_DEBUG_OUTPUT | 121 | #ifdef ACPI_DEBUG_OUTPUT |
133 | /******************************************************************************* | 122 | /******************************************************************************* |
134 | * | 123 | * |
@@ -144,37 +133,32 @@ acpi_ns_build_external_path ( | |||
144 | * | 133 | * |
145 | ******************************************************************************/ | 134 | ******************************************************************************/ |
146 | 135 | ||
147 | char * | 136 | char *acpi_ns_get_external_pathname(struct acpi_namespace_node *node) |
148 | acpi_ns_get_external_pathname ( | ||
149 | struct acpi_namespace_node *node) | ||
150 | { | 137 | { |
151 | char *name_buffer; | 138 | char *name_buffer; |
152 | acpi_size size; | 139 | acpi_size size; |
153 | |||
154 | |||
155 | ACPI_FUNCTION_TRACE_PTR ("ns_get_external_pathname", node); | ||
156 | 140 | ||
141 | ACPI_FUNCTION_TRACE_PTR("ns_get_external_pathname", node); | ||
157 | 142 | ||
158 | /* Calculate required buffer size based on depth below root */ | 143 | /* Calculate required buffer size based on depth below root */ |
159 | 144 | ||
160 | size = acpi_ns_get_pathname_length (node); | 145 | size = acpi_ns_get_pathname_length(node); |
161 | 146 | ||
162 | /* Allocate a buffer to be returned to caller */ | 147 | /* Allocate a buffer to be returned to caller */ |
163 | 148 | ||
164 | name_buffer = ACPI_MEM_CALLOCATE (size); | 149 | name_buffer = ACPI_MEM_CALLOCATE(size); |
165 | if (!name_buffer) { | 150 | if (!name_buffer) { |
166 | ACPI_REPORT_ERROR (("ns_get_table_pathname: allocation failure\n")); | 151 | ACPI_REPORT_ERROR(("ns_get_table_pathname: allocation failure\n")); |
167 | return_PTR (NULL); | 152 | return_PTR(NULL); |
168 | } | 153 | } |
169 | 154 | ||
170 | /* Build the path in the allocated buffer */ | 155 | /* Build the path in the allocated buffer */ |
171 | 156 | ||
172 | acpi_ns_build_external_path (node, size, name_buffer); | 157 | acpi_ns_build_external_path(node, size, name_buffer); |
173 | return_PTR (name_buffer); | 158 | return_PTR(name_buffer); |
174 | } | 159 | } |
175 | #endif | 160 | #endif |
176 | 161 | ||
177 | |||
178 | /******************************************************************************* | 162 | /******************************************************************************* |
179 | * | 163 | * |
180 | * FUNCTION: acpi_ns_get_pathname_length | 164 | * FUNCTION: acpi_ns_get_pathname_length |
@@ -187,16 +171,12 @@ acpi_ns_get_external_pathname ( | |||
187 | * | 171 | * |
188 | ******************************************************************************/ | 172 | ******************************************************************************/ |
189 | 173 | ||
190 | acpi_size | 174 | acpi_size acpi_ns_get_pathname_length(struct acpi_namespace_node *node) |
191 | acpi_ns_get_pathname_length ( | ||
192 | struct acpi_namespace_node *node) | ||
193 | { | 175 | { |
194 | acpi_size size; | 176 | acpi_size size; |
195 | struct acpi_namespace_node *next_node; | 177 | struct acpi_namespace_node *next_node; |
196 | |||
197 | |||
198 | ACPI_FUNCTION_ENTRY (); | ||
199 | 178 | ||
179 | ACPI_FUNCTION_ENTRY(); | ||
200 | 180 | ||
201 | /* | 181 | /* |
202 | * Compute length of pathname as 5 * number of name segments. | 182 | * Compute length of pathname as 5 * number of name segments. |
@@ -207,17 +187,16 @@ acpi_ns_get_pathname_length ( | |||
207 | 187 | ||
208 | while (next_node && (next_node != acpi_gbl_root_node)) { | 188 | while (next_node && (next_node != acpi_gbl_root_node)) { |
209 | size += ACPI_PATH_SEGMENT_LENGTH; | 189 | size += ACPI_PATH_SEGMENT_LENGTH; |
210 | next_node = acpi_ns_get_parent_node (next_node); | 190 | next_node = acpi_ns_get_parent_node(next_node); |
211 | } | 191 | } |
212 | 192 | ||
213 | if (!size) { | 193 | if (!size) { |
214 | size = 1; /* Root node case */ | 194 | size = 1; /* Root node case */ |
215 | } | 195 | } |
216 | 196 | ||
217 | return (size + 1); /* +1 for null string terminator */ | 197 | return (size + 1); /* +1 for null string terminator */ |
218 | } | 198 | } |
219 | 199 | ||
220 | |||
221 | /******************************************************************************* | 200 | /******************************************************************************* |
222 | * | 201 | * |
223 | * FUNCTION: acpi_ns_handle_to_pathname | 202 | * FUNCTION: acpi_ns_handle_to_pathname |
@@ -233,41 +212,36 @@ acpi_ns_get_pathname_length ( | |||
233 | ******************************************************************************/ | 212 | ******************************************************************************/ |
234 | 213 | ||
235 | acpi_status | 214 | acpi_status |
236 | acpi_ns_handle_to_pathname ( | 215 | acpi_ns_handle_to_pathname(acpi_handle target_handle, |
237 | acpi_handle target_handle, | 216 | struct acpi_buffer * buffer) |
238 | struct acpi_buffer *buffer) | ||
239 | { | 217 | { |
240 | acpi_status status; | 218 | acpi_status status; |
241 | struct acpi_namespace_node *node; | 219 | struct acpi_namespace_node *node; |
242 | acpi_size required_size; | 220 | acpi_size required_size; |
243 | 221 | ||
222 | ACPI_FUNCTION_TRACE_PTR("ns_handle_to_pathname", target_handle); | ||
244 | 223 | ||
245 | ACPI_FUNCTION_TRACE_PTR ("ns_handle_to_pathname", target_handle); | 224 | node = acpi_ns_map_handle_to_node(target_handle); |
246 | |||
247 | |||
248 | node = acpi_ns_map_handle_to_node (target_handle); | ||
249 | if (!node) { | 225 | if (!node) { |
250 | return_ACPI_STATUS (AE_BAD_PARAMETER); | 226 | return_ACPI_STATUS(AE_BAD_PARAMETER); |
251 | } | 227 | } |
252 | 228 | ||
253 | /* Determine size required for the caller buffer */ | 229 | /* Determine size required for the caller buffer */ |
254 | 230 | ||
255 | required_size = acpi_ns_get_pathname_length (node); | 231 | required_size = acpi_ns_get_pathname_length(node); |
256 | 232 | ||
257 | /* Validate/Allocate/Clear caller buffer */ | 233 | /* Validate/Allocate/Clear caller buffer */ |
258 | 234 | ||
259 | status = acpi_ut_initialize_buffer (buffer, required_size); | 235 | status = acpi_ut_initialize_buffer(buffer, required_size); |
260 | if (ACPI_FAILURE (status)) { | 236 | if (ACPI_FAILURE(status)) { |
261 | return_ACPI_STATUS (status); | 237 | return_ACPI_STATUS(status); |
262 | } | 238 | } |
263 | 239 | ||
264 | /* Build the path in the caller buffer */ | 240 | /* Build the path in the caller buffer */ |
265 | 241 | ||
266 | acpi_ns_build_external_path (node, required_size, buffer->pointer); | 242 | acpi_ns_build_external_path(node, required_size, buffer->pointer); |
267 | 243 | ||
268 | ACPI_DEBUG_PRINT ((ACPI_DB_EXEC, "%s [%X] \n", | 244 | ACPI_DEBUG_PRINT((ACPI_DB_EXEC, "%s [%X] \n", |
269 | (char *) buffer->pointer, (u32) required_size)); | 245 | (char *)buffer->pointer, (u32) required_size)); |
270 | return_ACPI_STATUS (AE_OK); | 246 | return_ACPI_STATUS(AE_OK); |
271 | } | 247 | } |
272 | |||
273 | |||
diff --git a/drivers/acpi/namespace/nsobject.c b/drivers/acpi/namespace/nsobject.c index 27258c1ca4f1..fc9be946ebed 100644 --- a/drivers/acpi/namespace/nsobject.c +++ b/drivers/acpi/namespace/nsobject.c | |||
@@ -42,14 +42,11 @@ | |||
42 | * POSSIBILITY OF SUCH DAMAGES. | 42 | * POSSIBILITY OF SUCH DAMAGES. |
43 | */ | 43 | */ |
44 | 44 | ||
45 | |||
46 | #include <acpi/acpi.h> | 45 | #include <acpi/acpi.h> |
47 | #include <acpi/acnamesp.h> | 46 | #include <acpi/acnamesp.h> |
48 | 47 | ||
49 | |||
50 | #define _COMPONENT ACPI_NAMESPACE | 48 | #define _COMPONENT ACPI_NAMESPACE |
51 | ACPI_MODULE_NAME ("nsobject") | 49 | ACPI_MODULE_NAME("nsobject") |
52 | |||
53 | 50 | ||
54 | /******************************************************************************* | 51 | /******************************************************************************* |
55 | * | 52 | * |
@@ -71,20 +68,15 @@ | |||
71 | * MUTEX: Assumes namespace is locked | 68 | * MUTEX: Assumes namespace is locked |
72 | * | 69 | * |
73 | ******************************************************************************/ | 70 | ******************************************************************************/ |
74 | |||
75 | acpi_status | 71 | acpi_status |
76 | acpi_ns_attach_object ( | 72 | acpi_ns_attach_object(struct acpi_namespace_node *node, |
77 | struct acpi_namespace_node *node, | 73 | union acpi_operand_object *object, acpi_object_type type) |
78 | union acpi_operand_object *object, | ||
79 | acpi_object_type type) | ||
80 | { | 74 | { |
81 | union acpi_operand_object *obj_desc; | 75 | union acpi_operand_object *obj_desc; |
82 | union acpi_operand_object *last_obj_desc; | 76 | union acpi_operand_object *last_obj_desc; |
83 | acpi_object_type object_type = ACPI_TYPE_ANY; | 77 | acpi_object_type object_type = ACPI_TYPE_ANY; |
84 | |||
85 | |||
86 | ACPI_FUNCTION_TRACE ("ns_attach_object"); | ||
87 | 78 | ||
79 | ACPI_FUNCTION_TRACE("ns_attach_object"); | ||
88 | 80 | ||
89 | /* | 81 | /* |
90 | * Parameter validation | 82 | * Parameter validation |
@@ -92,40 +84,39 @@ acpi_ns_attach_object ( | |||
92 | if (!node) { | 84 | if (!node) { |
93 | /* Invalid handle */ | 85 | /* Invalid handle */ |
94 | 86 | ||
95 | ACPI_REPORT_ERROR (("ns_attach_object: Null named_obj handle\n")); | 87 | ACPI_REPORT_ERROR(("ns_attach_object: Null named_obj handle\n")); |
96 | return_ACPI_STATUS (AE_BAD_PARAMETER); | 88 | return_ACPI_STATUS(AE_BAD_PARAMETER); |
97 | } | 89 | } |
98 | 90 | ||
99 | if (!object && (ACPI_TYPE_ANY != type)) { | 91 | if (!object && (ACPI_TYPE_ANY != type)) { |
100 | /* Null object */ | 92 | /* Null object */ |
101 | 93 | ||
102 | ACPI_REPORT_ERROR (( | 94 | ACPI_REPORT_ERROR(("ns_attach_object: Null object, but type not ACPI_TYPE_ANY\n")); |
103 | "ns_attach_object: Null object, but type not ACPI_TYPE_ANY\n")); | 95 | return_ACPI_STATUS(AE_BAD_PARAMETER); |
104 | return_ACPI_STATUS (AE_BAD_PARAMETER); | ||
105 | } | 96 | } |
106 | 97 | ||
107 | if (ACPI_GET_DESCRIPTOR_TYPE (node) != ACPI_DESC_TYPE_NAMED) { | 98 | if (ACPI_GET_DESCRIPTOR_TYPE(node) != ACPI_DESC_TYPE_NAMED) { |
108 | /* Not a name handle */ | 99 | /* Not a name handle */ |
109 | 100 | ||
110 | ACPI_REPORT_ERROR (("ns_attach_object: Invalid handle %p [%s]\n", | 101 | ACPI_REPORT_ERROR(("ns_attach_object: Invalid handle %p [%s]\n", |
111 | node, acpi_ut_get_descriptor_name (node))); | 102 | node, acpi_ut_get_descriptor_name(node))); |
112 | return_ACPI_STATUS (AE_BAD_PARAMETER); | 103 | return_ACPI_STATUS(AE_BAD_PARAMETER); |
113 | } | 104 | } |
114 | 105 | ||
115 | /* Check if this object is already attached */ | 106 | /* Check if this object is already attached */ |
116 | 107 | ||
117 | if (node->object == object) { | 108 | if (node->object == object) { |
118 | ACPI_DEBUG_PRINT ((ACPI_DB_EXEC, | 109 | ACPI_DEBUG_PRINT((ACPI_DB_EXEC, |
119 | "Obj %p already installed in name_obj %p\n", | 110 | "Obj %p already installed in name_obj %p\n", |
120 | object, node)); | 111 | object, node)); |
121 | 112 | ||
122 | return_ACPI_STATUS (AE_OK); | 113 | return_ACPI_STATUS(AE_OK); |
123 | } | 114 | } |
124 | 115 | ||
125 | /* If null object, we will just install it */ | 116 | /* If null object, we will just install it */ |
126 | 117 | ||
127 | if (!object) { | 118 | if (!object) { |
128 | obj_desc = NULL; | 119 | obj_desc = NULL; |
129 | object_type = ACPI_TYPE_ANY; | 120 | object_type = ACPI_TYPE_ANY; |
130 | } | 121 | } |
131 | 122 | ||
@@ -133,14 +124,14 @@ acpi_ns_attach_object ( | |||
133 | * If the source object is a namespace Node with an attached object, | 124 | * If the source object is a namespace Node with an attached object, |
134 | * we will use that (attached) object | 125 | * we will use that (attached) object |
135 | */ | 126 | */ |
136 | else if ((ACPI_GET_DESCRIPTOR_TYPE (object) == ACPI_DESC_TYPE_NAMED) && | 127 | else if ((ACPI_GET_DESCRIPTOR_TYPE(object) == ACPI_DESC_TYPE_NAMED) && |
137 | ((struct acpi_namespace_node *) object)->object) { | 128 | ((struct acpi_namespace_node *)object)->object) { |
138 | /* | 129 | /* |
139 | * Value passed is a name handle and that name has a | 130 | * Value passed is a name handle and that name has a |
140 | * non-null value. Use that name's value and type. | 131 | * non-null value. Use that name's value and type. |
141 | */ | 132 | */ |
142 | obj_desc = ((struct acpi_namespace_node *) object)->object; | 133 | obj_desc = ((struct acpi_namespace_node *)object)->object; |
143 | object_type = ((struct acpi_namespace_node *) object)->type; | 134 | object_type = ((struct acpi_namespace_node *)object)->type; |
144 | } | 135 | } |
145 | 136 | ||
146 | /* | 137 | /* |
@@ -148,20 +139,20 @@ acpi_ns_attach_object ( | |||
148 | * it first | 139 | * it first |
149 | */ | 140 | */ |
150 | else { | 141 | else { |
151 | obj_desc = (union acpi_operand_object *) object; | 142 | obj_desc = (union acpi_operand_object *)object; |
152 | 143 | ||
153 | /* Use the given type */ | 144 | /* Use the given type */ |
154 | 145 | ||
155 | object_type = type; | 146 | object_type = type; |
156 | } | 147 | } |
157 | 148 | ||
158 | ACPI_DEBUG_PRINT ((ACPI_DB_EXEC, "Installing %p into Node %p [%4.4s]\n", | 149 | ACPI_DEBUG_PRINT((ACPI_DB_EXEC, "Installing %p into Node %p [%4.4s]\n", |
159 | obj_desc, node, acpi_ut_get_node_name (node))); | 150 | obj_desc, node, acpi_ut_get_node_name(node))); |
160 | 151 | ||
161 | /* Detach an existing attached object if present */ | 152 | /* Detach an existing attached object if present */ |
162 | 153 | ||
163 | if (node->object) { | 154 | if (node->object) { |
164 | acpi_ns_detach_object (node); | 155 | acpi_ns_detach_object(node); |
165 | } | 156 | } |
166 | 157 | ||
167 | if (obj_desc) { | 158 | if (obj_desc) { |
@@ -169,7 +160,7 @@ acpi_ns_attach_object ( | |||
169 | * Must increment the new value's reference count | 160 | * Must increment the new value's reference count |
170 | * (if it is an internal object) | 161 | * (if it is an internal object) |
171 | */ | 162 | */ |
172 | acpi_ut_add_reference (obj_desc); | 163 | acpi_ut_add_reference(obj_desc); |
173 | 164 | ||
174 | /* | 165 | /* |
175 | * Handle objects with multiple descriptors - walk | 166 | * Handle objects with multiple descriptors - walk |
@@ -185,13 +176,12 @@ acpi_ns_attach_object ( | |||
185 | last_obj_desc->common.next_object = node->object; | 176 | last_obj_desc->common.next_object = node->object; |
186 | } | 177 | } |
187 | 178 | ||
188 | node->type = (u8) object_type; | 179 | node->type = (u8) object_type; |
189 | node->object = obj_desc; | 180 | node->object = obj_desc; |
190 | 181 | ||
191 | return_ACPI_STATUS (AE_OK); | 182 | return_ACPI_STATUS(AE_OK); |
192 | } | 183 | } |
193 | 184 | ||
194 | |||
195 | /******************************************************************************* | 185 | /******************************************************************************* |
196 | * | 186 | * |
197 | * FUNCTION: acpi_ns_detach_object | 187 | * FUNCTION: acpi_ns_detach_object |
@@ -206,30 +196,27 @@ acpi_ns_attach_object ( | |||
206 | * | 196 | * |
207 | ******************************************************************************/ | 197 | ******************************************************************************/ |
208 | 198 | ||
209 | void | 199 | void acpi_ns_detach_object(struct acpi_namespace_node *node) |
210 | acpi_ns_detach_object ( | ||
211 | struct acpi_namespace_node *node) | ||
212 | { | 200 | { |
213 | union acpi_operand_object *obj_desc; | 201 | union acpi_operand_object *obj_desc; |
214 | |||
215 | |||
216 | ACPI_FUNCTION_TRACE ("ns_detach_object"); | ||
217 | 202 | ||
203 | ACPI_FUNCTION_TRACE("ns_detach_object"); | ||
218 | 204 | ||
219 | obj_desc = node->object; | 205 | obj_desc = node->object; |
220 | 206 | ||
221 | if (!obj_desc || | 207 | if (!obj_desc || |
222 | (ACPI_GET_OBJECT_TYPE (obj_desc) == ACPI_TYPE_LOCAL_DATA)) { | 208 | (ACPI_GET_OBJECT_TYPE(obj_desc) == ACPI_TYPE_LOCAL_DATA)) { |
223 | return_VOID; | 209 | return_VOID; |
224 | } | 210 | } |
225 | 211 | ||
226 | /* Clear the entry in all cases */ | 212 | /* Clear the entry in all cases */ |
227 | 213 | ||
228 | node->object = NULL; | 214 | node->object = NULL; |
229 | if (ACPI_GET_DESCRIPTOR_TYPE (obj_desc) == ACPI_DESC_TYPE_OPERAND) { | 215 | if (ACPI_GET_DESCRIPTOR_TYPE(obj_desc) == ACPI_DESC_TYPE_OPERAND) { |
230 | node->object = obj_desc->common.next_object; | 216 | node->object = obj_desc->common.next_object; |
231 | if (node->object && | 217 | if (node->object && |
232 | (ACPI_GET_OBJECT_TYPE (node->object) != ACPI_TYPE_LOCAL_DATA)) { | 218 | (ACPI_GET_OBJECT_TYPE(node->object) != |
219 | ACPI_TYPE_LOCAL_DATA)) { | ||
233 | node->object = node->object->common.next_object; | 220 | node->object = node->object->common.next_object; |
234 | } | 221 | } |
235 | } | 222 | } |
@@ -238,16 +225,15 @@ acpi_ns_detach_object ( | |||
238 | 225 | ||
239 | node->type = ACPI_TYPE_ANY; | 226 | node->type = ACPI_TYPE_ANY; |
240 | 227 | ||
241 | ACPI_DEBUG_PRINT ((ACPI_DB_NAMES, "Node %p [%4.4s] Object %p\n", | 228 | ACPI_DEBUG_PRINT((ACPI_DB_NAMES, "Node %p [%4.4s] Object %p\n", |
242 | node, acpi_ut_get_node_name (node), obj_desc)); | 229 | node, acpi_ut_get_node_name(node), obj_desc)); |
243 | 230 | ||
244 | /* Remove one reference on the object (and all subobjects) */ | 231 | /* Remove one reference on the object (and all subobjects) */ |
245 | 232 | ||
246 | acpi_ut_remove_reference (obj_desc); | 233 | acpi_ut_remove_reference(obj_desc); |
247 | return_VOID; | 234 | return_VOID; |
248 | } | 235 | } |
249 | 236 | ||
250 | |||
251 | /******************************************************************************* | 237 | /******************************************************************************* |
252 | * | 238 | * |
253 | * FUNCTION: acpi_ns_get_attached_object | 239 | * FUNCTION: acpi_ns_get_attached_object |
@@ -261,29 +247,28 @@ acpi_ns_detach_object ( | |||
261 | * | 247 | * |
262 | ******************************************************************************/ | 248 | ******************************************************************************/ |
263 | 249 | ||
264 | union acpi_operand_object * | 250 | union acpi_operand_object *acpi_ns_get_attached_object(struct |
265 | acpi_ns_get_attached_object ( | 251 | acpi_namespace_node |
266 | struct acpi_namespace_node *node) | 252 | *node) |
267 | { | 253 | { |
268 | ACPI_FUNCTION_TRACE_PTR ("ns_get_attached_object", node); | 254 | ACPI_FUNCTION_TRACE_PTR("ns_get_attached_object", node); |
269 | |||
270 | 255 | ||
271 | if (!node) { | 256 | if (!node) { |
272 | ACPI_DEBUG_PRINT ((ACPI_DB_WARN, "Null Node ptr\n")); | 257 | ACPI_DEBUG_PRINT((ACPI_DB_WARN, "Null Node ptr\n")); |
273 | return_PTR (NULL); | 258 | return_PTR(NULL); |
274 | } | 259 | } |
275 | 260 | ||
276 | if (!node->object || | 261 | if (!node->object || |
277 | ((ACPI_GET_DESCRIPTOR_TYPE (node->object) != ACPI_DESC_TYPE_OPERAND) && | 262 | ((ACPI_GET_DESCRIPTOR_TYPE(node->object) != ACPI_DESC_TYPE_OPERAND) |
278 | (ACPI_GET_DESCRIPTOR_TYPE (node->object) != ACPI_DESC_TYPE_NAMED)) || | 263 | && (ACPI_GET_DESCRIPTOR_TYPE(node->object) != |
279 | (ACPI_GET_OBJECT_TYPE (node->object) == ACPI_TYPE_LOCAL_DATA)) { | 264 | ACPI_DESC_TYPE_NAMED)) |
280 | return_PTR (NULL); | 265 | || (ACPI_GET_OBJECT_TYPE(node->object) == ACPI_TYPE_LOCAL_DATA)) { |
266 | return_PTR(NULL); | ||
281 | } | 267 | } |
282 | 268 | ||
283 | return_PTR (node->object); | 269 | return_PTR(node->object); |
284 | } | 270 | } |
285 | 271 | ||
286 | |||
287 | /******************************************************************************* | 272 | /******************************************************************************* |
288 | * | 273 | * |
289 | * FUNCTION: acpi_ns_get_secondary_object | 274 | * FUNCTION: acpi_ns_get_secondary_object |
@@ -297,24 +282,23 @@ acpi_ns_get_attached_object ( | |||
297 | * | 282 | * |
298 | ******************************************************************************/ | 283 | ******************************************************************************/ |
299 | 284 | ||
300 | union acpi_operand_object * | 285 | union acpi_operand_object *acpi_ns_get_secondary_object(union |
301 | acpi_ns_get_secondary_object ( | 286 | acpi_operand_object |
302 | union acpi_operand_object *obj_desc) | 287 | *obj_desc) |
303 | { | 288 | { |
304 | ACPI_FUNCTION_TRACE_PTR ("ns_get_secondary_object", obj_desc); | 289 | ACPI_FUNCTION_TRACE_PTR("ns_get_secondary_object", obj_desc); |
305 | 290 | ||
306 | 291 | if ((!obj_desc) || | |
307 | if ((!obj_desc) || | 292 | (ACPI_GET_OBJECT_TYPE(obj_desc) == ACPI_TYPE_LOCAL_DATA) || |
308 | (ACPI_GET_OBJECT_TYPE (obj_desc) == ACPI_TYPE_LOCAL_DATA) || | 293 | (!obj_desc->common.next_object) || |
309 | (!obj_desc->common.next_object) || | 294 | (ACPI_GET_OBJECT_TYPE(obj_desc->common.next_object) == |
310 | (ACPI_GET_OBJECT_TYPE (obj_desc->common.next_object) == ACPI_TYPE_LOCAL_DATA)) { | 295 | ACPI_TYPE_LOCAL_DATA)) { |
311 | return_PTR (NULL); | 296 | return_PTR(NULL); |
312 | } | 297 | } |
313 | 298 | ||
314 | return_PTR (obj_desc->common.next_object); | 299 | return_PTR(obj_desc->common.next_object); |
315 | } | 300 | } |
316 | 301 | ||
317 | |||
318 | /******************************************************************************* | 302 | /******************************************************************************* |
319 | * | 303 | * |
320 | * FUNCTION: acpi_ns_attach_data | 304 | * FUNCTION: acpi_ns_attach_data |
@@ -330,23 +314,20 @@ acpi_ns_get_secondary_object ( | |||
330 | ******************************************************************************/ | 314 | ******************************************************************************/ |
331 | 315 | ||
332 | acpi_status | 316 | acpi_status |
333 | acpi_ns_attach_data ( | 317 | acpi_ns_attach_data(struct acpi_namespace_node *node, |
334 | struct acpi_namespace_node *node, | 318 | acpi_object_handler handler, void *data) |
335 | acpi_object_handler handler, | ||
336 | void *data) | ||
337 | { | 319 | { |
338 | union acpi_operand_object *prev_obj_desc; | 320 | union acpi_operand_object *prev_obj_desc; |
339 | union acpi_operand_object *obj_desc; | 321 | union acpi_operand_object *obj_desc; |
340 | union acpi_operand_object *data_desc; | 322 | union acpi_operand_object *data_desc; |
341 | |||
342 | 323 | ||
343 | /* We only allow one attachment per handler */ | 324 | /* We only allow one attachment per handler */ |
344 | 325 | ||
345 | prev_obj_desc = NULL; | 326 | prev_obj_desc = NULL; |
346 | obj_desc = node->object; | 327 | obj_desc = node->object; |
347 | while (obj_desc) { | 328 | while (obj_desc) { |
348 | if ((ACPI_GET_OBJECT_TYPE (obj_desc) == ACPI_TYPE_LOCAL_DATA) && | 329 | if ((ACPI_GET_OBJECT_TYPE(obj_desc) == ACPI_TYPE_LOCAL_DATA) && |
349 | (obj_desc->data.handler == handler)) { | 330 | (obj_desc->data.handler == handler)) { |
350 | return (AE_ALREADY_EXISTS); | 331 | return (AE_ALREADY_EXISTS); |
351 | } | 332 | } |
352 | 333 | ||
@@ -356,7 +337,7 @@ acpi_ns_attach_data ( | |||
356 | 337 | ||
357 | /* Create an internal object for the data */ | 338 | /* Create an internal object for the data */ |
358 | 339 | ||
359 | data_desc = acpi_ut_create_internal_object (ACPI_TYPE_LOCAL_DATA); | 340 | data_desc = acpi_ut_create_internal_object(ACPI_TYPE_LOCAL_DATA); |
360 | if (!data_desc) { | 341 | if (!data_desc) { |
361 | return (AE_NO_MEMORY); | 342 | return (AE_NO_MEMORY); |
362 | } | 343 | } |
@@ -368,15 +349,13 @@ acpi_ns_attach_data ( | |||
368 | 349 | ||
369 | if (prev_obj_desc) { | 350 | if (prev_obj_desc) { |
370 | prev_obj_desc->common.next_object = data_desc; | 351 | prev_obj_desc->common.next_object = data_desc; |
371 | } | 352 | } else { |
372 | else { | ||
373 | node->object = data_desc; | 353 | node->object = data_desc; |
374 | } | 354 | } |
375 | 355 | ||
376 | return (AE_OK); | 356 | return (AE_OK); |
377 | } | 357 | } |
378 | 358 | ||
379 | |||
380 | /******************************************************************************* | 359 | /******************************************************************************* |
381 | * | 360 | * |
382 | * FUNCTION: acpi_ns_detach_data | 361 | * FUNCTION: acpi_ns_detach_data |
@@ -392,27 +371,25 @@ acpi_ns_attach_data ( | |||
392 | ******************************************************************************/ | 371 | ******************************************************************************/ |
393 | 372 | ||
394 | acpi_status | 373 | acpi_status |
395 | acpi_ns_detach_data ( | 374 | acpi_ns_detach_data(struct acpi_namespace_node * node, |
396 | struct acpi_namespace_node *node, | 375 | acpi_object_handler handler) |
397 | acpi_object_handler handler) | ||
398 | { | 376 | { |
399 | union acpi_operand_object *obj_desc; | 377 | union acpi_operand_object *obj_desc; |
400 | union acpi_operand_object *prev_obj_desc; | 378 | union acpi_operand_object *prev_obj_desc; |
401 | |||
402 | 379 | ||
403 | prev_obj_desc = NULL; | 380 | prev_obj_desc = NULL; |
404 | obj_desc = node->object; | 381 | obj_desc = node->object; |
405 | while (obj_desc) { | 382 | while (obj_desc) { |
406 | if ((ACPI_GET_OBJECT_TYPE (obj_desc) == ACPI_TYPE_LOCAL_DATA) && | 383 | if ((ACPI_GET_OBJECT_TYPE(obj_desc) == ACPI_TYPE_LOCAL_DATA) && |
407 | (obj_desc->data.handler == handler)) { | 384 | (obj_desc->data.handler == handler)) { |
408 | if (prev_obj_desc) { | 385 | if (prev_obj_desc) { |
409 | prev_obj_desc->common.next_object = obj_desc->common.next_object; | 386 | prev_obj_desc->common.next_object = |
410 | } | 387 | obj_desc->common.next_object; |
411 | else { | 388 | } else { |
412 | node->object = obj_desc->common.next_object; | 389 | node->object = obj_desc->common.next_object; |
413 | } | 390 | } |
414 | 391 | ||
415 | acpi_ut_remove_reference (obj_desc); | 392 | acpi_ut_remove_reference(obj_desc); |
416 | return (AE_OK); | 393 | return (AE_OK); |
417 | } | 394 | } |
418 | 395 | ||
@@ -423,7 +400,6 @@ acpi_ns_detach_data ( | |||
423 | return (AE_NOT_FOUND); | 400 | return (AE_NOT_FOUND); |
424 | } | 401 | } |
425 | 402 | ||
426 | |||
427 | /******************************************************************************* | 403 | /******************************************************************************* |
428 | * | 404 | * |
429 | * FUNCTION: acpi_ns_get_attached_data | 405 | * FUNCTION: acpi_ns_get_attached_data |
@@ -440,18 +416,15 @@ acpi_ns_detach_data ( | |||
440 | ******************************************************************************/ | 416 | ******************************************************************************/ |
441 | 417 | ||
442 | acpi_status | 418 | acpi_status |
443 | acpi_ns_get_attached_data ( | 419 | acpi_ns_get_attached_data(struct acpi_namespace_node * node, |
444 | struct acpi_namespace_node *node, | 420 | acpi_object_handler handler, void **data) |
445 | acpi_object_handler handler, | ||
446 | void **data) | ||
447 | { | 421 | { |
448 | union acpi_operand_object *obj_desc; | 422 | union acpi_operand_object *obj_desc; |
449 | |||
450 | 423 | ||
451 | obj_desc = node->object; | 424 | obj_desc = node->object; |
452 | while (obj_desc) { | 425 | while (obj_desc) { |
453 | if ((ACPI_GET_OBJECT_TYPE (obj_desc) == ACPI_TYPE_LOCAL_DATA) && | 426 | if ((ACPI_GET_OBJECT_TYPE(obj_desc) == ACPI_TYPE_LOCAL_DATA) && |
454 | (obj_desc->data.handler == handler)) { | 427 | (obj_desc->data.handler == handler)) { |
455 | *data = obj_desc->data.pointer; | 428 | *data = obj_desc->data.pointer; |
456 | return (AE_OK); | 429 | return (AE_OK); |
457 | } | 430 | } |
@@ -461,5 +434,3 @@ acpi_ns_get_attached_data ( | |||
461 | 434 | ||
462 | return (AE_NOT_FOUND); | 435 | return (AE_NOT_FOUND); |
463 | } | 436 | } |
464 | |||
465 | |||
diff --git a/drivers/acpi/namespace/nsparse.c b/drivers/acpi/namespace/nsparse.c index 24bed931d39d..433442a9ec74 100644 --- a/drivers/acpi/namespace/nsparse.c +++ b/drivers/acpi/namespace/nsparse.c | |||
@@ -41,16 +41,13 @@ | |||
41 | * POSSIBILITY OF SUCH DAMAGES. | 41 | * POSSIBILITY OF SUCH DAMAGES. |
42 | */ | 42 | */ |
43 | 43 | ||
44 | |||
45 | #include <acpi/acpi.h> | 44 | #include <acpi/acpi.h> |
46 | #include <acpi/acnamesp.h> | 45 | #include <acpi/acnamesp.h> |
47 | #include <acpi/acparser.h> | 46 | #include <acpi/acparser.h> |
48 | #include <acpi/acdispat.h> | 47 | #include <acpi/acdispat.h> |
49 | 48 | ||
50 | |||
51 | #define _COMPONENT ACPI_NAMESPACE | 49 | #define _COMPONENT ACPI_NAMESPACE |
52 | ACPI_MODULE_NAME ("nsparse") | 50 | ACPI_MODULE_NAME("nsparse") |
53 | |||
54 | 51 | ||
55 | /******************************************************************************* | 52 | /******************************************************************************* |
56 | * | 53 | * |
@@ -64,54 +61,50 @@ | |||
64 | * DESCRIPTION: Perform one complete parse of an ACPI/AML table. | 61 | * DESCRIPTION: Perform one complete parse of an ACPI/AML table. |
65 | * | 62 | * |
66 | ******************************************************************************/ | 63 | ******************************************************************************/ |
67 | |||
68 | acpi_status | 64 | acpi_status |
69 | acpi_ns_one_complete_parse ( | 65 | acpi_ns_one_complete_parse(u8 pass_number, struct acpi_table_desc * table_desc) |
70 | u8 pass_number, | ||
71 | struct acpi_table_desc *table_desc) | ||
72 | { | 66 | { |
73 | union acpi_parse_object *parse_root; | 67 | union acpi_parse_object *parse_root; |
74 | acpi_status status; | 68 | acpi_status status; |
75 | struct acpi_walk_state *walk_state; | 69 | struct acpi_walk_state *walk_state; |
76 | |||
77 | |||
78 | ACPI_FUNCTION_TRACE ("ns_one_complete_parse"); | ||
79 | 70 | ||
71 | ACPI_FUNCTION_TRACE("ns_one_complete_parse"); | ||
80 | 72 | ||
81 | /* Create and init a Root Node */ | 73 | /* Create and init a Root Node */ |
82 | 74 | ||
83 | parse_root = acpi_ps_create_scope_op (); | 75 | parse_root = acpi_ps_create_scope_op(); |
84 | if (!parse_root) { | 76 | if (!parse_root) { |
85 | return_ACPI_STATUS (AE_NO_MEMORY); | 77 | return_ACPI_STATUS(AE_NO_MEMORY); |
86 | } | 78 | } |
87 | 79 | ||
88 | /* Create and initialize a new walk state */ | 80 | /* Create and initialize a new walk state */ |
89 | 81 | ||
90 | walk_state = acpi_ds_create_walk_state (table_desc->owner_id, | 82 | walk_state = acpi_ds_create_walk_state(table_desc->owner_id, |
91 | NULL, NULL, NULL); | 83 | NULL, NULL, NULL); |
92 | if (!walk_state) { | 84 | if (!walk_state) { |
93 | acpi_ps_free_op (parse_root); | 85 | acpi_ps_free_op(parse_root); |
94 | return_ACPI_STATUS (AE_NO_MEMORY); | 86 | return_ACPI_STATUS(AE_NO_MEMORY); |
95 | } | 87 | } |
96 | 88 | ||
97 | status = acpi_ds_init_aml_walk (walk_state, parse_root, NULL, | 89 | status = acpi_ds_init_aml_walk(walk_state, parse_root, NULL, |
98 | table_desc->aml_start, table_desc->aml_length, | 90 | table_desc->aml_start, |
99 | NULL, pass_number); | 91 | table_desc->aml_length, NULL, |
100 | if (ACPI_FAILURE (status)) { | 92 | pass_number); |
101 | acpi_ds_delete_walk_state (walk_state); | 93 | if (ACPI_FAILURE(status)) { |
102 | return_ACPI_STATUS (status); | 94 | acpi_ds_delete_walk_state(walk_state); |
95 | return_ACPI_STATUS(status); | ||
103 | } | 96 | } |
104 | 97 | ||
105 | /* Parse the AML */ | 98 | /* Parse the AML */ |
106 | 99 | ||
107 | ACPI_DEBUG_PRINT ((ACPI_DB_PARSE, "*PARSE* pass %d parse\n", pass_number)); | 100 | ACPI_DEBUG_PRINT((ACPI_DB_PARSE, "*PARSE* pass %d parse\n", |
108 | status = acpi_ps_parse_aml (walk_state); | 101 | pass_number)); |
102 | status = acpi_ps_parse_aml(walk_state); | ||
109 | 103 | ||
110 | acpi_ps_delete_parse_tree (parse_root); | 104 | acpi_ps_delete_parse_tree(parse_root); |
111 | return_ACPI_STATUS (status); | 105 | return_ACPI_STATUS(status); |
112 | } | 106 | } |
113 | 107 | ||
114 | |||
115 | /******************************************************************************* | 108 | /******************************************************************************* |
116 | * | 109 | * |
117 | * FUNCTION: acpi_ns_parse_table | 110 | * FUNCTION: acpi_ns_parse_table |
@@ -126,15 +119,12 @@ acpi_ns_one_complete_parse ( | |||
126 | ******************************************************************************/ | 119 | ******************************************************************************/ |
127 | 120 | ||
128 | acpi_status | 121 | acpi_status |
129 | acpi_ns_parse_table ( | 122 | acpi_ns_parse_table(struct acpi_table_desc *table_desc, |
130 | struct acpi_table_desc *table_desc, | 123 | struct acpi_namespace_node *start_node) |
131 | struct acpi_namespace_node *start_node) | ||
132 | { | 124 | { |
133 | acpi_status status; | 125 | acpi_status status; |
134 | |||
135 | |||
136 | ACPI_FUNCTION_TRACE ("ns_parse_table"); | ||
137 | 126 | ||
127 | ACPI_FUNCTION_TRACE("ns_parse_table"); | ||
138 | 128 | ||
139 | /* | 129 | /* |
140 | * AML Parse, pass 1 | 130 | * AML Parse, pass 1 |
@@ -146,10 +136,10 @@ acpi_ns_parse_table ( | |||
146 | * to service the entire parse. The second pass of the parse then | 136 | * to service the entire parse. The second pass of the parse then |
147 | * performs another complete parse of the AML.. | 137 | * performs another complete parse of the AML.. |
148 | */ | 138 | */ |
149 | ACPI_DEBUG_PRINT ((ACPI_DB_PARSE, "**** Start pass 1\n")); | 139 | ACPI_DEBUG_PRINT((ACPI_DB_PARSE, "**** Start pass 1\n")); |
150 | status = acpi_ns_one_complete_parse (1, table_desc); | 140 | status = acpi_ns_one_complete_parse(1, table_desc); |
151 | if (ACPI_FAILURE (status)) { | 141 | if (ACPI_FAILURE(status)) { |
152 | return_ACPI_STATUS (status); | 142 | return_ACPI_STATUS(status); |
153 | } | 143 | } |
154 | 144 | ||
155 | /* | 145 | /* |
@@ -161,13 +151,11 @@ acpi_ns_parse_table ( | |||
161 | * overhead of this is compensated for by the fact that the | 151 | * overhead of this is compensated for by the fact that the |
162 | * parse objects are all cached. | 152 | * parse objects are all cached. |
163 | */ | 153 | */ |
164 | ACPI_DEBUG_PRINT ((ACPI_DB_PARSE, "**** Start pass 2\n")); | 154 | ACPI_DEBUG_PRINT((ACPI_DB_PARSE, "**** Start pass 2\n")); |
165 | status = acpi_ns_one_complete_parse (2, table_desc); | 155 | status = acpi_ns_one_complete_parse(2, table_desc); |
166 | if (ACPI_FAILURE (status)) { | 156 | if (ACPI_FAILURE(status)) { |
167 | return_ACPI_STATUS (status); | 157 | return_ACPI_STATUS(status); |
168 | } | 158 | } |
169 | 159 | ||
170 | return_ACPI_STATUS (status); | 160 | return_ACPI_STATUS(status); |
171 | } | 161 | } |
172 | |||
173 | |||
diff --git a/drivers/acpi/namespace/nssearch.c b/drivers/acpi/namespace/nssearch.c index af8aaa9cc4f3..50a3ca5470ed 100644 --- a/drivers/acpi/namespace/nssearch.c +++ b/drivers/acpi/namespace/nssearch.c | |||
@@ -41,23 +41,18 @@ | |||
41 | * POSSIBILITY OF SUCH DAMAGES. | 41 | * POSSIBILITY OF SUCH DAMAGES. |
42 | */ | 42 | */ |
43 | 43 | ||
44 | |||
45 | #include <acpi/acpi.h> | 44 | #include <acpi/acpi.h> |
46 | #include <acpi/acnamesp.h> | 45 | #include <acpi/acnamesp.h> |
47 | 46 | ||
48 | |||
49 | #define _COMPONENT ACPI_NAMESPACE | 47 | #define _COMPONENT ACPI_NAMESPACE |
50 | ACPI_MODULE_NAME ("nssearch") | 48 | ACPI_MODULE_NAME("nssearch") |
51 | 49 | ||
52 | /* Local prototypes */ | 50 | /* Local prototypes */ |
53 | |||
54 | static acpi_status | 51 | static acpi_status |
55 | acpi_ns_search_parent_tree ( | 52 | acpi_ns_search_parent_tree(u32 target_name, |
56 | u32 target_name, | 53 | struct acpi_namespace_node *node, |
57 | struct acpi_namespace_node *node, | 54 | acpi_object_type type, |
58 | acpi_object_type type, | 55 | struct acpi_namespace_node **return_node); |
59 | struct acpi_namespace_node **return_node); | ||
60 | |||
61 | 56 | ||
62 | /******************************************************************************* | 57 | /******************************************************************************* |
63 | * | 58 | * |
@@ -87,30 +82,28 @@ acpi_ns_search_parent_tree ( | |||
87 | ******************************************************************************/ | 82 | ******************************************************************************/ |
88 | 83 | ||
89 | acpi_status | 84 | acpi_status |
90 | acpi_ns_search_node ( | 85 | acpi_ns_search_node(u32 target_name, |
91 | u32 target_name, | 86 | struct acpi_namespace_node *node, |
92 | struct acpi_namespace_node *node, | 87 | acpi_object_type type, |
93 | acpi_object_type type, | 88 | struct acpi_namespace_node **return_node) |
94 | struct acpi_namespace_node **return_node) | ||
95 | { | 89 | { |
96 | struct acpi_namespace_node *next_node; | 90 | struct acpi_namespace_node *next_node; |
97 | |||
98 | |||
99 | ACPI_FUNCTION_TRACE ("ns_search_node"); | ||
100 | 91 | ||
92 | ACPI_FUNCTION_TRACE("ns_search_node"); | ||
101 | 93 | ||
102 | #ifdef ACPI_DEBUG_OUTPUT | 94 | #ifdef ACPI_DEBUG_OUTPUT |
103 | if (ACPI_LV_NAMES & acpi_dbg_level) { | 95 | if (ACPI_LV_NAMES & acpi_dbg_level) { |
104 | char *scope_name; | 96 | char *scope_name; |
105 | 97 | ||
106 | scope_name = acpi_ns_get_external_pathname (node); | 98 | scope_name = acpi_ns_get_external_pathname(node); |
107 | if (scope_name) { | 99 | if (scope_name) { |
108 | ACPI_DEBUG_PRINT ((ACPI_DB_NAMES, | 100 | ACPI_DEBUG_PRINT((ACPI_DB_NAMES, |
109 | "Searching %s (%p) For [%4.4s] (%s)\n", | 101 | "Searching %s (%p) For [%4.4s] (%s)\n", |
110 | scope_name, node, (char *) &target_name, | 102 | scope_name, node, |
111 | acpi_ut_get_type_name (type))); | 103 | (char *)&target_name, |
104 | acpi_ut_get_type_name(type))); | ||
112 | 105 | ||
113 | ACPI_MEM_FREE (scope_name); | 106 | ACPI_MEM_FREE(scope_name); |
114 | } | 107 | } |
115 | } | 108 | } |
116 | #endif | 109 | #endif |
@@ -126,20 +119,26 @@ acpi_ns_search_node ( | |||
126 | if (next_node->name.integer == target_name) { | 119 | if (next_node->name.integer == target_name) { |
127 | /* Resolve a control method alias if any */ | 120 | /* Resolve a control method alias if any */ |
128 | 121 | ||
129 | if (acpi_ns_get_type (next_node) == ACPI_TYPE_LOCAL_METHOD_ALIAS) { | 122 | if (acpi_ns_get_type(next_node) == |
130 | next_node = ACPI_CAST_PTR (struct acpi_namespace_node, next_node->object); | 123 | ACPI_TYPE_LOCAL_METHOD_ALIAS) { |
124 | next_node = | ||
125 | ACPI_CAST_PTR(struct acpi_namespace_node, | ||
126 | next_node->object); | ||
131 | } | 127 | } |
132 | 128 | ||
133 | /* | 129 | /* |
134 | * Found matching entry. | 130 | * Found matching entry. |
135 | */ | 131 | */ |
136 | ACPI_DEBUG_PRINT ((ACPI_DB_NAMES, | 132 | ACPI_DEBUG_PRINT((ACPI_DB_NAMES, |
137 | "Name [%4.4s] (%s) %p found in scope [%4.4s] %p\n", | 133 | "Name [%4.4s] (%s) %p found in scope [%4.4s] %p\n", |
138 | (char *) &target_name, acpi_ut_get_type_name (next_node->type), | 134 | (char *)&target_name, |
139 | next_node, acpi_ut_get_node_name (node), node)); | 135 | acpi_ut_get_type_name(next_node-> |
136 | type), | ||
137 | next_node, | ||
138 | acpi_ut_get_node_name(node), node)); | ||
140 | 139 | ||
141 | *return_node = next_node; | 140 | *return_node = next_node; |
142 | return_ACPI_STATUS (AE_OK); | 141 | return_ACPI_STATUS(AE_OK); |
143 | } | 142 | } |
144 | 143 | ||
145 | /* | 144 | /* |
@@ -159,15 +158,14 @@ acpi_ns_search_node ( | |||
159 | 158 | ||
160 | /* Searched entire namespace level, not found */ | 159 | /* Searched entire namespace level, not found */ |
161 | 160 | ||
162 | ACPI_DEBUG_PRINT ((ACPI_DB_NAMES, | 161 | ACPI_DEBUG_PRINT((ACPI_DB_NAMES, |
163 | "Name [%4.4s] (%s) not found in search in scope [%4.4s] %p first child %p\n", | 162 | "Name [%4.4s] (%s) not found in search in scope [%4.4s] %p first child %p\n", |
164 | (char *) &target_name, acpi_ut_get_type_name (type), | 163 | (char *)&target_name, acpi_ut_get_type_name(type), |
165 | acpi_ut_get_node_name (node), node, node->child)); | 164 | acpi_ut_get_node_name(node), node, node->child)); |
166 | 165 | ||
167 | return_ACPI_STATUS (AE_NOT_FOUND); | 166 | return_ACPI_STATUS(AE_NOT_FOUND); |
168 | } | 167 | } |
169 | 168 | ||
170 | |||
171 | /******************************************************************************* | 169 | /******************************************************************************* |
172 | * | 170 | * |
173 | * FUNCTION: acpi_ns_search_parent_tree | 171 | * FUNCTION: acpi_ns_search_parent_tree |
@@ -194,43 +192,42 @@ acpi_ns_search_node ( | |||
194 | ******************************************************************************/ | 192 | ******************************************************************************/ |
195 | 193 | ||
196 | static acpi_status | 194 | static acpi_status |
197 | acpi_ns_search_parent_tree ( | 195 | acpi_ns_search_parent_tree(u32 target_name, |
198 | u32 target_name, | 196 | struct acpi_namespace_node *node, |
199 | struct acpi_namespace_node *node, | 197 | acpi_object_type type, |
200 | acpi_object_type type, | 198 | struct acpi_namespace_node **return_node) |
201 | struct acpi_namespace_node **return_node) | ||
202 | { | 199 | { |
203 | acpi_status status; | 200 | acpi_status status; |
204 | struct acpi_namespace_node *parent_node; | 201 | struct acpi_namespace_node *parent_node; |
205 | 202 | ||
203 | ACPI_FUNCTION_TRACE("ns_search_parent_tree"); | ||
206 | 204 | ||
207 | ACPI_FUNCTION_TRACE ("ns_search_parent_tree"); | 205 | parent_node = acpi_ns_get_parent_node(node); |
208 | |||
209 | |||
210 | parent_node = acpi_ns_get_parent_node (node); | ||
211 | 206 | ||
212 | /* | 207 | /* |
213 | * If there is no parent (i.e., we are at the root) or type is "local", | 208 | * If there is no parent (i.e., we are at the root) or type is "local", |
214 | * we won't be searching the parent tree. | 209 | * we won't be searching the parent tree. |
215 | */ | 210 | */ |
216 | if (!parent_node) { | 211 | if (!parent_node) { |
217 | ACPI_DEBUG_PRINT ((ACPI_DB_NAMES, "[%4.4s] has no parent\n", | 212 | ACPI_DEBUG_PRINT((ACPI_DB_NAMES, "[%4.4s] has no parent\n", |
218 | (char *) &target_name)); | 213 | (char *)&target_name)); |
219 | return_ACPI_STATUS (AE_NOT_FOUND); | 214 | return_ACPI_STATUS(AE_NOT_FOUND); |
220 | } | 215 | } |
221 | 216 | ||
222 | if (acpi_ns_local (type)) { | 217 | if (acpi_ns_local(type)) { |
223 | ACPI_DEBUG_PRINT ((ACPI_DB_NAMES, | 218 | ACPI_DEBUG_PRINT((ACPI_DB_NAMES, |
224 | "[%4.4s] type [%s] must be local to this scope (no parent search)\n", | 219 | "[%4.4s] type [%s] must be local to this scope (no parent search)\n", |
225 | (char *) &target_name, acpi_ut_get_type_name (type))); | 220 | (char *)&target_name, |
226 | return_ACPI_STATUS (AE_NOT_FOUND); | 221 | acpi_ut_get_type_name(type))); |
222 | return_ACPI_STATUS(AE_NOT_FOUND); | ||
227 | } | 223 | } |
228 | 224 | ||
229 | /* Search the parent tree */ | 225 | /* Search the parent tree */ |
230 | 226 | ||
231 | ACPI_DEBUG_PRINT ((ACPI_DB_NAMES, | 227 | ACPI_DEBUG_PRINT((ACPI_DB_NAMES, |
232 | "Searching parent [%4.4s] for [%4.4s]\n", | 228 | "Searching parent [%4.4s] for [%4.4s]\n", |
233 | acpi_ut_get_node_name (parent_node), (char *) &target_name)); | 229 | acpi_ut_get_node_name(parent_node), |
230 | (char *)&target_name)); | ||
234 | 231 | ||
235 | /* | 232 | /* |
236 | * Search parents until target is found or we have backed up to the root | 233 | * Search parents until target is found or we have backed up to the root |
@@ -241,25 +238,24 @@ acpi_ns_search_parent_tree ( | |||
241 | * object type at this point, we only care about the existence of | 238 | * object type at this point, we only care about the existence of |
242 | * the actual name we are searching for. Typechecking comes later. | 239 | * the actual name we are searching for. Typechecking comes later. |
243 | */ | 240 | */ |
244 | status = acpi_ns_search_node (target_name, parent_node, | 241 | status = acpi_ns_search_node(target_name, parent_node, |
245 | ACPI_TYPE_ANY, return_node); | 242 | ACPI_TYPE_ANY, return_node); |
246 | if (ACPI_SUCCESS (status)) { | 243 | if (ACPI_SUCCESS(status)) { |
247 | return_ACPI_STATUS (status); | 244 | return_ACPI_STATUS(status); |
248 | } | 245 | } |
249 | 246 | ||
250 | /* | 247 | /* |
251 | * Not found here, go up another level | 248 | * Not found here, go up another level |
252 | * (until we reach the root) | 249 | * (until we reach the root) |
253 | */ | 250 | */ |
254 | parent_node = acpi_ns_get_parent_node (parent_node); | 251 | parent_node = acpi_ns_get_parent_node(parent_node); |
255 | } | 252 | } |
256 | 253 | ||
257 | /* Not found in parent tree */ | 254 | /* Not found in parent tree */ |
258 | 255 | ||
259 | return_ACPI_STATUS (AE_NOT_FOUND); | 256 | return_ACPI_STATUS(AE_NOT_FOUND); |
260 | } | 257 | } |
261 | 258 | ||
262 | |||
263 | /******************************************************************************* | 259 | /******************************************************************************* |
264 | * | 260 | * |
265 | * FUNCTION: acpi_ns_search_and_enter | 261 | * FUNCTION: acpi_ns_search_and_enter |
@@ -286,52 +282,46 @@ acpi_ns_search_parent_tree ( | |||
286 | ******************************************************************************/ | 282 | ******************************************************************************/ |
287 | 283 | ||
288 | acpi_status | 284 | acpi_status |
289 | acpi_ns_search_and_enter ( | 285 | acpi_ns_search_and_enter(u32 target_name, |
290 | u32 target_name, | 286 | struct acpi_walk_state *walk_state, |
291 | struct acpi_walk_state *walk_state, | 287 | struct acpi_namespace_node *node, |
292 | struct acpi_namespace_node *node, | 288 | acpi_interpreter_mode interpreter_mode, |
293 | acpi_interpreter_mode interpreter_mode, | 289 | acpi_object_type type, |
294 | acpi_object_type type, | 290 | u32 flags, struct acpi_namespace_node **return_node) |
295 | u32 flags, | ||
296 | struct acpi_namespace_node **return_node) | ||
297 | { | 291 | { |
298 | acpi_status status; | 292 | acpi_status status; |
299 | struct acpi_namespace_node *new_node; | 293 | struct acpi_namespace_node *new_node; |
300 | |||
301 | |||
302 | ACPI_FUNCTION_TRACE ("ns_search_and_enter"); | ||
303 | 294 | ||
295 | ACPI_FUNCTION_TRACE("ns_search_and_enter"); | ||
304 | 296 | ||
305 | /* Parameter validation */ | 297 | /* Parameter validation */ |
306 | 298 | ||
307 | if (!node || !target_name || !return_node) { | 299 | if (!node || !target_name || !return_node) { |
308 | ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, | 300 | ACPI_DEBUG_PRINT((ACPI_DB_ERROR, |
309 | "Null param: Node %p Name %X return_node %p\n", | 301 | "Null param: Node %p Name %X return_node %p\n", |
310 | node, target_name, return_node)); | 302 | node, target_name, return_node)); |
311 | 303 | ||
312 | ACPI_REPORT_ERROR (("ns_search_and_enter: Null parameter\n")); | 304 | ACPI_REPORT_ERROR(("ns_search_and_enter: Null parameter\n")); |
313 | return_ACPI_STATUS (AE_BAD_PARAMETER); | 305 | return_ACPI_STATUS(AE_BAD_PARAMETER); |
314 | } | 306 | } |
315 | 307 | ||
316 | /* Name must consist of printable characters */ | 308 | /* Name must consist of printable characters */ |
317 | 309 | ||
318 | if (!acpi_ut_valid_acpi_name (target_name)) { | 310 | if (!acpi_ut_valid_acpi_name(target_name)) { |
319 | ACPI_REPORT_ERROR (("ns_search_and_enter: Bad character in ACPI Name: %X\n", | 311 | ACPI_REPORT_ERROR(("ns_search_and_enter: Bad character in ACPI Name: %X\n", target_name)); |
320 | target_name)); | 312 | return_ACPI_STATUS(AE_BAD_CHARACTER); |
321 | return_ACPI_STATUS (AE_BAD_CHARACTER); | ||
322 | } | 313 | } |
323 | 314 | ||
324 | /* Try to find the name in the namespace level specified by the caller */ | 315 | /* Try to find the name in the namespace level specified by the caller */ |
325 | 316 | ||
326 | *return_node = ACPI_ENTRY_NOT_FOUND; | 317 | *return_node = ACPI_ENTRY_NOT_FOUND; |
327 | status = acpi_ns_search_node (target_name, node, type, return_node); | 318 | status = acpi_ns_search_node(target_name, node, type, return_node); |
328 | if (status != AE_NOT_FOUND) { | 319 | if (status != AE_NOT_FOUND) { |
329 | /* | 320 | /* |
330 | * If we found it AND the request specifies that a find is an error, | 321 | * If we found it AND the request specifies that a find is an error, |
331 | * return the error | 322 | * return the error |
332 | */ | 323 | */ |
333 | if ((status == AE_OK) && | 324 | if ((status == AE_OK) && (flags & ACPI_NS_ERROR_IF_FOUND)) { |
334 | (flags & ACPI_NS_ERROR_IF_FOUND)) { | ||
335 | status = AE_ALREADY_EXISTS; | 325 | status = AE_ALREADY_EXISTS; |
336 | } | 326 | } |
337 | 327 | ||
@@ -339,7 +329,7 @@ acpi_ns_search_and_enter ( | |||
339 | * Either found it or there was an error | 329 | * Either found it or there was an error |
340 | * -- finished either way | 330 | * -- finished either way |
341 | */ | 331 | */ |
342 | return_ACPI_STATUS (status); | 332 | return_ACPI_STATUS(status); |
343 | } | 333 | } |
344 | 334 | ||
345 | /* | 335 | /* |
@@ -351,14 +341,16 @@ acpi_ns_search_and_enter ( | |||
351 | * and during the execution phase. | 341 | * and during the execution phase. |
352 | */ | 342 | */ |
353 | if ((interpreter_mode != ACPI_IMODE_LOAD_PASS1) && | 343 | if ((interpreter_mode != ACPI_IMODE_LOAD_PASS1) && |
354 | (flags & ACPI_NS_SEARCH_PARENT)) { | 344 | (flags & ACPI_NS_SEARCH_PARENT)) { |
355 | /* | 345 | /* |
356 | * Not found at this level - search parent tree according to the | 346 | * Not found at this level - search parent tree according to the |
357 | * ACPI specification | 347 | * ACPI specification |
358 | */ | 348 | */ |
359 | status = acpi_ns_search_parent_tree (target_name, node, type, return_node); | 349 | status = |
360 | if (ACPI_SUCCESS (status)) { | 350 | acpi_ns_search_parent_tree(target_name, node, type, |
361 | return_ACPI_STATUS (status); | 351 | return_node); |
352 | if (ACPI_SUCCESS(status)) { | ||
353 | return_ACPI_STATUS(status); | ||
362 | } | 354 | } |
363 | } | 355 | } |
364 | 356 | ||
@@ -366,25 +358,24 @@ acpi_ns_search_and_enter ( | |||
366 | * In execute mode, just search, never add names. Exit now. | 358 | * In execute mode, just search, never add names. Exit now. |
367 | */ | 359 | */ |
368 | if (interpreter_mode == ACPI_IMODE_EXECUTE) { | 360 | if (interpreter_mode == ACPI_IMODE_EXECUTE) { |
369 | ACPI_DEBUG_PRINT ((ACPI_DB_NAMES, | 361 | ACPI_DEBUG_PRINT((ACPI_DB_NAMES, |
370 | "%4.4s Not found in %p [Not adding]\n", | 362 | "%4.4s Not found in %p [Not adding]\n", |
371 | (char *) &target_name, node)); | 363 | (char *)&target_name, node)); |
372 | 364 | ||
373 | return_ACPI_STATUS (AE_NOT_FOUND); | 365 | return_ACPI_STATUS(AE_NOT_FOUND); |
374 | } | 366 | } |
375 | 367 | ||
376 | /* Create the new named object */ | 368 | /* Create the new named object */ |
377 | 369 | ||
378 | new_node = acpi_ns_create_node (target_name); | 370 | new_node = acpi_ns_create_node(target_name); |
379 | if (!new_node) { | 371 | if (!new_node) { |
380 | return_ACPI_STATUS (AE_NO_MEMORY); | 372 | return_ACPI_STATUS(AE_NO_MEMORY); |
381 | } | 373 | } |
382 | 374 | ||
383 | /* Install the new object into the parent's list of children */ | 375 | /* Install the new object into the parent's list of children */ |
384 | 376 | ||
385 | acpi_ns_install_node (walk_state, node, new_node, type); | 377 | acpi_ns_install_node(walk_state, node, new_node, type); |
386 | *return_node = new_node; | 378 | *return_node = new_node; |
387 | 379 | ||
388 | return_ACPI_STATUS (AE_OK); | 380 | return_ACPI_STATUS(AE_OK); |
389 | } | 381 | } |
390 | |||
diff --git a/drivers/acpi/namespace/nsutils.c b/drivers/acpi/namespace/nsutils.c index c53b82e94ce3..ebec036423c9 100644 --- a/drivers/acpi/namespace/nsutils.c +++ b/drivers/acpi/namespace/nsutils.c | |||
@@ -42,28 +42,21 @@ | |||
42 | * POSSIBILITY OF SUCH DAMAGES. | 42 | * POSSIBILITY OF SUCH DAMAGES. |
43 | */ | 43 | */ |
44 | 44 | ||
45 | |||
46 | #include <acpi/acpi.h> | 45 | #include <acpi/acpi.h> |
47 | #include <acpi/acnamesp.h> | 46 | #include <acpi/acnamesp.h> |
48 | #include <acpi/amlcode.h> | 47 | #include <acpi/amlcode.h> |
49 | #include <acpi/actables.h> | 48 | #include <acpi/actables.h> |
50 | 49 | ||
51 | #define _COMPONENT ACPI_NAMESPACE | 50 | #define _COMPONENT ACPI_NAMESPACE |
52 | ACPI_MODULE_NAME ("nsutils") | 51 | ACPI_MODULE_NAME("nsutils") |
53 | 52 | ||
54 | /* Local prototypes */ | 53 | /* Local prototypes */ |
55 | 54 | static u8 acpi_ns_valid_path_separator(char sep); | |
56 | static u8 | ||
57 | acpi_ns_valid_path_separator ( | ||
58 | char sep); | ||
59 | 55 | ||
60 | #ifdef ACPI_OBSOLETE_FUNCTIONS | 56 | #ifdef ACPI_OBSOLETE_FUNCTIONS |
61 | acpi_name | 57 | acpi_name acpi_ns_find_parent_name(struct acpi_namespace_node *node_to_search); |
62 | acpi_ns_find_parent_name ( | ||
63 | struct acpi_namespace_node *node_to_search); | ||
64 | #endif | 58 | #endif |
65 | 59 | ||
66 | |||
67 | /******************************************************************************* | 60 | /******************************************************************************* |
68 | * | 61 | * |
69 | * FUNCTION: acpi_ns_report_error | 62 | * FUNCTION: acpi_ns_report_error |
@@ -81,51 +74,45 @@ acpi_ns_find_parent_name ( | |||
81 | ******************************************************************************/ | 74 | ******************************************************************************/ |
82 | 75 | ||
83 | void | 76 | void |
84 | acpi_ns_report_error ( | 77 | acpi_ns_report_error(char *module_name, |
85 | char *module_name, | 78 | u32 line_number, |
86 | u32 line_number, | 79 | u32 component_id, |
87 | u32 component_id, | 80 | char *internal_name, acpi_status lookup_status) |
88 | char *internal_name, | ||
89 | acpi_status lookup_status) | ||
90 | { | 81 | { |
91 | acpi_status status; | 82 | acpi_status status; |
92 | char *name = NULL; | 83 | char *name = NULL; |
93 | |||
94 | 84 | ||
95 | acpi_os_printf ("%8s-%04d: *** Error: Looking up ", | 85 | acpi_os_printf("%8s-%04d: *** Error: Looking up ", |
96 | module_name, line_number); | 86 | module_name, line_number); |
97 | 87 | ||
98 | if (lookup_status == AE_BAD_CHARACTER) { | 88 | if (lookup_status == AE_BAD_CHARACTER) { |
99 | /* There is a non-ascii character in the name */ | 89 | /* There is a non-ascii character in the name */ |
100 | 90 | ||
101 | acpi_os_printf ("[0x%4.4X] (NON-ASCII)\n", | 91 | acpi_os_printf("[0x%4.4X] (NON-ASCII)\n", |
102 | *(ACPI_CAST_PTR (u32, internal_name))); | 92 | *(ACPI_CAST_PTR(u32, internal_name))); |
103 | } | 93 | } else { |
104 | else { | ||
105 | /* Convert path to external format */ | 94 | /* Convert path to external format */ |
106 | 95 | ||
107 | status = acpi_ns_externalize_name (ACPI_UINT32_MAX, | 96 | status = acpi_ns_externalize_name(ACPI_UINT32_MAX, |
108 | internal_name, NULL, &name); | 97 | internal_name, NULL, &name); |
109 | 98 | ||
110 | /* Print target name */ | 99 | /* Print target name */ |
111 | 100 | ||
112 | if (ACPI_SUCCESS (status)) { | 101 | if (ACPI_SUCCESS(status)) { |
113 | acpi_os_printf ("[%s]", name); | 102 | acpi_os_printf("[%s]", name); |
114 | } | 103 | } else { |
115 | else { | 104 | acpi_os_printf("[COULD NOT EXTERNALIZE NAME]"); |
116 | acpi_os_printf ("[COULD NOT EXTERNALIZE NAME]"); | ||
117 | } | 105 | } |
118 | 106 | ||
119 | if (name) { | 107 | if (name) { |
120 | ACPI_MEM_FREE (name); | 108 | ACPI_MEM_FREE(name); |
121 | } | 109 | } |
122 | } | 110 | } |
123 | 111 | ||
124 | acpi_os_printf (" in namespace, %s\n", | 112 | acpi_os_printf(" in namespace, %s\n", |
125 | acpi_format_exception (lookup_status)); | 113 | acpi_format_exception(lookup_status)); |
126 | } | 114 | } |
127 | 115 | ||
128 | |||
129 | /******************************************************************************* | 116 | /******************************************************************************* |
130 | * | 117 | * |
131 | * FUNCTION: acpi_ns_report_method_error | 118 | * FUNCTION: acpi_ns_report_method_error |
@@ -145,34 +132,31 @@ acpi_ns_report_error ( | |||
145 | ******************************************************************************/ | 132 | ******************************************************************************/ |
146 | 133 | ||
147 | void | 134 | void |
148 | acpi_ns_report_method_error ( | 135 | acpi_ns_report_method_error(char *module_name, |
149 | char *module_name, | 136 | u32 line_number, |
150 | u32 line_number, | 137 | u32 component_id, |
151 | u32 component_id, | 138 | char *message, |
152 | char *message, | 139 | struct acpi_namespace_node *prefix_node, |
153 | struct acpi_namespace_node *prefix_node, | 140 | char *path, acpi_status method_status) |
154 | char *path, | ||
155 | acpi_status method_status) | ||
156 | { | 141 | { |
157 | acpi_status status; | 142 | acpi_status status; |
158 | struct acpi_namespace_node *node = prefix_node; | 143 | struct acpi_namespace_node *node = prefix_node; |
159 | |||
160 | 144 | ||
161 | if (path) { | 145 | if (path) { |
162 | status = acpi_ns_get_node_by_path (path, prefix_node, | 146 | status = acpi_ns_get_node_by_path(path, prefix_node, |
163 | ACPI_NS_NO_UPSEARCH, &node); | 147 | ACPI_NS_NO_UPSEARCH, &node); |
164 | if (ACPI_FAILURE (status)) { | 148 | if (ACPI_FAILURE(status)) { |
165 | acpi_os_printf ("report_method_error: Could not get node\n"); | 149 | acpi_os_printf |
150 | ("report_method_error: Could not get node\n"); | ||
166 | return; | 151 | return; |
167 | } | 152 | } |
168 | } | 153 | } |
169 | 154 | ||
170 | acpi_os_printf ("%8s-%04d: *** Error: ", module_name, line_number); | 155 | acpi_os_printf("%8s-%04d: *** Error: ", module_name, line_number); |
171 | acpi_ns_print_node_pathname (node, message); | 156 | acpi_ns_print_node_pathname(node, message); |
172 | acpi_os_printf (", %s\n", acpi_format_exception (method_status)); | 157 | acpi_os_printf(", %s\n", acpi_format_exception(method_status)); |
173 | } | 158 | } |
174 | 159 | ||
175 | |||
176 | /******************************************************************************* | 160 | /******************************************************************************* |
177 | * | 161 | * |
178 | * FUNCTION: acpi_ns_print_node_pathname | 162 | * FUNCTION: acpi_ns_print_node_pathname |
@@ -186,16 +170,13 @@ acpi_ns_report_method_error ( | |||
186 | ******************************************************************************/ | 170 | ******************************************************************************/ |
187 | 171 | ||
188 | void | 172 | void |
189 | acpi_ns_print_node_pathname ( | 173 | acpi_ns_print_node_pathname(struct acpi_namespace_node *node, char *message) |
190 | struct acpi_namespace_node *node, | ||
191 | char *message) | ||
192 | { | 174 | { |
193 | struct acpi_buffer buffer; | 175 | struct acpi_buffer buffer; |
194 | acpi_status status; | 176 | acpi_status status; |
195 | |||
196 | 177 | ||
197 | if (!node) { | 178 | if (!node) { |
198 | acpi_os_printf ("[NULL NAME]"); | 179 | acpi_os_printf("[NULL NAME]"); |
199 | return; | 180 | return; |
200 | } | 181 | } |
201 | 182 | ||
@@ -203,18 +184,17 @@ acpi_ns_print_node_pathname ( | |||
203 | 184 | ||
204 | buffer.length = ACPI_ALLOCATE_LOCAL_BUFFER; | 185 | buffer.length = ACPI_ALLOCATE_LOCAL_BUFFER; |
205 | 186 | ||
206 | status = acpi_ns_handle_to_pathname (node, &buffer); | 187 | status = acpi_ns_handle_to_pathname(node, &buffer); |
207 | if (ACPI_SUCCESS (status)) { | 188 | if (ACPI_SUCCESS(status)) { |
208 | if (message) { | 189 | if (message) { |
209 | acpi_os_printf ("%s ", message); | 190 | acpi_os_printf("%s ", message); |
210 | } | 191 | } |
211 | 192 | ||
212 | acpi_os_printf ("[%s] (Node %p)", (char *) buffer.pointer, node); | 193 | acpi_os_printf("[%s] (Node %p)", (char *)buffer.pointer, node); |
213 | ACPI_MEM_FREE (buffer.pointer); | 194 | ACPI_MEM_FREE(buffer.pointer); |
214 | } | 195 | } |
215 | } | 196 | } |
216 | 197 | ||
217 | |||
218 | /******************************************************************************* | 198 | /******************************************************************************* |
219 | * | 199 | * |
220 | * FUNCTION: acpi_ns_valid_root_prefix | 200 | * FUNCTION: acpi_ns_valid_root_prefix |
@@ -227,15 +207,12 @@ acpi_ns_print_node_pathname ( | |||
227 | * | 207 | * |
228 | ******************************************************************************/ | 208 | ******************************************************************************/ |
229 | 209 | ||
230 | u8 | 210 | u8 acpi_ns_valid_root_prefix(char prefix) |
231 | acpi_ns_valid_root_prefix ( | ||
232 | char prefix) | ||
233 | { | 211 | { |
234 | 212 | ||
235 | return ((u8) (prefix == '\\')); | 213 | return ((u8) (prefix == '\\')); |
236 | } | 214 | } |
237 | 215 | ||
238 | |||
239 | /******************************************************************************* | 216 | /******************************************************************************* |
240 | * | 217 | * |
241 | * FUNCTION: acpi_ns_valid_path_separator | 218 | * FUNCTION: acpi_ns_valid_path_separator |
@@ -248,15 +225,12 @@ acpi_ns_valid_root_prefix ( | |||
248 | * | 225 | * |
249 | ******************************************************************************/ | 226 | ******************************************************************************/ |
250 | 227 | ||
251 | static u8 | 228 | static u8 acpi_ns_valid_path_separator(char sep) |
252 | acpi_ns_valid_path_separator ( | ||
253 | char sep) | ||
254 | { | 229 | { |
255 | 230 | ||
256 | return ((u8) (sep == '.')); | 231 | return ((u8) (sep == '.')); |
257 | } | 232 | } |
258 | 233 | ||
259 | |||
260 | /******************************************************************************* | 234 | /******************************************************************************* |
261 | * | 235 | * |
262 | * FUNCTION: acpi_ns_get_type | 236 | * FUNCTION: acpi_ns_get_type |
@@ -269,22 +243,18 @@ acpi_ns_valid_path_separator ( | |||
269 | * | 243 | * |
270 | ******************************************************************************/ | 244 | ******************************************************************************/ |
271 | 245 | ||
272 | acpi_object_type | 246 | acpi_object_type acpi_ns_get_type(struct acpi_namespace_node * node) |
273 | acpi_ns_get_type ( | ||
274 | struct acpi_namespace_node *node) | ||
275 | { | 247 | { |
276 | ACPI_FUNCTION_TRACE ("ns_get_type"); | 248 | ACPI_FUNCTION_TRACE("ns_get_type"); |
277 | |||
278 | 249 | ||
279 | if (!node) { | 250 | if (!node) { |
280 | ACPI_REPORT_WARNING (("ns_get_type: Null Node input pointer\n")); | 251 | ACPI_REPORT_WARNING(("ns_get_type: Null Node input pointer\n")); |
281 | return_VALUE (ACPI_TYPE_ANY); | 252 | return_VALUE(ACPI_TYPE_ANY); |
282 | } | 253 | } |
283 | 254 | ||
284 | return_VALUE ((acpi_object_type) node->type); | 255 | return_VALUE((acpi_object_type) node->type); |
285 | } | 256 | } |
286 | 257 | ||
287 | |||
288 | /******************************************************************************* | 258 | /******************************************************************************* |
289 | * | 259 | * |
290 | * FUNCTION: acpi_ns_local | 260 | * FUNCTION: acpi_ns_local |
@@ -298,24 +268,20 @@ acpi_ns_get_type ( | |||
298 | * | 268 | * |
299 | ******************************************************************************/ | 269 | ******************************************************************************/ |
300 | 270 | ||
301 | u32 | 271 | u32 acpi_ns_local(acpi_object_type type) |
302 | acpi_ns_local ( | ||
303 | acpi_object_type type) | ||
304 | { | 272 | { |
305 | ACPI_FUNCTION_TRACE ("ns_local"); | 273 | ACPI_FUNCTION_TRACE("ns_local"); |
306 | |||
307 | 274 | ||
308 | if (!acpi_ut_valid_object_type (type)) { | 275 | if (!acpi_ut_valid_object_type(type)) { |
309 | /* Type code out of range */ | 276 | /* Type code out of range */ |
310 | 277 | ||
311 | ACPI_REPORT_WARNING (("ns_local: Invalid Object Type\n")); | 278 | ACPI_REPORT_WARNING(("ns_local: Invalid Object Type\n")); |
312 | return_VALUE (ACPI_NS_NORMAL); | 279 | return_VALUE(ACPI_NS_NORMAL); |
313 | } | 280 | } |
314 | 281 | ||
315 | return_VALUE ((u32) acpi_gbl_ns_properties[type] & ACPI_NS_LOCAL); | 282 | return_VALUE((u32) acpi_gbl_ns_properties[type] & ACPI_NS_LOCAL); |
316 | } | 283 | } |
317 | 284 | ||
318 | |||
319 | /******************************************************************************* | 285 | /******************************************************************************* |
320 | * | 286 | * |
321 | * FUNCTION: acpi_ns_get_internal_name_length | 287 | * FUNCTION: acpi_ns_get_internal_name_length |
@@ -330,16 +296,12 @@ acpi_ns_local ( | |||
330 | * | 296 | * |
331 | ******************************************************************************/ | 297 | ******************************************************************************/ |
332 | 298 | ||
333 | void | 299 | void acpi_ns_get_internal_name_length(struct acpi_namestring_info *info) |
334 | acpi_ns_get_internal_name_length ( | ||
335 | struct acpi_namestring_info *info) | ||
336 | { | 300 | { |
337 | char *next_external_char; | 301 | char *next_external_char; |
338 | u32 i; | 302 | u32 i; |
339 | |||
340 | |||
341 | ACPI_FUNCTION_ENTRY (); | ||
342 | 303 | ||
304 | ACPI_FUNCTION_ENTRY(); | ||
343 | 305 | ||
344 | next_external_char = info->external_name; | 306 | next_external_char = info->external_name; |
345 | info->num_carats = 0; | 307 | info->num_carats = 0; |
@@ -353,11 +315,10 @@ acpi_ns_get_internal_name_length ( | |||
353 | * | 315 | * |
354 | * strlen() + 1 covers the first name_seg, which has no path separator | 316 | * strlen() + 1 covers the first name_seg, which has no path separator |
355 | */ | 317 | */ |
356 | if (acpi_ns_valid_root_prefix (next_external_char[0])) { | 318 | if (acpi_ns_valid_root_prefix(next_external_char[0])) { |
357 | info->fully_qualified = TRUE; | 319 | info->fully_qualified = TRUE; |
358 | next_external_char++; | 320 | next_external_char++; |
359 | } | 321 | } else { |
360 | else { | ||
361 | /* | 322 | /* |
362 | * Handle Carat prefixes | 323 | * Handle Carat prefixes |
363 | */ | 324 | */ |
@@ -375,19 +336,18 @@ acpi_ns_get_internal_name_length ( | |||
375 | if (*next_external_char) { | 336 | if (*next_external_char) { |
376 | info->num_segments = 1; | 337 | info->num_segments = 1; |
377 | for (i = 0; next_external_char[i]; i++) { | 338 | for (i = 0; next_external_char[i]; i++) { |
378 | if (acpi_ns_valid_path_separator (next_external_char[i])) { | 339 | if (acpi_ns_valid_path_separator(next_external_char[i])) { |
379 | info->num_segments++; | 340 | info->num_segments++; |
380 | } | 341 | } |
381 | } | 342 | } |
382 | } | 343 | } |
383 | 344 | ||
384 | info->length = (ACPI_NAME_SIZE * info->num_segments) + | 345 | info->length = (ACPI_NAME_SIZE * info->num_segments) + |
385 | 4 + info->num_carats; | 346 | 4 + info->num_carats; |
386 | 347 | ||
387 | info->next_external_char = next_external_char; | 348 | info->next_external_char = next_external_char; |
388 | } | 349 | } |
389 | 350 | ||
390 | |||
391 | /******************************************************************************* | 351 | /******************************************************************************* |
392 | * | 352 | * |
393 | * FUNCTION: acpi_ns_build_internal_name | 353 | * FUNCTION: acpi_ns_build_internal_name |
@@ -401,19 +361,15 @@ acpi_ns_get_internal_name_length ( | |||
401 | * | 361 | * |
402 | ******************************************************************************/ | 362 | ******************************************************************************/ |
403 | 363 | ||
404 | acpi_status | 364 | acpi_status acpi_ns_build_internal_name(struct acpi_namestring_info *info) |
405 | acpi_ns_build_internal_name ( | ||
406 | struct acpi_namestring_info *info) | ||
407 | { | 365 | { |
408 | u32 num_segments = info->num_segments; | 366 | u32 num_segments = info->num_segments; |
409 | char *internal_name = info->internal_name; | 367 | char *internal_name = info->internal_name; |
410 | char *external_name = info->next_external_char; | 368 | char *external_name = info->next_external_char; |
411 | char *result = NULL; | 369 | char *result = NULL; |
412 | acpi_native_uint i; | 370 | acpi_native_uint i; |
413 | |||
414 | |||
415 | ACPI_FUNCTION_TRACE ("ns_build_internal_name"); | ||
416 | 371 | ||
372 | ACPI_FUNCTION_TRACE("ns_build_internal_name"); | ||
417 | 373 | ||
418 | /* Setup the correct prefixes, counts, and pointers */ | 374 | /* Setup the correct prefixes, counts, and pointers */ |
419 | 375 | ||
@@ -422,18 +378,15 @@ acpi_ns_build_internal_name ( | |||
422 | 378 | ||
423 | if (num_segments <= 1) { | 379 | if (num_segments <= 1) { |
424 | result = &internal_name[1]; | 380 | result = &internal_name[1]; |
425 | } | 381 | } else if (num_segments == 2) { |
426 | else if (num_segments == 2) { | ||
427 | internal_name[1] = AML_DUAL_NAME_PREFIX; | 382 | internal_name[1] = AML_DUAL_NAME_PREFIX; |
428 | result = &internal_name[2]; | 383 | result = &internal_name[2]; |
429 | } | 384 | } else { |
430 | else { | ||
431 | internal_name[1] = AML_MULTI_NAME_PREFIX_OP; | 385 | internal_name[1] = AML_MULTI_NAME_PREFIX_OP; |
432 | internal_name[2] = (char) num_segments; | 386 | internal_name[2] = (char)num_segments; |
433 | result = &internal_name[3]; | 387 | result = &internal_name[3]; |
434 | } | 388 | } |
435 | } | 389 | } else { |
436 | else { | ||
437 | /* | 390 | /* |
438 | * Not fully qualified. | 391 | * Not fully qualified. |
439 | * Handle Carats first, then append the name segments | 392 | * Handle Carats first, then append the name segments |
@@ -447,15 +400,14 @@ acpi_ns_build_internal_name ( | |||
447 | 400 | ||
448 | if (num_segments <= 1) { | 401 | if (num_segments <= 1) { |
449 | result = &internal_name[i]; | 402 | result = &internal_name[i]; |
450 | } | 403 | } else if (num_segments == 2) { |
451 | else if (num_segments == 2) { | ||
452 | internal_name[i] = AML_DUAL_NAME_PREFIX; | 404 | internal_name[i] = AML_DUAL_NAME_PREFIX; |
453 | result = &internal_name[(acpi_native_uint) (i+1)]; | 405 | result = &internal_name[(acpi_native_uint) (i + 1)]; |
454 | } | 406 | } else { |
455 | else { | ||
456 | internal_name[i] = AML_MULTI_NAME_PREFIX_OP; | 407 | internal_name[i] = AML_MULTI_NAME_PREFIX_OP; |
457 | internal_name[(acpi_native_uint) (i+1)] = (char) num_segments; | 408 | internal_name[(acpi_native_uint) (i + 1)] = |
458 | result = &internal_name[(acpi_native_uint) (i+2)]; | 409 | (char)num_segments; |
410 | result = &internal_name[(acpi_native_uint) (i + 2)]; | ||
459 | } | 411 | } |
460 | } | 412 | } |
461 | 413 | ||
@@ -463,25 +415,25 @@ acpi_ns_build_internal_name ( | |||
463 | 415 | ||
464 | for (; num_segments; num_segments--) { | 416 | for (; num_segments; num_segments--) { |
465 | for (i = 0; i < ACPI_NAME_SIZE; i++) { | 417 | for (i = 0; i < ACPI_NAME_SIZE; i++) { |
466 | if (acpi_ns_valid_path_separator (*external_name) || | 418 | if (acpi_ns_valid_path_separator(*external_name) || |
467 | (*external_name == 0)) { | 419 | (*external_name == 0)) { |
468 | /* Pad the segment with underscore(s) if segment is short */ | 420 | /* Pad the segment with underscore(s) if segment is short */ |
469 | 421 | ||
470 | result[i] = '_'; | 422 | result[i] = '_'; |
471 | } | 423 | } else { |
472 | else { | ||
473 | /* Convert the character to uppercase and save it */ | 424 | /* Convert the character to uppercase and save it */ |
474 | 425 | ||
475 | result[i] = (char) ACPI_TOUPPER ((int) *external_name); | 426 | result[i] = |
427 | (char)ACPI_TOUPPER((int)*external_name); | ||
476 | external_name++; | 428 | external_name++; |
477 | } | 429 | } |
478 | } | 430 | } |
479 | 431 | ||
480 | /* Now we must have a path separator, or the pathname is bad */ | 432 | /* Now we must have a path separator, or the pathname is bad */ |
481 | 433 | ||
482 | if (!acpi_ns_valid_path_separator (*external_name) && | 434 | if (!acpi_ns_valid_path_separator(*external_name) && |
483 | (*external_name != 0)) { | 435 | (*external_name != 0)) { |
484 | return_ACPI_STATUS (AE_BAD_PARAMETER); | 436 | return_ACPI_STATUS(AE_BAD_PARAMETER); |
485 | } | 437 | } |
486 | 438 | ||
487 | /* Move on the next segment */ | 439 | /* Move on the next segment */ |
@@ -495,18 +447,17 @@ acpi_ns_build_internal_name ( | |||
495 | *result = 0; | 447 | *result = 0; |
496 | 448 | ||
497 | if (info->fully_qualified) { | 449 | if (info->fully_qualified) { |
498 | ACPI_DEBUG_PRINT ((ACPI_DB_EXEC, "Returning [%p] (abs) \"\\%s\"\n", | 450 | ACPI_DEBUG_PRINT((ACPI_DB_EXEC, |
499 | internal_name, internal_name)); | 451 | "Returning [%p] (abs) \"\\%s\"\n", |
500 | } | 452 | internal_name, internal_name)); |
501 | else { | 453 | } else { |
502 | ACPI_DEBUG_PRINT ((ACPI_DB_EXEC, "Returning [%p] (rel) \"%s\"\n", | 454 | ACPI_DEBUG_PRINT((ACPI_DB_EXEC, "Returning [%p] (rel) \"%s\"\n", |
503 | internal_name, internal_name)); | 455 | internal_name, internal_name)); |
504 | } | 456 | } |
505 | 457 | ||
506 | return_ACPI_STATUS (AE_OK); | 458 | return_ACPI_STATUS(AE_OK); |
507 | } | 459 | } |
508 | 460 | ||
509 | |||
510 | /******************************************************************************* | 461 | /******************************************************************************* |
511 | * | 462 | * |
512 | * FUNCTION: acpi_ns_internalize_name | 463 | * FUNCTION: acpi_ns_internalize_name |
@@ -522,51 +473,43 @@ acpi_ns_build_internal_name ( | |||
522 | * | 473 | * |
523 | *******************************************************************************/ | 474 | *******************************************************************************/ |
524 | 475 | ||
525 | acpi_status | 476 | acpi_status acpi_ns_internalize_name(char *external_name, char **converted_name) |
526 | acpi_ns_internalize_name ( | ||
527 | char *external_name, | ||
528 | char **converted_name) | ||
529 | { | 477 | { |
530 | char *internal_name; | 478 | char *internal_name; |
531 | struct acpi_namestring_info info; | 479 | struct acpi_namestring_info info; |
532 | acpi_status status; | 480 | acpi_status status; |
533 | |||
534 | |||
535 | ACPI_FUNCTION_TRACE ("ns_internalize_name"); | ||
536 | 481 | ||
482 | ACPI_FUNCTION_TRACE("ns_internalize_name"); | ||
537 | 483 | ||
538 | if ((!external_name) || | 484 | if ((!external_name) || (*external_name == 0) || (!converted_name)) { |
539 | (*external_name == 0) || | 485 | return_ACPI_STATUS(AE_BAD_PARAMETER); |
540 | (!converted_name)) { | ||
541 | return_ACPI_STATUS (AE_BAD_PARAMETER); | ||
542 | } | 486 | } |
543 | 487 | ||
544 | /* Get the length of the new internal name */ | 488 | /* Get the length of the new internal name */ |
545 | 489 | ||
546 | info.external_name = external_name; | 490 | info.external_name = external_name; |
547 | acpi_ns_get_internal_name_length (&info); | 491 | acpi_ns_get_internal_name_length(&info); |
548 | 492 | ||
549 | /* We need a segment to store the internal name */ | 493 | /* We need a segment to store the internal name */ |
550 | 494 | ||
551 | internal_name = ACPI_MEM_CALLOCATE (info.length); | 495 | internal_name = ACPI_MEM_CALLOCATE(info.length); |
552 | if (!internal_name) { | 496 | if (!internal_name) { |
553 | return_ACPI_STATUS (AE_NO_MEMORY); | 497 | return_ACPI_STATUS(AE_NO_MEMORY); |
554 | } | 498 | } |
555 | 499 | ||
556 | /* Build the name */ | 500 | /* Build the name */ |
557 | 501 | ||
558 | info.internal_name = internal_name; | 502 | info.internal_name = internal_name; |
559 | status = acpi_ns_build_internal_name (&info); | 503 | status = acpi_ns_build_internal_name(&info); |
560 | if (ACPI_FAILURE (status)) { | 504 | if (ACPI_FAILURE(status)) { |
561 | ACPI_MEM_FREE (internal_name); | 505 | ACPI_MEM_FREE(internal_name); |
562 | return_ACPI_STATUS (status); | 506 | return_ACPI_STATUS(status); |
563 | } | 507 | } |
564 | 508 | ||
565 | *converted_name = internal_name; | 509 | *converted_name = internal_name; |
566 | return_ACPI_STATUS (AE_OK); | 510 | return_ACPI_STATUS(AE_OK); |
567 | } | 511 | } |
568 | 512 | ||
569 | |||
570 | /******************************************************************************* | 513 | /******************************************************************************* |
571 | * | 514 | * |
572 | * FUNCTION: acpi_ns_externalize_name | 515 | * FUNCTION: acpi_ns_externalize_name |
@@ -585,27 +528,21 @@ acpi_ns_internalize_name ( | |||
585 | ******************************************************************************/ | 528 | ******************************************************************************/ |
586 | 529 | ||
587 | acpi_status | 530 | acpi_status |
588 | acpi_ns_externalize_name ( | 531 | acpi_ns_externalize_name(u32 internal_name_length, |
589 | u32 internal_name_length, | 532 | char *internal_name, |
590 | char *internal_name, | 533 | u32 * converted_name_length, char **converted_name) |
591 | u32 *converted_name_length, | ||
592 | char **converted_name) | ||
593 | { | 534 | { |
594 | acpi_native_uint names_index = 0; | 535 | acpi_native_uint names_index = 0; |
595 | acpi_native_uint num_segments = 0; | 536 | acpi_native_uint num_segments = 0; |
596 | acpi_native_uint required_length; | 537 | acpi_native_uint required_length; |
597 | acpi_native_uint prefix_length = 0; | 538 | acpi_native_uint prefix_length = 0; |
598 | acpi_native_uint i = 0; | 539 | acpi_native_uint i = 0; |
599 | acpi_native_uint j = 0; | 540 | acpi_native_uint j = 0; |
600 | |||
601 | 541 | ||
602 | ACPI_FUNCTION_TRACE ("ns_externalize_name"); | 542 | ACPI_FUNCTION_TRACE("ns_externalize_name"); |
603 | 543 | ||
604 | 544 | if (!internal_name_length || !internal_name || !converted_name) { | |
605 | if (!internal_name_length || | 545 | return_ACPI_STATUS(AE_BAD_PARAMETER); |
606 | !internal_name || | ||
607 | !converted_name) { | ||
608 | return_ACPI_STATUS (AE_BAD_PARAMETER); | ||
609 | } | 546 | } |
610 | 547 | ||
611 | /* | 548 | /* |
@@ -620,8 +557,7 @@ acpi_ns_externalize_name ( | |||
620 | for (i = 0; i < internal_name_length; i++) { | 557 | for (i = 0; i < internal_name_length; i++) { |
621 | if (internal_name[i] == '^') { | 558 | if (internal_name[i] == '^') { |
622 | prefix_length = i + 1; | 559 | prefix_length = i + 1; |
623 | } | 560 | } else { |
624 | else { | ||
625 | break; | 561 | break; |
626 | } | 562 | } |
627 | } | 563 | } |
@@ -648,7 +584,8 @@ acpi_ns_externalize_name ( | |||
648 | 584 | ||
649 | names_index = prefix_length + 2; | 585 | names_index = prefix_length + 2; |
650 | num_segments = (acpi_native_uint) (u8) | 586 | num_segments = (acpi_native_uint) (u8) |
651 | internal_name[(acpi_native_uint) (prefix_length + 1)]; | 587 | internal_name[(acpi_native_uint) |
588 | (prefix_length + 1)]; | ||
652 | break; | 589 | break; |
653 | 590 | ||
654 | case AML_DUAL_NAME_PREFIX: | 591 | case AML_DUAL_NAME_PREFIX: |
@@ -683,23 +620,23 @@ acpi_ns_externalize_name ( | |||
683 | * punctuation ('.') between object names, plus the NULL terminator. | 620 | * punctuation ('.') between object names, plus the NULL terminator. |
684 | */ | 621 | */ |
685 | required_length = prefix_length + (4 * num_segments) + | 622 | required_length = prefix_length + (4 * num_segments) + |
686 | ((num_segments > 0) ? (num_segments - 1) : 0) + 1; | 623 | ((num_segments > 0) ? (num_segments - 1) : 0) + 1; |
687 | 624 | ||
688 | /* | 625 | /* |
689 | * Check to see if we're still in bounds. If not, there's a problem | 626 | * Check to see if we're still in bounds. If not, there's a problem |
690 | * with internal_name (invalid format). | 627 | * with internal_name (invalid format). |
691 | */ | 628 | */ |
692 | if (required_length > internal_name_length) { | 629 | if (required_length > internal_name_length) { |
693 | ACPI_REPORT_ERROR (("ns_externalize_name: Invalid internal name\n")); | 630 | ACPI_REPORT_ERROR(("ns_externalize_name: Invalid internal name\n")); |
694 | return_ACPI_STATUS (AE_BAD_PATHNAME); | 631 | return_ACPI_STATUS(AE_BAD_PATHNAME); |
695 | } | 632 | } |
696 | 633 | ||
697 | /* | 634 | /* |
698 | * Build converted_name | 635 | * Build converted_name |
699 | */ | 636 | */ |
700 | *converted_name = ACPI_MEM_CALLOCATE (required_length); | 637 | *converted_name = ACPI_MEM_CALLOCATE(required_length); |
701 | if (!(*converted_name)) { | 638 | if (!(*converted_name)) { |
702 | return_ACPI_STATUS (AE_NO_MEMORY); | 639 | return_ACPI_STATUS(AE_NO_MEMORY); |
703 | } | 640 | } |
704 | 641 | ||
705 | j = 0; | 642 | j = 0; |
@@ -725,10 +662,9 @@ acpi_ns_externalize_name ( | |||
725 | *converted_name_length = (u32) required_length; | 662 | *converted_name_length = (u32) required_length; |
726 | } | 663 | } |
727 | 664 | ||
728 | return_ACPI_STATUS (AE_OK); | 665 | return_ACPI_STATUS(AE_OK); |
729 | } | 666 | } |
730 | 667 | ||
731 | |||
732 | /******************************************************************************* | 668 | /******************************************************************************* |
733 | * | 669 | * |
734 | * FUNCTION: acpi_ns_map_handle_to_node | 670 | * FUNCTION: acpi_ns_map_handle_to_node |
@@ -745,13 +681,10 @@ acpi_ns_externalize_name ( | |||
745 | * | 681 | * |
746 | ******************************************************************************/ | 682 | ******************************************************************************/ |
747 | 683 | ||
748 | struct acpi_namespace_node * | 684 | struct acpi_namespace_node *acpi_ns_map_handle_to_node(acpi_handle handle) |
749 | acpi_ns_map_handle_to_node ( | ||
750 | acpi_handle handle) | ||
751 | { | 685 | { |
752 | 686 | ||
753 | ACPI_FUNCTION_ENTRY (); | 687 | ACPI_FUNCTION_ENTRY(); |
754 | |||
755 | 688 | ||
756 | /* | 689 | /* |
757 | * Simple implementation. | 690 | * Simple implementation. |
@@ -766,14 +699,13 @@ acpi_ns_map_handle_to_node ( | |||
766 | 699 | ||
767 | /* We can at least attempt to verify the handle */ | 700 | /* We can at least attempt to verify the handle */ |
768 | 701 | ||
769 | if (ACPI_GET_DESCRIPTOR_TYPE (handle) != ACPI_DESC_TYPE_NAMED) { | 702 | if (ACPI_GET_DESCRIPTOR_TYPE(handle) != ACPI_DESC_TYPE_NAMED) { |
770 | return (NULL); | 703 | return (NULL); |
771 | } | 704 | } |
772 | 705 | ||
773 | return ((struct acpi_namespace_node *) handle); | 706 | return ((struct acpi_namespace_node *)handle); |
774 | } | 707 | } |
775 | 708 | ||
776 | |||
777 | /******************************************************************************* | 709 | /******************************************************************************* |
778 | * | 710 | * |
779 | * FUNCTION: acpi_ns_convert_entry_to_handle | 711 | * FUNCTION: acpi_ns_convert_entry_to_handle |
@@ -786,18 +718,14 @@ acpi_ns_map_handle_to_node ( | |||
786 | * | 718 | * |
787 | ******************************************************************************/ | 719 | ******************************************************************************/ |
788 | 720 | ||
789 | acpi_handle | 721 | acpi_handle acpi_ns_convert_entry_to_handle(struct acpi_namespace_node *node) |
790 | acpi_ns_convert_entry_to_handle ( | ||
791 | struct acpi_namespace_node *node) | ||
792 | { | 722 | { |
793 | 723 | ||
794 | |||
795 | /* | 724 | /* |
796 | * Simple implementation for now; | 725 | * Simple implementation for now; |
797 | */ | 726 | */ |
798 | return ((acpi_handle) node); | 727 | return ((acpi_handle) node); |
799 | 728 | ||
800 | |||
801 | /* Example future implementation --------------------- | 729 | /* Example future implementation --------------------- |
802 | 730 | ||
803 | if (!Node) | 731 | if (!Node) |
@@ -810,12 +738,10 @@ acpi_ns_convert_entry_to_handle ( | |||
810 | return (ACPI_ROOT_OBJECT); | 738 | return (ACPI_ROOT_OBJECT); |
811 | } | 739 | } |
812 | 740 | ||
813 | |||
814 | return ((acpi_handle) Node); | 741 | return ((acpi_handle) Node); |
815 | ------------------------------------------------------*/ | 742 | ------------------------------------------------------*/ |
816 | } | 743 | } |
817 | 744 | ||
818 | |||
819 | /******************************************************************************* | 745 | /******************************************************************************* |
820 | * | 746 | * |
821 | * FUNCTION: acpi_ns_terminate | 747 | * FUNCTION: acpi_ns_terminate |
@@ -828,42 +754,37 @@ acpi_ns_convert_entry_to_handle ( | |||
828 | * | 754 | * |
829 | ******************************************************************************/ | 755 | ******************************************************************************/ |
830 | 756 | ||
831 | void | 757 | void acpi_ns_terminate(void) |
832 | acpi_ns_terminate ( | ||
833 | void) | ||
834 | { | 758 | { |
835 | union acpi_operand_object *obj_desc; | 759 | union acpi_operand_object *obj_desc; |
836 | |||
837 | |||
838 | ACPI_FUNCTION_TRACE ("ns_terminate"); | ||
839 | 760 | ||
761 | ACPI_FUNCTION_TRACE("ns_terminate"); | ||
840 | 762 | ||
841 | /* | 763 | /* |
842 | * 1) Free the entire namespace -- all nodes and objects | 764 | * 1) Free the entire namespace -- all nodes and objects |
843 | * | 765 | * |
844 | * Delete all object descriptors attached to namepsace nodes | 766 | * Delete all object descriptors attached to namepsace nodes |
845 | */ | 767 | */ |
846 | acpi_ns_delete_namespace_subtree (acpi_gbl_root_node); | 768 | acpi_ns_delete_namespace_subtree(acpi_gbl_root_node); |
847 | 769 | ||
848 | /* Detach any objects attached to the root */ | 770 | /* Detach any objects attached to the root */ |
849 | 771 | ||
850 | obj_desc = acpi_ns_get_attached_object (acpi_gbl_root_node); | 772 | obj_desc = acpi_ns_get_attached_object(acpi_gbl_root_node); |
851 | if (obj_desc) { | 773 | if (obj_desc) { |
852 | acpi_ns_detach_object (acpi_gbl_root_node); | 774 | acpi_ns_detach_object(acpi_gbl_root_node); |
853 | } | 775 | } |
854 | 776 | ||
855 | ACPI_DEBUG_PRINT ((ACPI_DB_INFO, "Namespace freed\n")); | 777 | ACPI_DEBUG_PRINT((ACPI_DB_INFO, "Namespace freed\n")); |
856 | 778 | ||
857 | /* | 779 | /* |
858 | * 2) Now we can delete the ACPI tables | 780 | * 2) Now we can delete the ACPI tables |
859 | */ | 781 | */ |
860 | acpi_tb_delete_all_tables (); | 782 | acpi_tb_delete_all_tables(); |
861 | ACPI_DEBUG_PRINT ((ACPI_DB_INFO, "ACPI Tables freed\n")); | 783 | ACPI_DEBUG_PRINT((ACPI_DB_INFO, "ACPI Tables freed\n")); |
862 | 784 | ||
863 | return_VOID; | 785 | return_VOID; |
864 | } | 786 | } |
865 | 787 | ||
866 | |||
867 | /******************************************************************************* | 788 | /******************************************************************************* |
868 | * | 789 | * |
869 | * FUNCTION: acpi_ns_opens_scope | 790 | * FUNCTION: acpi_ns_opens_scope |
@@ -875,24 +796,21 @@ acpi_ns_terminate ( | |||
875 | * | 796 | * |
876 | ******************************************************************************/ | 797 | ******************************************************************************/ |
877 | 798 | ||
878 | u32 | 799 | u32 acpi_ns_opens_scope(acpi_object_type type) |
879 | acpi_ns_opens_scope ( | ||
880 | acpi_object_type type) | ||
881 | { | 800 | { |
882 | ACPI_FUNCTION_TRACE_STR ("ns_opens_scope", acpi_ut_get_type_name (type)); | 801 | ACPI_FUNCTION_TRACE_STR("ns_opens_scope", acpi_ut_get_type_name(type)); |
883 | |||
884 | 802 | ||
885 | if (!acpi_ut_valid_object_type (type)) { | 803 | if (!acpi_ut_valid_object_type(type)) { |
886 | /* type code out of range */ | 804 | /* type code out of range */ |
887 | 805 | ||
888 | ACPI_REPORT_WARNING (("ns_opens_scope: Invalid Object Type %X\n", type)); | 806 | ACPI_REPORT_WARNING(("ns_opens_scope: Invalid Object Type %X\n", |
889 | return_VALUE (ACPI_NS_NORMAL); | 807 | type)); |
808 | return_VALUE(ACPI_NS_NORMAL); | ||
890 | } | 809 | } |
891 | 810 | ||
892 | return_VALUE (((u32) acpi_gbl_ns_properties[type]) & ACPI_NS_NEWSCOPE); | 811 | return_VALUE(((u32) acpi_gbl_ns_properties[type]) & ACPI_NS_NEWSCOPE); |
893 | } | 812 | } |
894 | 813 | ||
895 | |||
896 | /******************************************************************************* | 814 | /******************************************************************************* |
897 | * | 815 | * |
898 | * FUNCTION: acpi_ns_get_node_by_path | 816 | * FUNCTION: acpi_ns_get_node_by_path |
@@ -916,33 +834,29 @@ acpi_ns_opens_scope ( | |||
916 | ******************************************************************************/ | 834 | ******************************************************************************/ |
917 | 835 | ||
918 | acpi_status | 836 | acpi_status |
919 | acpi_ns_get_node_by_path ( | 837 | acpi_ns_get_node_by_path(char *pathname, |
920 | char *pathname, | 838 | struct acpi_namespace_node *start_node, |
921 | struct acpi_namespace_node *start_node, | 839 | u32 flags, struct acpi_namespace_node **return_node) |
922 | u32 flags, | ||
923 | struct acpi_namespace_node **return_node) | ||
924 | { | 840 | { |
925 | union acpi_generic_state scope_info; | 841 | union acpi_generic_state scope_info; |
926 | acpi_status status; | 842 | acpi_status status; |
927 | char *internal_path = NULL; | 843 | char *internal_path = NULL; |
928 | |||
929 | |||
930 | ACPI_FUNCTION_TRACE_PTR ("ns_get_node_by_path", pathname); | ||
931 | 844 | ||
845 | ACPI_FUNCTION_TRACE_PTR("ns_get_node_by_path", pathname); | ||
932 | 846 | ||
933 | if (pathname) { | 847 | if (pathname) { |
934 | /* Convert path to internal representation */ | 848 | /* Convert path to internal representation */ |
935 | 849 | ||
936 | status = acpi_ns_internalize_name (pathname, &internal_path); | 850 | status = acpi_ns_internalize_name(pathname, &internal_path); |
937 | if (ACPI_FAILURE (status)) { | 851 | if (ACPI_FAILURE(status)) { |
938 | return_ACPI_STATUS (status); | 852 | return_ACPI_STATUS(status); |
939 | } | 853 | } |
940 | } | 854 | } |
941 | 855 | ||
942 | /* Must lock namespace during lookup */ | 856 | /* Must lock namespace during lookup */ |
943 | 857 | ||
944 | status = acpi_ut_acquire_mutex (ACPI_MTX_NAMESPACE); | 858 | status = acpi_ut_acquire_mutex(ACPI_MTX_NAMESPACE); |
945 | if (ACPI_FAILURE (status)) { | 859 | if (ACPI_FAILURE(status)) { |
946 | goto cleanup; | 860 | goto cleanup; |
947 | } | 861 | } |
948 | 862 | ||
@@ -952,25 +866,25 @@ acpi_ns_get_node_by_path ( | |||
952 | 866 | ||
953 | /* Lookup the name in the namespace */ | 867 | /* Lookup the name in the namespace */ |
954 | 868 | ||
955 | status = acpi_ns_lookup (&scope_info, internal_path, | 869 | status = acpi_ns_lookup(&scope_info, internal_path, |
956 | ACPI_TYPE_ANY, ACPI_IMODE_EXECUTE, | 870 | ACPI_TYPE_ANY, ACPI_IMODE_EXECUTE, |
957 | (flags | ACPI_NS_DONT_OPEN_SCOPE), | 871 | (flags | ACPI_NS_DONT_OPEN_SCOPE), |
958 | NULL, return_node); | 872 | NULL, return_node); |
959 | if (ACPI_FAILURE (status)) { | 873 | if (ACPI_FAILURE(status)) { |
960 | ACPI_DEBUG_PRINT ((ACPI_DB_INFO, "%s, %s\n", | 874 | ACPI_DEBUG_PRINT((ACPI_DB_INFO, "%s, %s\n", |
961 | internal_path, acpi_format_exception (status))); | 875 | internal_path, |
876 | acpi_format_exception(status))); | ||
962 | } | 877 | } |
963 | 878 | ||
964 | (void) acpi_ut_release_mutex (ACPI_MTX_NAMESPACE); | 879 | (void)acpi_ut_release_mutex(ACPI_MTX_NAMESPACE); |
965 | 880 | ||
966 | cleanup: | 881 | cleanup: |
967 | if (internal_path) { | 882 | if (internal_path) { |
968 | ACPI_MEM_FREE (internal_path); | 883 | ACPI_MEM_FREE(internal_path); |
969 | } | 884 | } |
970 | return_ACPI_STATUS (status); | 885 | return_ACPI_STATUS(status); |
971 | } | 886 | } |
972 | 887 | ||
973 | |||
974 | /******************************************************************************* | 888 | /******************************************************************************* |
975 | * | 889 | * |
976 | * FUNCTION: acpi_ns_get_parent_node | 890 | * FUNCTION: acpi_ns_get_parent_node |
@@ -983,12 +897,10 @@ cleanup: | |||
983 | * | 897 | * |
984 | ******************************************************************************/ | 898 | ******************************************************************************/ |
985 | 899 | ||
986 | struct acpi_namespace_node * | 900 | struct acpi_namespace_node *acpi_ns_get_parent_node(struct acpi_namespace_node |
987 | acpi_ns_get_parent_node ( | 901 | *node) |
988 | struct acpi_namespace_node *node) | ||
989 | { | 902 | { |
990 | ACPI_FUNCTION_ENTRY (); | 903 | ACPI_FUNCTION_ENTRY(); |
991 | |||
992 | 904 | ||
993 | if (!node) { | 905 | if (!node) { |
994 | return (NULL); | 906 | return (NULL); |
@@ -1006,7 +918,6 @@ acpi_ns_get_parent_node ( | |||
1006 | return (node->peer); | 918 | return (node->peer); |
1007 | } | 919 | } |
1008 | 920 | ||
1009 | |||
1010 | /******************************************************************************* | 921 | /******************************************************************************* |
1011 | * | 922 | * |
1012 | * FUNCTION: acpi_ns_get_next_valid_node | 923 | * FUNCTION: acpi_ns_get_next_valid_node |
@@ -1021,9 +932,9 @@ acpi_ns_get_parent_node ( | |||
1021 | * | 932 | * |
1022 | ******************************************************************************/ | 933 | ******************************************************************************/ |
1023 | 934 | ||
1024 | struct acpi_namespace_node * | 935 | struct acpi_namespace_node *acpi_ns_get_next_valid_node(struct |
1025 | acpi_ns_get_next_valid_node ( | 936 | acpi_namespace_node |
1026 | struct acpi_namespace_node *node) | 937 | *node) |
1027 | { | 938 | { |
1028 | 939 | ||
1029 | /* If we are at the end of this peer list, return NULL */ | 940 | /* If we are at the end of this peer list, return NULL */ |
@@ -1037,7 +948,6 @@ acpi_ns_get_next_valid_node ( | |||
1037 | return (node->peer); | 948 | return (node->peer); |
1038 | } | 949 | } |
1039 | 950 | ||
1040 | |||
1041 | #ifdef ACPI_OBSOLETE_FUNCTIONS | 951 | #ifdef ACPI_OBSOLETE_FUNCTIONS |
1042 | /******************************************************************************* | 952 | /******************************************************************************* |
1043 | * | 953 | * |
@@ -1053,38 +963,36 @@ acpi_ns_get_next_valid_node ( | |||
1053 | * | 963 | * |
1054 | ******************************************************************************/ | 964 | ******************************************************************************/ |
1055 | 965 | ||
1056 | acpi_name | 966 | acpi_name acpi_ns_find_parent_name(struct acpi_namespace_node * child_node) |
1057 | acpi_ns_find_parent_name ( | ||
1058 | struct acpi_namespace_node *child_node) | ||
1059 | { | 967 | { |
1060 | struct acpi_namespace_node *parent_node; | 968 | struct acpi_namespace_node *parent_node; |
1061 | |||
1062 | |||
1063 | ACPI_FUNCTION_TRACE ("ns_find_parent_name"); | ||
1064 | 969 | ||
970 | ACPI_FUNCTION_TRACE("ns_find_parent_name"); | ||
1065 | 971 | ||
1066 | if (child_node) { | 972 | if (child_node) { |
1067 | /* Valid entry. Get the parent Node */ | 973 | /* Valid entry. Get the parent Node */ |
1068 | 974 | ||
1069 | parent_node = acpi_ns_get_parent_node (child_node); | 975 | parent_node = acpi_ns_get_parent_node(child_node); |
1070 | if (parent_node) { | 976 | if (parent_node) { |
1071 | ACPI_DEBUG_PRINT ((ACPI_DB_EXEC, | 977 | ACPI_DEBUG_PRINT((ACPI_DB_EXEC, |
1072 | "Parent of %p [%4.4s] is %p [%4.4s]\n", | 978 | "Parent of %p [%4.4s] is %p [%4.4s]\n", |
1073 | child_node, acpi_ut_get_node_name (child_node), | 979 | child_node, |
1074 | parent_node, acpi_ut_get_node_name (parent_node))); | 980 | acpi_ut_get_node_name(child_node), |
981 | parent_node, | ||
982 | acpi_ut_get_node_name(parent_node))); | ||
1075 | 983 | ||
1076 | if (parent_node->name.integer) { | 984 | if (parent_node->name.integer) { |
1077 | return_VALUE ((acpi_name) parent_node->name.integer); | 985 | return_VALUE((acpi_name) parent_node->name. |
986 | integer); | ||
1078 | } | 987 | } |
1079 | } | 988 | } |
1080 | 989 | ||
1081 | ACPI_DEBUG_PRINT ((ACPI_DB_EXEC, | 990 | ACPI_DEBUG_PRINT((ACPI_DB_EXEC, |
1082 | "Unable to find parent of %p (%4.4s)\n", | 991 | "Unable to find parent of %p (%4.4s)\n", |
1083 | child_node, acpi_ut_get_node_name (child_node))); | 992 | child_node, |
993 | acpi_ut_get_node_name(child_node))); | ||
1084 | } | 994 | } |
1085 | 995 | ||
1086 | return_VALUE (ACPI_UNKNOWN_NAME); | 996 | return_VALUE(ACPI_UNKNOWN_NAME); |
1087 | } | 997 | } |
1088 | #endif | 998 | #endif |
1089 | |||
1090 | |||
diff --git a/drivers/acpi/namespace/nswalk.c b/drivers/acpi/namespace/nswalk.c index f9a7277dca6e..5f164c0df33b 100644 --- a/drivers/acpi/namespace/nswalk.c +++ b/drivers/acpi/namespace/nswalk.c | |||
@@ -41,14 +41,11 @@ | |||
41 | * POSSIBILITY OF SUCH DAMAGES. | 41 | * POSSIBILITY OF SUCH DAMAGES. |
42 | */ | 42 | */ |
43 | 43 | ||
44 | |||
45 | #include <acpi/acpi.h> | 44 | #include <acpi/acpi.h> |
46 | #include <acpi/acnamesp.h> | 45 | #include <acpi/acnamesp.h> |
47 | 46 | ||
48 | |||
49 | #define _COMPONENT ACPI_NAMESPACE | 47 | #define _COMPONENT ACPI_NAMESPACE |
50 | ACPI_MODULE_NAME ("nswalk") | 48 | ACPI_MODULE_NAME("nswalk") |
51 | |||
52 | 49 | ||
53 | /******************************************************************************* | 50 | /******************************************************************************* |
54 | * | 51 | * |
@@ -68,18 +65,15 @@ | |||
68 | * within Scope is returned. | 65 | * within Scope is returned. |
69 | * | 66 | * |
70 | ******************************************************************************/ | 67 | ******************************************************************************/ |
71 | 68 | struct acpi_namespace_node *acpi_ns_get_next_node(acpi_object_type type, | |
72 | struct acpi_namespace_node * | 69 | struct acpi_namespace_node |
73 | acpi_ns_get_next_node ( | 70 | *parent_node, |
74 | acpi_object_type type, | 71 | struct acpi_namespace_node |
75 | struct acpi_namespace_node *parent_node, | 72 | *child_node) |
76 | struct acpi_namespace_node *child_node) | ||
77 | { | 73 | { |
78 | struct acpi_namespace_node *next_node = NULL; | 74 | struct acpi_namespace_node *next_node = NULL; |
79 | |||
80 | |||
81 | ACPI_FUNCTION_ENTRY (); | ||
82 | 75 | ||
76 | ACPI_FUNCTION_ENTRY(); | ||
83 | 77 | ||
84 | if (!child_node) { | 78 | if (!child_node) { |
85 | /* It's really the parent's _scope_ that we want */ | 79 | /* It's really the parent's _scope_ that we want */ |
@@ -92,7 +86,7 @@ acpi_ns_get_next_node ( | |||
92 | else { | 86 | else { |
93 | /* Start search at the NEXT node */ | 87 | /* Start search at the NEXT node */ |
94 | 88 | ||
95 | next_node = acpi_ns_get_next_valid_node (child_node); | 89 | next_node = acpi_ns_get_next_valid_node(child_node); |
96 | } | 90 | } |
97 | 91 | ||
98 | /* If any type is OK, we are done */ | 92 | /* If any type is OK, we are done */ |
@@ -114,7 +108,7 @@ acpi_ns_get_next_node ( | |||
114 | 108 | ||
115 | /* Otherwise, move on to the next node */ | 109 | /* Otherwise, move on to the next node */ |
116 | 110 | ||
117 | next_node = acpi_ns_get_next_valid_node (next_node); | 111 | next_node = acpi_ns_get_next_valid_node(next_node); |
118 | } | 112 | } |
119 | 113 | ||
120 | /* Not found */ | 114 | /* Not found */ |
@@ -122,7 +116,6 @@ acpi_ns_get_next_node ( | |||
122 | return (NULL); | 116 | return (NULL); |
123 | } | 117 | } |
124 | 118 | ||
125 | |||
126 | /******************************************************************************* | 119 | /******************************************************************************* |
127 | * | 120 | * |
128 | * FUNCTION: acpi_ns_walk_namespace | 121 | * FUNCTION: acpi_ns_walk_namespace |
@@ -154,25 +147,21 @@ acpi_ns_get_next_node ( | |||
154 | ******************************************************************************/ | 147 | ******************************************************************************/ |
155 | 148 | ||
156 | acpi_status | 149 | acpi_status |
157 | acpi_ns_walk_namespace ( | 150 | acpi_ns_walk_namespace(acpi_object_type type, |
158 | acpi_object_type type, | 151 | acpi_handle start_node, |
159 | acpi_handle start_node, | 152 | u32 max_depth, |
160 | u32 max_depth, | 153 | u8 unlock_before_callback, |
161 | u8 unlock_before_callback, | 154 | acpi_walk_callback user_function, |
162 | acpi_walk_callback user_function, | 155 | void *context, void **return_value) |
163 | void *context, | ||
164 | void **return_value) | ||
165 | { | 156 | { |
166 | acpi_status status; | 157 | acpi_status status; |
167 | acpi_status mutex_status; | 158 | acpi_status mutex_status; |
168 | struct acpi_namespace_node *child_node; | 159 | struct acpi_namespace_node *child_node; |
169 | struct acpi_namespace_node *parent_node; | 160 | struct acpi_namespace_node *parent_node; |
170 | acpi_object_type child_type; | 161 | acpi_object_type child_type; |
171 | u32 level; | 162 | u32 level; |
172 | |||
173 | |||
174 | ACPI_FUNCTION_TRACE ("ns_walk_namespace"); | ||
175 | 163 | ||
164 | ACPI_FUNCTION_TRACE("ns_walk_namespace"); | ||
176 | 165 | ||
177 | /* Special case for the namespace Root Node */ | 166 | /* Special case for the namespace Root Node */ |
178 | 167 | ||
@@ -183,9 +172,9 @@ acpi_ns_walk_namespace ( | |||
183 | /* Null child means "get first node" */ | 172 | /* Null child means "get first node" */ |
184 | 173 | ||
185 | parent_node = start_node; | 174 | parent_node = start_node; |
186 | child_node = NULL; | 175 | child_node = NULL; |
187 | child_type = ACPI_TYPE_ANY; | 176 | child_type = ACPI_TYPE_ANY; |
188 | level = 1; | 177 | level = 1; |
189 | 178 | ||
190 | /* | 179 | /* |
191 | * Traverse the tree of nodes until we bubble back up to where we | 180 | * Traverse the tree of nodes until we bubble back up to where we |
@@ -196,7 +185,9 @@ acpi_ns_walk_namespace ( | |||
196 | /* Get the next node in this scope. Null if not found */ | 185 | /* Get the next node in this scope. Null if not found */ |
197 | 186 | ||
198 | status = AE_OK; | 187 | status = AE_OK; |
199 | child_node = acpi_ns_get_next_node (ACPI_TYPE_ANY, parent_node, child_node); | 188 | child_node = |
189 | acpi_ns_get_next_node(ACPI_TYPE_ANY, parent_node, | ||
190 | child_node); | ||
200 | if (child_node) { | 191 | if (child_node) { |
201 | /* | 192 | /* |
202 | * Found node, Get the type if we are not | 193 | * Found node, Get the type if we are not |
@@ -212,19 +203,25 @@ acpi_ns_walk_namespace ( | |||
212 | * callback function | 203 | * callback function |
213 | */ | 204 | */ |
214 | if (unlock_before_callback) { | 205 | if (unlock_before_callback) { |
215 | mutex_status = acpi_ut_release_mutex (ACPI_MTX_NAMESPACE); | 206 | mutex_status = |
216 | if (ACPI_FAILURE (mutex_status)) { | 207 | acpi_ut_release_mutex |
217 | return_ACPI_STATUS (mutex_status); | 208 | (ACPI_MTX_NAMESPACE); |
209 | if (ACPI_FAILURE(mutex_status)) { | ||
210 | return_ACPI_STATUS | ||
211 | (mutex_status); | ||
218 | } | 212 | } |
219 | } | 213 | } |
220 | 214 | ||
221 | status = user_function (child_node, level, | 215 | status = user_function(child_node, level, |
222 | context, return_value); | 216 | context, return_value); |
223 | 217 | ||
224 | if (unlock_before_callback) { | 218 | if (unlock_before_callback) { |
225 | mutex_status = acpi_ut_acquire_mutex (ACPI_MTX_NAMESPACE); | 219 | mutex_status = |
226 | if (ACPI_FAILURE (mutex_status)) { | 220 | acpi_ut_acquire_mutex |
227 | return_ACPI_STATUS (mutex_status); | 221 | (ACPI_MTX_NAMESPACE); |
222 | if (ACPI_FAILURE(mutex_status)) { | ||
223 | return_ACPI_STATUS | ||
224 | (mutex_status); | ||
228 | } | 225 | } |
229 | } | 226 | } |
230 | 227 | ||
@@ -239,13 +236,13 @@ acpi_ns_walk_namespace ( | |||
239 | 236 | ||
240 | /* Exit now, with OK status */ | 237 | /* Exit now, with OK status */ |
241 | 238 | ||
242 | return_ACPI_STATUS (AE_OK); | 239 | return_ACPI_STATUS(AE_OK); |
243 | 240 | ||
244 | default: | 241 | default: |
245 | 242 | ||
246 | /* All others are valid exceptions */ | 243 | /* All others are valid exceptions */ |
247 | 244 | ||
248 | return_ACPI_STATUS (status); | 245 | return_ACPI_STATUS(status); |
249 | } | 246 | } |
250 | } | 247 | } |
251 | 248 | ||
@@ -258,7 +255,8 @@ acpi_ns_walk_namespace ( | |||
258 | * maximum depth has been reached. | 255 | * maximum depth has been reached. |
259 | */ | 256 | */ |
260 | if ((level < max_depth) && (status != AE_CTRL_DEPTH)) { | 257 | if ((level < max_depth) && (status != AE_CTRL_DEPTH)) { |
261 | if (acpi_ns_get_next_node (ACPI_TYPE_ANY, child_node, NULL)) { | 258 | if (acpi_ns_get_next_node |
259 | (ACPI_TYPE_ANY, child_node, NULL)) { | ||
262 | /* | 260 | /* |
263 | * There is at least one child of this | 261 | * There is at least one child of this |
264 | * node, visit the onde | 262 | * node, visit the onde |
@@ -268,8 +266,7 @@ acpi_ns_walk_namespace ( | |||
268 | child_node = NULL; | 266 | child_node = NULL; |
269 | } | 267 | } |
270 | } | 268 | } |
271 | } | 269 | } else { |
272 | else { | ||
273 | /* | 270 | /* |
274 | * No more children of this node (acpi_ns_get_next_node | 271 | * No more children of this node (acpi_ns_get_next_node |
275 | * failed), go back upwards in the namespace tree to | 272 | * failed), go back upwards in the namespace tree to |
@@ -277,13 +274,11 @@ acpi_ns_walk_namespace ( | |||
277 | */ | 274 | */ |
278 | level--; | 275 | level--; |
279 | child_node = parent_node; | 276 | child_node = parent_node; |
280 | parent_node = acpi_ns_get_parent_node (parent_node); | 277 | parent_node = acpi_ns_get_parent_node(parent_node); |
281 | } | 278 | } |
282 | } | 279 | } |
283 | 280 | ||
284 | /* Complete walk, not terminated by user function */ | 281 | /* Complete walk, not terminated by user function */ |
285 | 282 | ||
286 | return_ACPI_STATUS (AE_OK); | 283 | return_ACPI_STATUS(AE_OK); |
287 | } | 284 | } |
288 | |||
289 | |||
diff --git a/drivers/acpi/namespace/nsxfeval.c b/drivers/acpi/namespace/nsxfeval.c index 12ea202257fa..c07b046659ff 100644 --- a/drivers/acpi/namespace/nsxfeval.c +++ b/drivers/acpi/namespace/nsxfeval.c | |||
@@ -48,10 +48,8 @@ | |||
48 | #include <acpi/acnamesp.h> | 48 | #include <acpi/acnamesp.h> |
49 | #include <acpi/acinterp.h> | 49 | #include <acpi/acinterp.h> |
50 | 50 | ||
51 | |||
52 | #define _COMPONENT ACPI_NAMESPACE | 51 | #define _COMPONENT ACPI_NAMESPACE |
53 | ACPI_MODULE_NAME ("nsxfeval") | 52 | ACPI_MODULE_NAME("nsxfeval") |
54 | |||
55 | 53 | ||
56 | /******************************************************************************* | 54 | /******************************************************************************* |
57 | * | 55 | * |
@@ -73,27 +71,23 @@ | |||
73 | * be valid (non-null) | 71 | * be valid (non-null) |
74 | * | 72 | * |
75 | ******************************************************************************/ | 73 | ******************************************************************************/ |
76 | |||
77 | #ifdef ACPI_FUTURE_USAGE | 74 | #ifdef ACPI_FUTURE_USAGE |
78 | acpi_status | 75 | acpi_status |
79 | acpi_evaluate_object_typed ( | 76 | acpi_evaluate_object_typed(acpi_handle handle, |
80 | acpi_handle handle, | 77 | acpi_string pathname, |
81 | acpi_string pathname, | 78 | struct acpi_object_list *external_params, |
82 | struct acpi_object_list *external_params, | 79 | struct acpi_buffer *return_buffer, |
83 | struct acpi_buffer *return_buffer, | 80 | acpi_object_type return_type) |
84 | acpi_object_type return_type) | ||
85 | { | 81 | { |
86 | acpi_status status; | 82 | acpi_status status; |
87 | u8 must_free = FALSE; | 83 | u8 must_free = FALSE; |
88 | |||
89 | |||
90 | ACPI_FUNCTION_TRACE ("acpi_evaluate_object_typed"); | ||
91 | 84 | ||
85 | ACPI_FUNCTION_TRACE("acpi_evaluate_object_typed"); | ||
92 | 86 | ||
93 | /* Return buffer must be valid */ | 87 | /* Return buffer must be valid */ |
94 | 88 | ||
95 | if (!return_buffer) { | 89 | if (!return_buffer) { |
96 | return_ACPI_STATUS (AE_BAD_PARAMETER); | 90 | return_ACPI_STATUS(AE_BAD_PARAMETER); |
97 | } | 91 | } |
98 | 92 | ||
99 | if (return_buffer->length == ACPI_ALLOCATE_BUFFER) { | 93 | if (return_buffer->length == ACPI_ALLOCATE_BUFFER) { |
@@ -102,51 +96,52 @@ acpi_evaluate_object_typed ( | |||
102 | 96 | ||
103 | /* Evaluate the object */ | 97 | /* Evaluate the object */ |
104 | 98 | ||
105 | status = acpi_evaluate_object (handle, pathname, external_params, return_buffer); | 99 | status = |
106 | if (ACPI_FAILURE (status)) { | 100 | acpi_evaluate_object(handle, pathname, external_params, |
107 | return_ACPI_STATUS (status); | 101 | return_buffer); |
102 | if (ACPI_FAILURE(status)) { | ||
103 | return_ACPI_STATUS(status); | ||
108 | } | 104 | } |
109 | 105 | ||
110 | /* Type ANY means "don't care" */ | 106 | /* Type ANY means "don't care" */ |
111 | 107 | ||
112 | if (return_type == ACPI_TYPE_ANY) { | 108 | if (return_type == ACPI_TYPE_ANY) { |
113 | return_ACPI_STATUS (AE_OK); | 109 | return_ACPI_STATUS(AE_OK); |
114 | } | 110 | } |
115 | 111 | ||
116 | if (return_buffer->length == 0) { | 112 | if (return_buffer->length == 0) { |
117 | /* Error because caller specifically asked for a return value */ | 113 | /* Error because caller specifically asked for a return value */ |
118 | 114 | ||
119 | ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, | 115 | ACPI_DEBUG_PRINT((ACPI_DB_ERROR, "No return value\n")); |
120 | "No return value\n")); | ||
121 | 116 | ||
122 | return_ACPI_STATUS (AE_NULL_OBJECT); | 117 | return_ACPI_STATUS(AE_NULL_OBJECT); |
123 | } | 118 | } |
124 | 119 | ||
125 | /* Examine the object type returned from evaluate_object */ | 120 | /* Examine the object type returned from evaluate_object */ |
126 | 121 | ||
127 | if (((union acpi_object *) return_buffer->pointer)->type == return_type) { | 122 | if (((union acpi_object *)return_buffer->pointer)->type == return_type) { |
128 | return_ACPI_STATUS (AE_OK); | 123 | return_ACPI_STATUS(AE_OK); |
129 | } | 124 | } |
130 | 125 | ||
131 | /* Return object type does not match requested type */ | 126 | /* Return object type does not match requested type */ |
132 | 127 | ||
133 | ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, | 128 | ACPI_DEBUG_PRINT((ACPI_DB_ERROR, |
134 | "Incorrect return type [%s] requested [%s]\n", | 129 | "Incorrect return type [%s] requested [%s]\n", |
135 | acpi_ut_get_type_name (((union acpi_object *) return_buffer->pointer)->type), | 130 | acpi_ut_get_type_name(((union acpi_object *) |
136 | acpi_ut_get_type_name (return_type))); | 131 | return_buffer->pointer)->type), |
132 | acpi_ut_get_type_name(return_type))); | ||
137 | 133 | ||
138 | if (must_free) { | 134 | if (must_free) { |
139 | /* Caller used ACPI_ALLOCATE_BUFFER, free the return buffer */ | 135 | /* Caller used ACPI_ALLOCATE_BUFFER, free the return buffer */ |
140 | 136 | ||
141 | acpi_os_free (return_buffer->pointer); | 137 | acpi_os_free(return_buffer->pointer); |
142 | return_buffer->pointer = NULL; | 138 | return_buffer->pointer = NULL; |
143 | } | 139 | } |
144 | 140 | ||
145 | return_buffer->length = 0; | 141 | return_buffer->length = 0; |
146 | return_ACPI_STATUS (AE_TYPE); | 142 | return_ACPI_STATUS(AE_TYPE); |
147 | } | 143 | } |
148 | #endif /* ACPI_FUTURE_USAGE */ | 144 | #endif /* ACPI_FUTURE_USAGE */ |
149 | |||
150 | 145 | ||
151 | /******************************************************************************* | 146 | /******************************************************************************* |
152 | * | 147 | * |
@@ -169,21 +164,18 @@ acpi_evaluate_object_typed ( | |||
169 | ******************************************************************************/ | 164 | ******************************************************************************/ |
170 | 165 | ||
171 | acpi_status | 166 | acpi_status |
172 | acpi_evaluate_object ( | 167 | acpi_evaluate_object(acpi_handle handle, |
173 | acpi_handle handle, | 168 | acpi_string pathname, |
174 | acpi_string pathname, | 169 | struct acpi_object_list *external_params, |
175 | struct acpi_object_list *external_params, | 170 | struct acpi_buffer *return_buffer) |
176 | struct acpi_buffer *return_buffer) | ||
177 | { | 171 | { |
178 | acpi_status status; | 172 | acpi_status status; |
179 | acpi_status status2; | 173 | acpi_status status2; |
180 | struct acpi_parameter_info info; | 174 | struct acpi_parameter_info info; |
181 | acpi_size buffer_space_needed; | 175 | acpi_size buffer_space_needed; |
182 | u32 i; | 176 | u32 i; |
183 | |||
184 | |||
185 | ACPI_FUNCTION_TRACE ("acpi_evaluate_object"); | ||
186 | 177 | ||
178 | ACPI_FUNCTION_TRACE("acpi_evaluate_object"); | ||
187 | 179 | ||
188 | info.node = handle; | 180 | info.node = handle; |
189 | info.parameters = NULL; | 181 | info.parameters = NULL; |
@@ -200,11 +192,11 @@ acpi_evaluate_object ( | |||
200 | * Allocate a new parameter block for the internal objects | 192 | * Allocate a new parameter block for the internal objects |
201 | * Add 1 to count to allow for null terminated internal list | 193 | * Add 1 to count to allow for null terminated internal list |
202 | */ | 194 | */ |
203 | info.parameters = ACPI_MEM_CALLOCATE ( | 195 | info.parameters = ACPI_MEM_CALLOCATE(((acpi_size) |
204 | ((acpi_size) external_params->count + 1) * | 196 | external_params->count + |
205 | sizeof (void *)); | 197 | 1) * sizeof(void *)); |
206 | if (!info.parameters) { | 198 | if (!info.parameters) { |
207 | return_ACPI_STATUS (AE_NO_MEMORY); | 199 | return_ACPI_STATUS(AE_NO_MEMORY); |
208 | } | 200 | } |
209 | 201 | ||
210 | /* | 202 | /* |
@@ -212,48 +204,47 @@ acpi_evaluate_object ( | |||
212 | * internal object | 204 | * internal object |
213 | */ | 205 | */ |
214 | for (i = 0; i < external_params->count; i++) { | 206 | for (i = 0; i < external_params->count; i++) { |
215 | status = acpi_ut_copy_eobject_to_iobject (&external_params->pointer[i], | 207 | status = |
216 | &info.parameters[i]); | 208 | acpi_ut_copy_eobject_to_iobject(&external_params-> |
217 | if (ACPI_FAILURE (status)) { | 209 | pointer[i], |
218 | acpi_ut_delete_internal_object_list (info.parameters); | 210 | &info. |
219 | return_ACPI_STATUS (status); | 211 | parameters[i]); |
212 | if (ACPI_FAILURE(status)) { | ||
213 | acpi_ut_delete_internal_object_list(info. | ||
214 | parameters); | ||
215 | return_ACPI_STATUS(status); | ||
220 | } | 216 | } |
221 | } | 217 | } |
222 | info.parameters[external_params->count] = NULL; | 218 | info.parameters[external_params->count] = NULL; |
223 | } | 219 | } |
224 | 220 | ||
225 | |||
226 | /* | 221 | /* |
227 | * Three major cases: | 222 | * Three major cases: |
228 | * 1) Fully qualified pathname | 223 | * 1) Fully qualified pathname |
229 | * 2) No handle, not fully qualified pathname (error) | 224 | * 2) No handle, not fully qualified pathname (error) |
230 | * 3) Valid handle | 225 | * 3) Valid handle |
231 | */ | 226 | */ |
232 | if ((pathname) && | 227 | if ((pathname) && (acpi_ns_valid_root_prefix(pathname[0]))) { |
233 | (acpi_ns_valid_root_prefix (pathname[0]))) { | ||
234 | /* | 228 | /* |
235 | * The path is fully qualified, just evaluate by name | 229 | * The path is fully qualified, just evaluate by name |
236 | */ | 230 | */ |
237 | status = acpi_ns_evaluate_by_name (pathname, &info); | 231 | status = acpi_ns_evaluate_by_name(pathname, &info); |
238 | } | 232 | } else if (!handle) { |
239 | else if (!handle) { | ||
240 | /* | 233 | /* |
241 | * A handle is optional iff a fully qualified pathname | 234 | * A handle is optional iff a fully qualified pathname |
242 | * is specified. Since we've already handled fully | 235 | * is specified. Since we've already handled fully |
243 | * qualified names above, this is an error | 236 | * qualified names above, this is an error |
244 | */ | 237 | */ |
245 | if (!pathname) { | 238 | if (!pathname) { |
246 | ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, | 239 | ACPI_DEBUG_PRINT((ACPI_DB_ERROR, |
247 | "Both Handle and Pathname are NULL\n")); | 240 | "Both Handle and Pathname are NULL\n")); |
248 | } | 241 | } else { |
249 | else { | 242 | ACPI_DEBUG_PRINT((ACPI_DB_ERROR, |
250 | ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, | 243 | "Handle is NULL and Pathname is relative\n")); |
251 | "Handle is NULL and Pathname is relative\n")); | ||
252 | } | 244 | } |
253 | 245 | ||
254 | status = AE_BAD_PARAMETER; | 246 | status = AE_BAD_PARAMETER; |
255 | } | 247 | } else { |
256 | else { | ||
257 | /* | 248 | /* |
258 | * We get here if we have a handle -- and if we have a | 249 | * We get here if we have a handle -- and if we have a |
259 | * pathname it is relative. The handle will be validated | 250 | * pathname it is relative. The handle will be validated |
@@ -264,17 +255,15 @@ acpi_evaluate_object ( | |||
264 | * The null pathname case means the handle is for | 255 | * The null pathname case means the handle is for |
265 | * the actual object to be evaluated | 256 | * the actual object to be evaluated |
266 | */ | 257 | */ |
267 | status = acpi_ns_evaluate_by_handle (&info); | 258 | status = acpi_ns_evaluate_by_handle(&info); |
268 | } | 259 | } else { |
269 | else { | 260 | /* |
270 | /* | 261 | * Both a Handle and a relative Pathname |
271 | * Both a Handle and a relative Pathname | 262 | */ |
272 | */ | 263 | status = acpi_ns_evaluate_relative(pathname, &info); |
273 | status = acpi_ns_evaluate_relative (pathname, &info); | ||
274 | } | 264 | } |
275 | } | 265 | } |
276 | 266 | ||
277 | |||
278 | /* | 267 | /* |
279 | * If we are expecting a return value, and all went well above, | 268 | * If we are expecting a return value, and all went well above, |
280 | * copy the return value to an external object. | 269 | * copy the return value to an external object. |
@@ -282,9 +271,9 @@ acpi_evaluate_object ( | |||
282 | if (return_buffer) { | 271 | if (return_buffer) { |
283 | if (!info.return_object) { | 272 | if (!info.return_object) { |
284 | return_buffer->length = 0; | 273 | return_buffer->length = 0; |
285 | } | 274 | } else { |
286 | else { | 275 | if (ACPI_GET_DESCRIPTOR_TYPE(info.return_object) == |
287 | if (ACPI_GET_DESCRIPTOR_TYPE (info.return_object) == ACPI_DESC_TYPE_NAMED) { | 276 | ACPI_DESC_TYPE_NAMED) { |
288 | /* | 277 | /* |
289 | * If we received a NS Node as a return object, this means that | 278 | * If we received a NS Node as a return object, this means that |
290 | * the object we are evaluating has nothing interesting to | 279 | * the object we are evaluating has nothing interesting to |
@@ -294,37 +283,43 @@ acpi_evaluate_object ( | |||
294 | * support for various types at a later date if necessary. | 283 | * support for various types at a later date if necessary. |
295 | */ | 284 | */ |
296 | status = AE_TYPE; | 285 | status = AE_TYPE; |
297 | info.return_object = NULL; /* No need to delete a NS Node */ | 286 | info.return_object = NULL; /* No need to delete a NS Node */ |
298 | return_buffer->length = 0; | 287 | return_buffer->length = 0; |
299 | } | 288 | } |
300 | 289 | ||
301 | if (ACPI_SUCCESS (status)) { | 290 | if (ACPI_SUCCESS(status)) { |
302 | /* | 291 | /* |
303 | * Find out how large a buffer is needed | 292 | * Find out how large a buffer is needed |
304 | * to contain the returned object | 293 | * to contain the returned object |
305 | */ | 294 | */ |
306 | status = acpi_ut_get_object_size (info.return_object, | 295 | status = |
307 | &buffer_space_needed); | 296 | acpi_ut_get_object_size(info.return_object, |
308 | if (ACPI_SUCCESS (status)) { | 297 | &buffer_space_needed); |
298 | if (ACPI_SUCCESS(status)) { | ||
309 | /* Validate/Allocate/Clear caller buffer */ | 299 | /* Validate/Allocate/Clear caller buffer */ |
310 | 300 | ||
311 | status = acpi_ut_initialize_buffer (return_buffer, | 301 | status = |
312 | buffer_space_needed); | 302 | acpi_ut_initialize_buffer |
313 | if (ACPI_FAILURE (status)) { | 303 | (return_buffer, |
304 | buffer_space_needed); | ||
305 | if (ACPI_FAILURE(status)) { | ||
314 | /* | 306 | /* |
315 | * Caller's buffer is too small or a new one can't be allocated | 307 | * Caller's buffer is too small or a new one can't be allocated |
316 | */ | 308 | */ |
317 | ACPI_DEBUG_PRINT ((ACPI_DB_INFO, | 309 | ACPI_DEBUG_PRINT((ACPI_DB_INFO, |
318 | "Needed buffer size %X, %s\n", | 310 | "Needed buffer size %X, %s\n", |
319 | (u32) buffer_space_needed, | 311 | (u32) |
320 | acpi_format_exception (status))); | 312 | buffer_space_needed, |
321 | } | 313 | acpi_format_exception |
322 | else { | 314 | (status))); |
315 | } else { | ||
323 | /* | 316 | /* |
324 | * We have enough space for the object, build it | 317 | * We have enough space for the object, build it |
325 | */ | 318 | */ |
326 | status = acpi_ut_copy_iobject_to_eobject (info.return_object, | 319 | status = |
327 | return_buffer); | 320 | acpi_ut_copy_iobject_to_eobject |
321 | (info.return_object, | ||
322 | return_buffer); | ||
328 | } | 323 | } |
329 | } | 324 | } |
330 | } | 325 | } |
@@ -336,14 +331,14 @@ acpi_evaluate_object ( | |||
336 | * Delete the internal return object. NOTE: Interpreter | 331 | * Delete the internal return object. NOTE: Interpreter |
337 | * must be locked to avoid race condition. | 332 | * must be locked to avoid race condition. |
338 | */ | 333 | */ |
339 | status2 = acpi_ex_enter_interpreter (); | 334 | status2 = acpi_ex_enter_interpreter(); |
340 | if (ACPI_SUCCESS (status2)) { | 335 | if (ACPI_SUCCESS(status2)) { |
341 | /* | 336 | /* |
342 | * Delete the internal return object. (Or at least | 337 | * Delete the internal return object. (Or at least |
343 | * decrement the reference count by one) | 338 | * decrement the reference count by one) |
344 | */ | 339 | */ |
345 | acpi_ut_remove_reference (info.return_object); | 340 | acpi_ut_remove_reference(info.return_object); |
346 | acpi_ex_exit_interpreter (); | 341 | acpi_ex_exit_interpreter(); |
347 | } | 342 | } |
348 | } | 343 | } |
349 | 344 | ||
@@ -353,13 +348,13 @@ acpi_evaluate_object ( | |||
353 | if (info.parameters) { | 348 | if (info.parameters) { |
354 | /* Free the allocated parameter block */ | 349 | /* Free the allocated parameter block */ |
355 | 350 | ||
356 | acpi_ut_delete_internal_object_list (info.parameters); | 351 | acpi_ut_delete_internal_object_list(info.parameters); |
357 | } | 352 | } |
358 | 353 | ||
359 | return_ACPI_STATUS (status); | 354 | return_ACPI_STATUS(status); |
360 | } | 355 | } |
361 | EXPORT_SYMBOL(acpi_evaluate_object); | ||
362 | 356 | ||
357 | EXPORT_SYMBOL(acpi_evaluate_object); | ||
363 | 358 | ||
364 | /******************************************************************************* | 359 | /******************************************************************************* |
365 | * | 360 | * |
@@ -392,26 +387,20 @@ EXPORT_SYMBOL(acpi_evaluate_object); | |||
392 | ******************************************************************************/ | 387 | ******************************************************************************/ |
393 | 388 | ||
394 | acpi_status | 389 | acpi_status |
395 | acpi_walk_namespace ( | 390 | acpi_walk_namespace(acpi_object_type type, |
396 | acpi_object_type type, | 391 | acpi_handle start_object, |
397 | acpi_handle start_object, | 392 | u32 max_depth, |
398 | u32 max_depth, | 393 | acpi_walk_callback user_function, |
399 | acpi_walk_callback user_function, | 394 | void *context, void **return_value) |
400 | void *context, | ||
401 | void **return_value) | ||
402 | { | 395 | { |
403 | acpi_status status; | 396 | acpi_status status; |
404 | |||
405 | |||
406 | ACPI_FUNCTION_TRACE ("acpi_walk_namespace"); | ||
407 | 397 | ||
398 | ACPI_FUNCTION_TRACE("acpi_walk_namespace"); | ||
408 | 399 | ||
409 | /* Parameter validation */ | 400 | /* Parameter validation */ |
410 | 401 | ||
411 | if ((type > ACPI_TYPE_EXTERNAL_MAX) || | 402 | if ((type > ACPI_TYPE_EXTERNAL_MAX) || (!max_depth) || (!user_function)) { |
412 | (!max_depth) || | 403 | return_ACPI_STATUS(AE_BAD_PARAMETER); |
413 | (!user_function)) { | ||
414 | return_ACPI_STATUS (AE_BAD_PARAMETER); | ||
415 | } | 404 | } |
416 | 405 | ||
417 | /* | 406 | /* |
@@ -420,20 +409,20 @@ acpi_walk_namespace ( | |||
420 | * to the user function - since this function | 409 | * to the user function - since this function |
421 | * must be allowed to make Acpi calls itself. | 410 | * must be allowed to make Acpi calls itself. |
422 | */ | 411 | */ |
423 | status = acpi_ut_acquire_mutex (ACPI_MTX_NAMESPACE); | 412 | status = acpi_ut_acquire_mutex(ACPI_MTX_NAMESPACE); |
424 | if (ACPI_FAILURE (status)) { | 413 | if (ACPI_FAILURE(status)) { |
425 | return_ACPI_STATUS (status); | 414 | return_ACPI_STATUS(status); |
426 | } | 415 | } |
427 | 416 | ||
428 | status = acpi_ns_walk_namespace (type, start_object, max_depth, | 417 | status = acpi_ns_walk_namespace(type, start_object, max_depth, |
429 | ACPI_NS_WALK_UNLOCK, | 418 | ACPI_NS_WALK_UNLOCK, |
430 | user_function, context, return_value); | 419 | user_function, context, return_value); |
431 | 420 | ||
432 | (void) acpi_ut_release_mutex (ACPI_MTX_NAMESPACE); | 421 | (void)acpi_ut_release_mutex(ACPI_MTX_NAMESPACE); |
433 | return_ACPI_STATUS (status); | 422 | return_ACPI_STATUS(status); |
434 | } | 423 | } |
435 | EXPORT_SYMBOL(acpi_walk_namespace); | ||
436 | 424 | ||
425 | EXPORT_SYMBOL(acpi_walk_namespace); | ||
437 | 426 | ||
438 | /******************************************************************************* | 427 | /******************************************************************************* |
439 | * | 428 | * |
@@ -450,29 +439,26 @@ EXPORT_SYMBOL(acpi_walk_namespace); | |||
450 | ******************************************************************************/ | 439 | ******************************************************************************/ |
451 | 440 | ||
452 | static acpi_status | 441 | static acpi_status |
453 | acpi_ns_get_device_callback ( | 442 | acpi_ns_get_device_callback(acpi_handle obj_handle, |
454 | acpi_handle obj_handle, | 443 | u32 nesting_level, |
455 | u32 nesting_level, | 444 | void *context, void **return_value) |
456 | void *context, | ||
457 | void **return_value) | ||
458 | { | 445 | { |
459 | struct acpi_get_devices_info *info = context; | 446 | struct acpi_get_devices_info *info = context; |
460 | acpi_status status; | 447 | acpi_status status; |
461 | struct acpi_namespace_node *node; | 448 | struct acpi_namespace_node *node; |
462 | u32 flags; | 449 | u32 flags; |
463 | struct acpi_device_id hid; | 450 | struct acpi_device_id hid; |
464 | struct acpi_compatible_id_list *cid; | 451 | struct acpi_compatible_id_list *cid; |
465 | acpi_native_uint i; | 452 | acpi_native_uint i; |
466 | |||
467 | 453 | ||
468 | status = acpi_ut_acquire_mutex (ACPI_MTX_NAMESPACE); | 454 | status = acpi_ut_acquire_mutex(ACPI_MTX_NAMESPACE); |
469 | if (ACPI_FAILURE (status)) { | 455 | if (ACPI_FAILURE(status)) { |
470 | return (status); | 456 | return (status); |
471 | } | 457 | } |
472 | 458 | ||
473 | node = acpi_ns_map_handle_to_node (obj_handle); | 459 | node = acpi_ns_map_handle_to_node(obj_handle); |
474 | status = acpi_ut_release_mutex (ACPI_MTX_NAMESPACE); | 460 | status = acpi_ut_release_mutex(ACPI_MTX_NAMESPACE); |
475 | if (ACPI_FAILURE (status)) { | 461 | if (ACPI_FAILURE(status)) { |
476 | return (status); | 462 | return (status); |
477 | } | 463 | } |
478 | 464 | ||
@@ -482,8 +468,8 @@ acpi_ns_get_device_callback ( | |||
482 | 468 | ||
483 | /* Run _STA to determine if device is present */ | 469 | /* Run _STA to determine if device is present */ |
484 | 470 | ||
485 | status = acpi_ut_execute_STA (node, &flags); | 471 | status = acpi_ut_execute_STA(node, &flags); |
486 | if (ACPI_FAILURE (status)) { | 472 | if (ACPI_FAILURE(status)) { |
487 | return (AE_CTRL_DEPTH); | 473 | return (AE_CTRL_DEPTH); |
488 | } | 474 | } |
489 | 475 | ||
@@ -496,44 +482,43 @@ acpi_ns_get_device_callback ( | |||
496 | /* Filter based on device HID & CID */ | 482 | /* Filter based on device HID & CID */ |
497 | 483 | ||
498 | if (info->hid != NULL) { | 484 | if (info->hid != NULL) { |
499 | status = acpi_ut_execute_HID (node, &hid); | 485 | status = acpi_ut_execute_HID(node, &hid); |
500 | if (status == AE_NOT_FOUND) { | 486 | if (status == AE_NOT_FOUND) { |
501 | return (AE_OK); | 487 | return (AE_OK); |
502 | } | 488 | } else if (ACPI_FAILURE(status)) { |
503 | else if (ACPI_FAILURE (status)) { | ||
504 | return (AE_CTRL_DEPTH); | 489 | return (AE_CTRL_DEPTH); |
505 | } | 490 | } |
506 | 491 | ||
507 | if (ACPI_STRNCMP (hid.value, info->hid, sizeof (hid.value)) != 0) { | 492 | if (ACPI_STRNCMP(hid.value, info->hid, sizeof(hid.value)) != 0) { |
508 | /* Get the list of Compatible IDs */ | 493 | /* Get the list of Compatible IDs */ |
509 | 494 | ||
510 | status = acpi_ut_execute_CID (node, &cid); | 495 | status = acpi_ut_execute_CID(node, &cid); |
511 | if (status == AE_NOT_FOUND) { | 496 | if (status == AE_NOT_FOUND) { |
512 | return (AE_OK); | 497 | return (AE_OK); |
513 | } | 498 | } else if (ACPI_FAILURE(status)) { |
514 | else if (ACPI_FAILURE (status)) { | ||
515 | return (AE_CTRL_DEPTH); | 499 | return (AE_CTRL_DEPTH); |
516 | } | 500 | } |
517 | 501 | ||
518 | /* Walk the CID list */ | 502 | /* Walk the CID list */ |
519 | 503 | ||
520 | for (i = 0; i < cid->count; i++) { | 504 | for (i = 0; i < cid->count; i++) { |
521 | if (ACPI_STRNCMP (cid->id[i].value, info->hid, | 505 | if (ACPI_STRNCMP(cid->id[i].value, info->hid, |
522 | sizeof (struct acpi_compatible_id)) != 0) { | 506 | sizeof(struct |
523 | ACPI_MEM_FREE (cid); | 507 | acpi_compatible_id)) != |
508 | 0) { | ||
509 | ACPI_MEM_FREE(cid); | ||
524 | return (AE_OK); | 510 | return (AE_OK); |
525 | } | 511 | } |
526 | } | 512 | } |
527 | ACPI_MEM_FREE (cid); | 513 | ACPI_MEM_FREE(cid); |
528 | } | 514 | } |
529 | } | 515 | } |
530 | 516 | ||
531 | status = info->user_function (obj_handle, nesting_level, info->context, | 517 | status = info->user_function(obj_handle, nesting_level, info->context, |
532 | return_value); | 518 | return_value); |
533 | return (status); | 519 | return (status); |
534 | } | 520 | } |
535 | 521 | ||
536 | |||
537 | /******************************************************************************* | 522 | /******************************************************************************* |
538 | * | 523 | * |
539 | * FUNCTION: acpi_get_devices | 524 | * FUNCTION: acpi_get_devices |
@@ -560,32 +545,28 @@ acpi_ns_get_device_callback ( | |||
560 | ******************************************************************************/ | 545 | ******************************************************************************/ |
561 | 546 | ||
562 | acpi_status | 547 | acpi_status |
563 | acpi_get_devices ( | 548 | acpi_get_devices(char *HID, |
564 | char *HID, | 549 | acpi_walk_callback user_function, |
565 | acpi_walk_callback user_function, | 550 | void *context, void **return_value) |
566 | void *context, | ||
567 | void **return_value) | ||
568 | { | 551 | { |
569 | acpi_status status; | 552 | acpi_status status; |
570 | struct acpi_get_devices_info info; | 553 | struct acpi_get_devices_info info; |
571 | |||
572 | |||
573 | ACPI_FUNCTION_TRACE ("acpi_get_devices"); | ||
574 | 554 | ||
555 | ACPI_FUNCTION_TRACE("acpi_get_devices"); | ||
575 | 556 | ||
576 | /* Parameter validation */ | 557 | /* Parameter validation */ |
577 | 558 | ||
578 | if (!user_function) { | 559 | if (!user_function) { |
579 | return_ACPI_STATUS (AE_BAD_PARAMETER); | 560 | return_ACPI_STATUS(AE_BAD_PARAMETER); |
580 | } | 561 | } |
581 | 562 | ||
582 | /* | 563 | /* |
583 | * We're going to call their callback from OUR callback, so we need | 564 | * We're going to call their callback from OUR callback, so we need |
584 | * to know what it is, and their context parameter. | 565 | * to know what it is, and their context parameter. |
585 | */ | 566 | */ |
586 | info.context = context; | 567 | info.context = context; |
587 | info.user_function = user_function; | 568 | info.user_function = user_function; |
588 | info.hid = HID; | 569 | info.hid = HID; |
589 | 570 | ||
590 | /* | 571 | /* |
591 | * Lock the namespace around the walk. | 572 | * Lock the namespace around the walk. |
@@ -593,22 +574,22 @@ acpi_get_devices ( | |||
593 | * to the user function - since this function | 574 | * to the user function - since this function |
594 | * must be allowed to make Acpi calls itself. | 575 | * must be allowed to make Acpi calls itself. |
595 | */ | 576 | */ |
596 | status = acpi_ut_acquire_mutex (ACPI_MTX_NAMESPACE); | 577 | status = acpi_ut_acquire_mutex(ACPI_MTX_NAMESPACE); |
597 | if (ACPI_FAILURE (status)) { | 578 | if (ACPI_FAILURE(status)) { |
598 | return_ACPI_STATUS (status); | 579 | return_ACPI_STATUS(status); |
599 | } | 580 | } |
600 | 581 | ||
601 | status = acpi_ns_walk_namespace (ACPI_TYPE_DEVICE, | 582 | status = acpi_ns_walk_namespace(ACPI_TYPE_DEVICE, |
602 | ACPI_ROOT_OBJECT, ACPI_UINT32_MAX, | 583 | ACPI_ROOT_OBJECT, ACPI_UINT32_MAX, |
603 | ACPI_NS_WALK_UNLOCK, | 584 | ACPI_NS_WALK_UNLOCK, |
604 | acpi_ns_get_device_callback, &info, | 585 | acpi_ns_get_device_callback, &info, |
605 | return_value); | 586 | return_value); |
606 | 587 | ||
607 | (void) acpi_ut_release_mutex (ACPI_MTX_NAMESPACE); | 588 | (void)acpi_ut_release_mutex(ACPI_MTX_NAMESPACE); |
608 | return_ACPI_STATUS (status); | 589 | return_ACPI_STATUS(status); |
609 | } | 590 | } |
610 | EXPORT_SYMBOL(acpi_get_devices); | ||
611 | 591 | ||
592 | EXPORT_SYMBOL(acpi_get_devices); | ||
612 | 593 | ||
613 | /******************************************************************************* | 594 | /******************************************************************************* |
614 | * | 595 | * |
@@ -625,44 +606,38 @@ EXPORT_SYMBOL(acpi_get_devices); | |||
625 | ******************************************************************************/ | 606 | ******************************************************************************/ |
626 | 607 | ||
627 | acpi_status | 608 | acpi_status |
628 | acpi_attach_data ( | 609 | acpi_attach_data(acpi_handle obj_handle, |
629 | acpi_handle obj_handle, | 610 | acpi_object_handler handler, void *data) |
630 | acpi_object_handler handler, | ||
631 | void *data) | ||
632 | { | 611 | { |
633 | struct acpi_namespace_node *node; | 612 | struct acpi_namespace_node *node; |
634 | acpi_status status; | 613 | acpi_status status; |
635 | |||
636 | 614 | ||
637 | /* Parameter validation */ | 615 | /* Parameter validation */ |
638 | 616 | ||
639 | if (!obj_handle || | 617 | if (!obj_handle || !handler || !data) { |
640 | !handler || | ||
641 | !data) { | ||
642 | return (AE_BAD_PARAMETER); | 618 | return (AE_BAD_PARAMETER); |
643 | } | 619 | } |
644 | 620 | ||
645 | status = acpi_ut_acquire_mutex (ACPI_MTX_NAMESPACE); | 621 | status = acpi_ut_acquire_mutex(ACPI_MTX_NAMESPACE); |
646 | if (ACPI_FAILURE (status)) { | 622 | if (ACPI_FAILURE(status)) { |
647 | return (status); | 623 | return (status); |
648 | } | 624 | } |
649 | 625 | ||
650 | /* Convert and validate the handle */ | 626 | /* Convert and validate the handle */ |
651 | 627 | ||
652 | node = acpi_ns_map_handle_to_node (obj_handle); | 628 | node = acpi_ns_map_handle_to_node(obj_handle); |
653 | if (!node) { | 629 | if (!node) { |
654 | status = AE_BAD_PARAMETER; | 630 | status = AE_BAD_PARAMETER; |
655 | goto unlock_and_exit; | 631 | goto unlock_and_exit; |
656 | } | 632 | } |
657 | 633 | ||
658 | status = acpi_ns_attach_data (node, handler, data); | 634 | status = acpi_ns_attach_data(node, handler, data); |
659 | 635 | ||
660 | unlock_and_exit: | 636 | unlock_and_exit: |
661 | (void) acpi_ut_release_mutex (ACPI_MTX_NAMESPACE); | 637 | (void)acpi_ut_release_mutex(ACPI_MTX_NAMESPACE); |
662 | return (status); | 638 | return (status); |
663 | } | 639 | } |
664 | 640 | ||
665 | |||
666 | /******************************************************************************* | 641 | /******************************************************************************* |
667 | * | 642 | * |
668 | * FUNCTION: acpi_detach_data | 643 | * FUNCTION: acpi_detach_data |
@@ -677,42 +652,37 @@ unlock_and_exit: | |||
677 | ******************************************************************************/ | 652 | ******************************************************************************/ |
678 | 653 | ||
679 | acpi_status | 654 | acpi_status |
680 | acpi_detach_data ( | 655 | acpi_detach_data(acpi_handle obj_handle, acpi_object_handler handler) |
681 | acpi_handle obj_handle, | ||
682 | acpi_object_handler handler) | ||
683 | { | 656 | { |
684 | struct acpi_namespace_node *node; | 657 | struct acpi_namespace_node *node; |
685 | acpi_status status; | 658 | acpi_status status; |
686 | |||
687 | 659 | ||
688 | /* Parameter validation */ | 660 | /* Parameter validation */ |
689 | 661 | ||
690 | if (!obj_handle || | 662 | if (!obj_handle || !handler) { |
691 | !handler) { | ||
692 | return (AE_BAD_PARAMETER); | 663 | return (AE_BAD_PARAMETER); |
693 | } | 664 | } |
694 | 665 | ||
695 | status = acpi_ut_acquire_mutex (ACPI_MTX_NAMESPACE); | 666 | status = acpi_ut_acquire_mutex(ACPI_MTX_NAMESPACE); |
696 | if (ACPI_FAILURE (status)) { | 667 | if (ACPI_FAILURE(status)) { |
697 | return (status); | 668 | return (status); |
698 | } | 669 | } |
699 | 670 | ||
700 | /* Convert and validate the handle */ | 671 | /* Convert and validate the handle */ |
701 | 672 | ||
702 | node = acpi_ns_map_handle_to_node (obj_handle); | 673 | node = acpi_ns_map_handle_to_node(obj_handle); |
703 | if (!node) { | 674 | if (!node) { |
704 | status = AE_BAD_PARAMETER; | 675 | status = AE_BAD_PARAMETER; |
705 | goto unlock_and_exit; | 676 | goto unlock_and_exit; |
706 | } | 677 | } |
707 | 678 | ||
708 | status = acpi_ns_detach_data (node, handler); | 679 | status = acpi_ns_detach_data(node, handler); |
709 | 680 | ||
710 | unlock_and_exit: | 681 | unlock_and_exit: |
711 | (void) acpi_ut_release_mutex (ACPI_MTX_NAMESPACE); | 682 | (void)acpi_ut_release_mutex(ACPI_MTX_NAMESPACE); |
712 | return (status); | 683 | return (status); |
713 | } | 684 | } |
714 | 685 | ||
715 | |||
716 | /******************************************************************************* | 686 | /******************************************************************************* |
717 | * | 687 | * |
718 | * FUNCTION: acpi_get_data | 688 | * FUNCTION: acpi_get_data |
@@ -728,41 +698,33 @@ unlock_and_exit: | |||
728 | ******************************************************************************/ | 698 | ******************************************************************************/ |
729 | 699 | ||
730 | acpi_status | 700 | acpi_status |
731 | acpi_get_data ( | 701 | acpi_get_data(acpi_handle obj_handle, acpi_object_handler handler, void **data) |
732 | acpi_handle obj_handle, | ||
733 | acpi_object_handler handler, | ||
734 | void **data) | ||
735 | { | 702 | { |
736 | struct acpi_namespace_node *node; | 703 | struct acpi_namespace_node *node; |
737 | acpi_status status; | 704 | acpi_status status; |
738 | |||
739 | 705 | ||
740 | /* Parameter validation */ | 706 | /* Parameter validation */ |
741 | 707 | ||
742 | if (!obj_handle || | 708 | if (!obj_handle || !handler || !data) { |
743 | !handler || | ||
744 | !data) { | ||
745 | return (AE_BAD_PARAMETER); | 709 | return (AE_BAD_PARAMETER); |
746 | } | 710 | } |
747 | 711 | ||
748 | status = acpi_ut_acquire_mutex (ACPI_MTX_NAMESPACE); | 712 | status = acpi_ut_acquire_mutex(ACPI_MTX_NAMESPACE); |
749 | if (ACPI_FAILURE (status)) { | 713 | if (ACPI_FAILURE(status)) { |
750 | return (status); | 714 | return (status); |
751 | } | 715 | } |
752 | 716 | ||
753 | /* Convert and validate the handle */ | 717 | /* Convert and validate the handle */ |
754 | 718 | ||
755 | node = acpi_ns_map_handle_to_node (obj_handle); | 719 | node = acpi_ns_map_handle_to_node(obj_handle); |
756 | if (!node) { | 720 | if (!node) { |
757 | status = AE_BAD_PARAMETER; | 721 | status = AE_BAD_PARAMETER; |
758 | goto unlock_and_exit; | 722 | goto unlock_and_exit; |
759 | } | 723 | } |
760 | 724 | ||
761 | status = acpi_ns_get_attached_data (node, handler, data); | 725 | status = acpi_ns_get_attached_data(node, handler, data); |
762 | 726 | ||
763 | unlock_and_exit: | 727 | unlock_and_exit: |
764 | (void) acpi_ut_release_mutex (ACPI_MTX_NAMESPACE); | 728 | (void)acpi_ut_release_mutex(ACPI_MTX_NAMESPACE); |
765 | return (status); | 729 | return (status); |
766 | } | 730 | } |
767 | |||
768 | |||
diff --git a/drivers/acpi/namespace/nsxfname.c b/drivers/acpi/namespace/nsxfname.c index 8d097914c49a..6b5f8d4481d1 100644 --- a/drivers/acpi/namespace/nsxfname.c +++ b/drivers/acpi/namespace/nsxfname.c | |||
@@ -47,10 +47,8 @@ | |||
47 | #include <acpi/acpi.h> | 47 | #include <acpi/acpi.h> |
48 | #include <acpi/acnamesp.h> | 48 | #include <acpi/acnamesp.h> |
49 | 49 | ||
50 | |||
51 | #define _COMPONENT ACPI_NAMESPACE | 50 | #define _COMPONENT ACPI_NAMESPACE |
52 | ACPI_MODULE_NAME ("nsxfname") | 51 | ACPI_MODULE_NAME("nsxfname") |
53 | |||
54 | 52 | ||
55 | /****************************************************************************** | 53 | /****************************************************************************** |
56 | * | 54 | * |
@@ -69,20 +67,15 @@ | |||
69 | * namespace handle. | 67 | * namespace handle. |
70 | * | 68 | * |
71 | ******************************************************************************/ | 69 | ******************************************************************************/ |
72 | |||
73 | acpi_status | 70 | acpi_status |
74 | acpi_get_handle ( | 71 | acpi_get_handle(acpi_handle parent, |
75 | acpi_handle parent, | 72 | acpi_string pathname, acpi_handle * ret_handle) |
76 | acpi_string pathname, | ||
77 | acpi_handle *ret_handle) | ||
78 | { | 73 | { |
79 | acpi_status status; | 74 | acpi_status status; |
80 | struct acpi_namespace_node *node = NULL; | 75 | struct acpi_namespace_node *node = NULL; |
81 | struct acpi_namespace_node *prefix_node = NULL; | 76 | struct acpi_namespace_node *prefix_node = NULL; |
82 | |||
83 | |||
84 | ACPI_FUNCTION_ENTRY (); | ||
85 | 77 | ||
78 | ACPI_FUNCTION_ENTRY(); | ||
86 | 79 | ||
87 | /* Parameter Validation */ | 80 | /* Parameter Validation */ |
88 | 81 | ||
@@ -93,45 +86,47 @@ acpi_get_handle ( | |||
93 | /* Convert a parent handle to a prefix node */ | 86 | /* Convert a parent handle to a prefix node */ |
94 | 87 | ||
95 | if (parent) { | 88 | if (parent) { |
96 | status = acpi_ut_acquire_mutex (ACPI_MTX_NAMESPACE); | 89 | status = acpi_ut_acquire_mutex(ACPI_MTX_NAMESPACE); |
97 | if (ACPI_FAILURE (status)) { | 90 | if (ACPI_FAILURE(status)) { |
98 | return (status); | 91 | return (status); |
99 | } | 92 | } |
100 | 93 | ||
101 | prefix_node = acpi_ns_map_handle_to_node (parent); | 94 | prefix_node = acpi_ns_map_handle_to_node(parent); |
102 | if (!prefix_node) { | 95 | if (!prefix_node) { |
103 | (void) acpi_ut_release_mutex (ACPI_MTX_NAMESPACE); | 96 | (void)acpi_ut_release_mutex(ACPI_MTX_NAMESPACE); |
104 | return (AE_BAD_PARAMETER); | 97 | return (AE_BAD_PARAMETER); |
105 | } | 98 | } |
106 | 99 | ||
107 | status = acpi_ut_release_mutex (ACPI_MTX_NAMESPACE); | 100 | status = acpi_ut_release_mutex(ACPI_MTX_NAMESPACE); |
108 | if (ACPI_FAILURE (status)) { | 101 | if (ACPI_FAILURE(status)) { |
109 | return (status); | 102 | return (status); |
110 | } | 103 | } |
111 | } | 104 | } |
112 | 105 | ||
113 | /* Special case for root, since we can't search for it */ | 106 | /* Special case for root, since we can't search for it */ |
114 | 107 | ||
115 | if (ACPI_STRCMP (pathname, ACPI_NS_ROOT_PATH) == 0) { | 108 | if (ACPI_STRCMP(pathname, ACPI_NS_ROOT_PATH) == 0) { |
116 | *ret_handle = acpi_ns_convert_entry_to_handle (acpi_gbl_root_node); | 109 | *ret_handle = |
110 | acpi_ns_convert_entry_to_handle(acpi_gbl_root_node); | ||
117 | return (AE_OK); | 111 | return (AE_OK); |
118 | } | 112 | } |
119 | 113 | ||
120 | /* | 114 | /* |
121 | * Find the Node and convert to a handle | 115 | * Find the Node and convert to a handle |
122 | */ | 116 | */ |
123 | status = acpi_ns_get_node_by_path (pathname, prefix_node, ACPI_NS_NO_UPSEARCH, | 117 | status = |
124 | &node); | 118 | acpi_ns_get_node_by_path(pathname, prefix_node, ACPI_NS_NO_UPSEARCH, |
119 | &node); | ||
125 | 120 | ||
126 | *ret_handle = NULL; | 121 | *ret_handle = NULL; |
127 | if (ACPI_SUCCESS (status)) { | 122 | if (ACPI_SUCCESS(status)) { |
128 | *ret_handle = acpi_ns_convert_entry_to_handle (node); | 123 | *ret_handle = acpi_ns_convert_entry_to_handle(node); |
129 | } | 124 | } |
130 | 125 | ||
131 | return (status); | 126 | return (status); |
132 | } | 127 | } |
133 | EXPORT_SYMBOL(acpi_get_handle); | ||
134 | 128 | ||
129 | EXPORT_SYMBOL(acpi_get_handle); | ||
135 | 130 | ||
136 | /****************************************************************************** | 131 | /****************************************************************************** |
137 | * | 132 | * |
@@ -150,14 +145,10 @@ EXPORT_SYMBOL(acpi_get_handle); | |||
150 | ******************************************************************************/ | 145 | ******************************************************************************/ |
151 | 146 | ||
152 | acpi_status | 147 | acpi_status |
153 | acpi_get_name ( | 148 | acpi_get_name(acpi_handle handle, u32 name_type, struct acpi_buffer * buffer) |
154 | acpi_handle handle, | ||
155 | u32 name_type, | ||
156 | struct acpi_buffer *buffer) | ||
157 | { | 149 | { |
158 | acpi_status status; | 150 | acpi_status status; |
159 | struct acpi_namespace_node *node; | 151 | struct acpi_namespace_node *node; |
160 | |||
161 | 152 | ||
162 | /* Parameter validation */ | 153 | /* Parameter validation */ |
163 | 154 | ||
@@ -165,15 +156,15 @@ acpi_get_name ( | |||
165 | return (AE_BAD_PARAMETER); | 156 | return (AE_BAD_PARAMETER); |
166 | } | 157 | } |
167 | 158 | ||
168 | status = acpi_ut_validate_buffer (buffer); | 159 | status = acpi_ut_validate_buffer(buffer); |
169 | if (ACPI_FAILURE (status)) { | 160 | if (ACPI_FAILURE(status)) { |
170 | return (status); | 161 | return (status); |
171 | } | 162 | } |
172 | 163 | ||
173 | if (name_type == ACPI_FULL_PATHNAME) { | 164 | if (name_type == ACPI_FULL_PATHNAME) { |
174 | /* Get the full pathname (From the namespace root) */ | 165 | /* Get the full pathname (From the namespace root) */ |
175 | 166 | ||
176 | status = acpi_ns_handle_to_pathname (handle, buffer); | 167 | status = acpi_ns_handle_to_pathname(handle, buffer); |
177 | return (status); | 168 | return (status); |
178 | } | 169 | } |
179 | 170 | ||
@@ -181,12 +172,12 @@ acpi_get_name ( | |||
181 | * Wants the single segment ACPI name. | 172 | * Wants the single segment ACPI name. |
182 | * Validate handle and convert to a namespace Node | 173 | * Validate handle and convert to a namespace Node |
183 | */ | 174 | */ |
184 | status = acpi_ut_acquire_mutex (ACPI_MTX_NAMESPACE); | 175 | status = acpi_ut_acquire_mutex(ACPI_MTX_NAMESPACE); |
185 | if (ACPI_FAILURE (status)) { | 176 | if (ACPI_FAILURE(status)) { |
186 | return (status); | 177 | return (status); |
187 | } | 178 | } |
188 | 179 | ||
189 | node = acpi_ns_map_handle_to_node (handle); | 180 | node = acpi_ns_map_handle_to_node(handle); |
190 | if (!node) { | 181 | if (!node) { |
191 | status = AE_BAD_PARAMETER; | 182 | status = AE_BAD_PARAMETER; |
192 | goto unlock_and_exit; | 183 | goto unlock_and_exit; |
@@ -194,26 +185,25 @@ acpi_get_name ( | |||
194 | 185 | ||
195 | /* Validate/Allocate/Clear caller buffer */ | 186 | /* Validate/Allocate/Clear caller buffer */ |
196 | 187 | ||
197 | status = acpi_ut_initialize_buffer (buffer, ACPI_PATH_SEGMENT_LENGTH); | 188 | status = acpi_ut_initialize_buffer(buffer, ACPI_PATH_SEGMENT_LENGTH); |
198 | if (ACPI_FAILURE (status)) { | 189 | if (ACPI_FAILURE(status)) { |
199 | goto unlock_and_exit; | 190 | goto unlock_and_exit; |
200 | } | 191 | } |
201 | 192 | ||
202 | /* Just copy the ACPI name from the Node and zero terminate it */ | 193 | /* Just copy the ACPI name from the Node and zero terminate it */ |
203 | 194 | ||
204 | ACPI_STRNCPY (buffer->pointer, acpi_ut_get_node_name (node), | 195 | ACPI_STRNCPY(buffer->pointer, acpi_ut_get_node_name(node), |
205 | ACPI_NAME_SIZE); | 196 | ACPI_NAME_SIZE); |
206 | ((char *) buffer->pointer) [ACPI_NAME_SIZE] = 0; | 197 | ((char *)buffer->pointer)[ACPI_NAME_SIZE] = 0; |
207 | status = AE_OK; | 198 | status = AE_OK; |
208 | 199 | ||
200 | unlock_and_exit: | ||
209 | 201 | ||
210 | unlock_and_exit: | 202 | (void)acpi_ut_release_mutex(ACPI_MTX_NAMESPACE); |
211 | |||
212 | (void) acpi_ut_release_mutex (ACPI_MTX_NAMESPACE); | ||
213 | return (status); | 203 | return (status); |
214 | } | 204 | } |
215 | EXPORT_SYMBOL(acpi_get_name); | ||
216 | 205 | ||
206 | EXPORT_SYMBOL(acpi_get_name); | ||
217 | 207 | ||
218 | /****************************************************************************** | 208 | /****************************************************************************** |
219 | * | 209 | * |
@@ -231,17 +221,14 @@ EXPORT_SYMBOL(acpi_get_name); | |||
231 | ******************************************************************************/ | 221 | ******************************************************************************/ |
232 | 222 | ||
233 | acpi_status | 223 | acpi_status |
234 | acpi_get_object_info ( | 224 | acpi_get_object_info(acpi_handle handle, struct acpi_buffer * buffer) |
235 | acpi_handle handle, | ||
236 | struct acpi_buffer *buffer) | ||
237 | { | 225 | { |
238 | acpi_status status; | 226 | acpi_status status; |
239 | struct acpi_namespace_node *node; | 227 | struct acpi_namespace_node *node; |
240 | struct acpi_device_info *info; | 228 | struct acpi_device_info *info; |
241 | struct acpi_device_info *return_info; | 229 | struct acpi_device_info *return_info; |
242 | struct acpi_compatible_id_list *cid_list = NULL; | 230 | struct acpi_compatible_id_list *cid_list = NULL; |
243 | acpi_size size; | 231 | acpi_size size; |
244 | |||
245 | 232 | ||
246 | /* Parameter validation */ | 233 | /* Parameter validation */ |
247 | 234 | ||
@@ -249,37 +236,37 @@ acpi_get_object_info ( | |||
249 | return (AE_BAD_PARAMETER); | 236 | return (AE_BAD_PARAMETER); |
250 | } | 237 | } |
251 | 238 | ||
252 | status = acpi_ut_validate_buffer (buffer); | 239 | status = acpi_ut_validate_buffer(buffer); |
253 | if (ACPI_FAILURE (status)) { | 240 | if (ACPI_FAILURE(status)) { |
254 | return (status); | 241 | return (status); |
255 | } | 242 | } |
256 | 243 | ||
257 | info = ACPI_MEM_CALLOCATE (sizeof (struct acpi_device_info)); | 244 | info = ACPI_MEM_CALLOCATE(sizeof(struct acpi_device_info)); |
258 | if (!info) { | 245 | if (!info) { |
259 | return (AE_NO_MEMORY); | 246 | return (AE_NO_MEMORY); |
260 | } | 247 | } |
261 | 248 | ||
262 | status = acpi_ut_acquire_mutex (ACPI_MTX_NAMESPACE); | 249 | status = acpi_ut_acquire_mutex(ACPI_MTX_NAMESPACE); |
263 | if (ACPI_FAILURE (status)) { | 250 | if (ACPI_FAILURE(status)) { |
264 | goto cleanup; | 251 | goto cleanup; |
265 | } | 252 | } |
266 | 253 | ||
267 | node = acpi_ns_map_handle_to_node (handle); | 254 | node = acpi_ns_map_handle_to_node(handle); |
268 | if (!node) { | 255 | if (!node) { |
269 | (void) acpi_ut_release_mutex (ACPI_MTX_NAMESPACE); | 256 | (void)acpi_ut_release_mutex(ACPI_MTX_NAMESPACE); |
270 | goto cleanup; | 257 | goto cleanup; |
271 | } | 258 | } |
272 | 259 | ||
273 | /* Init return structure */ | 260 | /* Init return structure */ |
274 | 261 | ||
275 | size = sizeof (struct acpi_device_info); | 262 | size = sizeof(struct acpi_device_info); |
276 | 263 | ||
277 | info->type = node->type; | 264 | info->type = node->type; |
278 | info->name = node->name.integer; | 265 | info->name = node->name.integer; |
279 | info->valid = 0; | 266 | info->valid = 0; |
280 | 267 | ||
281 | status = acpi_ut_release_mutex (ACPI_MTX_NAMESPACE); | 268 | status = acpi_ut_release_mutex(ACPI_MTX_NAMESPACE); |
282 | if (ACPI_FAILURE (status)) { | 269 | if (ACPI_FAILURE(status)) { |
283 | goto cleanup; | 270 | goto cleanup; |
284 | } | 271 | } |
285 | 272 | ||
@@ -297,73 +284,73 @@ acpi_get_object_info ( | |||
297 | 284 | ||
298 | /* Execute the Device._HID method */ | 285 | /* Execute the Device._HID method */ |
299 | 286 | ||
300 | status = acpi_ut_execute_HID (node, &info->hardware_id); | 287 | status = acpi_ut_execute_HID(node, &info->hardware_id); |
301 | if (ACPI_SUCCESS (status)) { | 288 | if (ACPI_SUCCESS(status)) { |
302 | info->valid |= ACPI_VALID_HID; | 289 | info->valid |= ACPI_VALID_HID; |
303 | } | 290 | } |
304 | 291 | ||
305 | /* Execute the Device._UID method */ | 292 | /* Execute the Device._UID method */ |
306 | 293 | ||
307 | status = acpi_ut_execute_UID (node, &info->unique_id); | 294 | status = acpi_ut_execute_UID(node, &info->unique_id); |
308 | if (ACPI_SUCCESS (status)) { | 295 | if (ACPI_SUCCESS(status)) { |
309 | info->valid |= ACPI_VALID_UID; | 296 | info->valid |= ACPI_VALID_UID; |
310 | } | 297 | } |
311 | 298 | ||
312 | /* Execute the Device._CID method */ | 299 | /* Execute the Device._CID method */ |
313 | 300 | ||
314 | status = acpi_ut_execute_CID (node, &cid_list); | 301 | status = acpi_ut_execute_CID(node, &cid_list); |
315 | if (ACPI_SUCCESS (status)) { | 302 | if (ACPI_SUCCESS(status)) { |
316 | size += ((acpi_size) cid_list->count - 1) * | 303 | size += ((acpi_size) cid_list->count - 1) * |
317 | sizeof (struct acpi_compatible_id); | 304 | sizeof(struct acpi_compatible_id); |
318 | info->valid |= ACPI_VALID_CID; | 305 | info->valid |= ACPI_VALID_CID; |
319 | } | 306 | } |
320 | 307 | ||
321 | /* Execute the Device._STA method */ | 308 | /* Execute the Device._STA method */ |
322 | 309 | ||
323 | status = acpi_ut_execute_STA (node, &info->current_status); | 310 | status = acpi_ut_execute_STA(node, &info->current_status); |
324 | if (ACPI_SUCCESS (status)) { | 311 | if (ACPI_SUCCESS(status)) { |
325 | info->valid |= ACPI_VALID_STA; | 312 | info->valid |= ACPI_VALID_STA; |
326 | } | 313 | } |
327 | 314 | ||
328 | /* Execute the Device._ADR method */ | 315 | /* Execute the Device._ADR method */ |
329 | 316 | ||
330 | status = acpi_ut_evaluate_numeric_object (METHOD_NAME__ADR, node, | 317 | status = acpi_ut_evaluate_numeric_object(METHOD_NAME__ADR, node, |
331 | &info->address); | 318 | &info->address); |
332 | if (ACPI_SUCCESS (status)) { | 319 | if (ACPI_SUCCESS(status)) { |
333 | info->valid |= ACPI_VALID_ADR; | 320 | info->valid |= ACPI_VALID_ADR; |
334 | } | 321 | } |
335 | 322 | ||
336 | /* Execute the Device._sx_d methods */ | 323 | /* Execute the Device._sx_d methods */ |
337 | 324 | ||
338 | status = acpi_ut_execute_sxds (node, info->highest_dstates); | 325 | status = acpi_ut_execute_sxds(node, info->highest_dstates); |
339 | if (ACPI_SUCCESS (status)) { | 326 | if (ACPI_SUCCESS(status)) { |
340 | info->valid |= ACPI_VALID_SXDS; | 327 | info->valid |= ACPI_VALID_SXDS; |
341 | } | 328 | } |
342 | } | 329 | } |
343 | 330 | ||
344 | /* Validate/Allocate/Clear caller buffer */ | 331 | /* Validate/Allocate/Clear caller buffer */ |
345 | 332 | ||
346 | status = acpi_ut_initialize_buffer (buffer, size); | 333 | status = acpi_ut_initialize_buffer(buffer, size); |
347 | if (ACPI_FAILURE (status)) { | 334 | if (ACPI_FAILURE(status)) { |
348 | goto cleanup; | 335 | goto cleanup; |
349 | } | 336 | } |
350 | 337 | ||
351 | /* Populate the return buffer */ | 338 | /* Populate the return buffer */ |
352 | 339 | ||
353 | return_info = buffer->pointer; | 340 | return_info = buffer->pointer; |
354 | ACPI_MEMCPY (return_info, info, sizeof (struct acpi_device_info)); | 341 | ACPI_MEMCPY(return_info, info, sizeof(struct acpi_device_info)); |
355 | 342 | ||
356 | if (cid_list) { | 343 | if (cid_list) { |
357 | ACPI_MEMCPY (&return_info->compatibility_id, cid_list, cid_list->size); | 344 | ACPI_MEMCPY(&return_info->compatibility_id, cid_list, |
345 | cid_list->size); | ||
358 | } | 346 | } |
359 | 347 | ||
360 | 348 | cleanup: | |
361 | cleanup: | 349 | ACPI_MEM_FREE(info); |
362 | ACPI_MEM_FREE (info); | ||
363 | if (cid_list) { | 350 | if (cid_list) { |
364 | ACPI_MEM_FREE (cid_list); | 351 | ACPI_MEM_FREE(cid_list); |
365 | } | 352 | } |
366 | return (status); | 353 | return (status); |
367 | } | 354 | } |
368 | EXPORT_SYMBOL(acpi_get_object_info); | ||
369 | 355 | ||
356 | EXPORT_SYMBOL(acpi_get_object_info); | ||
diff --git a/drivers/acpi/namespace/nsxfobj.c b/drivers/acpi/namespace/nsxfobj.c index 363e1f6cfb18..0856d42e6909 100644 --- a/drivers/acpi/namespace/nsxfobj.c +++ b/drivers/acpi/namespace/nsxfobj.c | |||
@@ -47,9 +47,8 @@ | |||
47 | #include <acpi/acpi.h> | 47 | #include <acpi/acpi.h> |
48 | #include <acpi/acnamesp.h> | 48 | #include <acpi/acnamesp.h> |
49 | 49 | ||
50 | |||
51 | #define _COMPONENT ACPI_NAMESPACE | 50 | #define _COMPONENT ACPI_NAMESPACE |
52 | ACPI_MODULE_NAME ("nsxfobj") | 51 | ACPI_MODULE_NAME("nsxfobj") |
53 | 52 | ||
54 | /******************************************************************************* | 53 | /******************************************************************************* |
55 | * | 54 | * |
@@ -63,15 +62,10 @@ | |||
63 | * DESCRIPTION: This routine returns the type associatd with a particular handle | 62 | * DESCRIPTION: This routine returns the type associatd with a particular handle |
64 | * | 63 | * |
65 | ******************************************************************************/ | 64 | ******************************************************************************/ |
66 | 65 | acpi_status acpi_get_type(acpi_handle handle, acpi_object_type * ret_type) | |
67 | acpi_status | ||
68 | acpi_get_type ( | ||
69 | acpi_handle handle, | ||
70 | acpi_object_type *ret_type) | ||
71 | { | 66 | { |
72 | struct acpi_namespace_node *node; | 67 | struct acpi_namespace_node *node; |
73 | acpi_status status; | 68 | acpi_status status; |
74 | |||
75 | 69 | ||
76 | /* Parameter Validation */ | 70 | /* Parameter Validation */ |
77 | 71 | ||
@@ -88,27 +82,26 @@ acpi_get_type ( | |||
88 | return (AE_OK); | 82 | return (AE_OK); |
89 | } | 83 | } |
90 | 84 | ||
91 | status = acpi_ut_acquire_mutex (ACPI_MTX_NAMESPACE); | 85 | status = acpi_ut_acquire_mutex(ACPI_MTX_NAMESPACE); |
92 | if (ACPI_FAILURE (status)) { | 86 | if (ACPI_FAILURE(status)) { |
93 | return (status); | 87 | return (status); |
94 | } | 88 | } |
95 | 89 | ||
96 | /* Convert and validate the handle */ | 90 | /* Convert and validate the handle */ |
97 | 91 | ||
98 | node = acpi_ns_map_handle_to_node (handle); | 92 | node = acpi_ns_map_handle_to_node(handle); |
99 | if (!node) { | 93 | if (!node) { |
100 | (void) acpi_ut_release_mutex (ACPI_MTX_NAMESPACE); | 94 | (void)acpi_ut_release_mutex(ACPI_MTX_NAMESPACE); |
101 | return (AE_BAD_PARAMETER); | 95 | return (AE_BAD_PARAMETER); |
102 | } | 96 | } |
103 | 97 | ||
104 | *ret_type = node->type; | 98 | *ret_type = node->type; |
105 | 99 | ||
106 | 100 | status = acpi_ut_release_mutex(ACPI_MTX_NAMESPACE); | |
107 | status = acpi_ut_release_mutex (ACPI_MTX_NAMESPACE); | ||
108 | return (status); | 101 | return (status); |
109 | } | 102 | } |
110 | EXPORT_SYMBOL(acpi_get_type); | ||
111 | 103 | ||
104 | EXPORT_SYMBOL(acpi_get_type); | ||
112 | 105 | ||
113 | /******************************************************************************* | 106 | /******************************************************************************* |
114 | * | 107 | * |
@@ -124,14 +117,10 @@ EXPORT_SYMBOL(acpi_get_type); | |||
124 | * | 117 | * |
125 | ******************************************************************************/ | 118 | ******************************************************************************/ |
126 | 119 | ||
127 | acpi_status | 120 | acpi_status acpi_get_parent(acpi_handle handle, acpi_handle * ret_handle) |
128 | acpi_get_parent ( | ||
129 | acpi_handle handle, | ||
130 | acpi_handle *ret_handle) | ||
131 | { | 121 | { |
132 | struct acpi_namespace_node *node; | 122 | struct acpi_namespace_node *node; |
133 | acpi_status status; | 123 | acpi_status status; |
134 | |||
135 | 124 | ||
136 | if (!ret_handle) { | 125 | if (!ret_handle) { |
137 | return (AE_BAD_PARAMETER); | 126 | return (AE_BAD_PARAMETER); |
@@ -143,14 +132,14 @@ acpi_get_parent ( | |||
143 | return (AE_NULL_ENTRY); | 132 | return (AE_NULL_ENTRY); |
144 | } | 133 | } |
145 | 134 | ||
146 | status = acpi_ut_acquire_mutex (ACPI_MTX_NAMESPACE); | 135 | status = acpi_ut_acquire_mutex(ACPI_MTX_NAMESPACE); |
147 | if (ACPI_FAILURE (status)) { | 136 | if (ACPI_FAILURE(status)) { |
148 | return (status); | 137 | return (status); |
149 | } | 138 | } |
150 | 139 | ||
151 | /* Convert and validate the handle */ | 140 | /* Convert and validate the handle */ |
152 | 141 | ||
153 | node = acpi_ns_map_handle_to_node (handle); | 142 | node = acpi_ns_map_handle_to_node(handle); |
154 | if (!node) { | 143 | if (!node) { |
155 | status = AE_BAD_PARAMETER; | 144 | status = AE_BAD_PARAMETER; |
156 | goto unlock_and_exit; | 145 | goto unlock_and_exit; |
@@ -159,22 +148,21 @@ acpi_get_parent ( | |||
159 | /* Get the parent entry */ | 148 | /* Get the parent entry */ |
160 | 149 | ||
161 | *ret_handle = | 150 | *ret_handle = |
162 | acpi_ns_convert_entry_to_handle (acpi_ns_get_parent_node (node)); | 151 | acpi_ns_convert_entry_to_handle(acpi_ns_get_parent_node(node)); |
163 | 152 | ||
164 | /* Return exception if parent is null */ | 153 | /* Return exception if parent is null */ |
165 | 154 | ||
166 | if (!acpi_ns_get_parent_node (node)) { | 155 | if (!acpi_ns_get_parent_node(node)) { |
167 | status = AE_NULL_ENTRY; | 156 | status = AE_NULL_ENTRY; |
168 | } | 157 | } |
169 | 158 | ||
159 | unlock_and_exit: | ||
170 | 160 | ||
171 | unlock_and_exit: | 161 | (void)acpi_ut_release_mutex(ACPI_MTX_NAMESPACE); |
172 | |||
173 | (void) acpi_ut_release_mutex (ACPI_MTX_NAMESPACE); | ||
174 | return (status); | 162 | return (status); |
175 | } | 163 | } |
176 | EXPORT_SYMBOL(acpi_get_parent); | ||
177 | 164 | ||
165 | EXPORT_SYMBOL(acpi_get_parent); | ||
178 | 166 | ||
179 | /******************************************************************************* | 167 | /******************************************************************************* |
180 | * | 168 | * |
@@ -195,17 +183,14 @@ EXPORT_SYMBOL(acpi_get_parent); | |||
195 | ******************************************************************************/ | 183 | ******************************************************************************/ |
196 | 184 | ||
197 | acpi_status | 185 | acpi_status |
198 | acpi_get_next_object ( | 186 | acpi_get_next_object(acpi_object_type type, |
199 | acpi_object_type type, | 187 | acpi_handle parent, |
200 | acpi_handle parent, | 188 | acpi_handle child, acpi_handle * ret_handle) |
201 | acpi_handle child, | ||
202 | acpi_handle *ret_handle) | ||
203 | { | 189 | { |
204 | acpi_status status; | 190 | acpi_status status; |
205 | struct acpi_namespace_node *node; | 191 | struct acpi_namespace_node *node; |
206 | struct acpi_namespace_node *parent_node = NULL; | 192 | struct acpi_namespace_node *parent_node = NULL; |
207 | struct acpi_namespace_node *child_node = NULL; | 193 | struct acpi_namespace_node *child_node = NULL; |
208 | |||
209 | 194 | ||
210 | /* Parameter validation */ | 195 | /* Parameter validation */ |
211 | 196 | ||
@@ -213,8 +198,8 @@ acpi_get_next_object ( | |||
213 | return (AE_BAD_PARAMETER); | 198 | return (AE_BAD_PARAMETER); |
214 | } | 199 | } |
215 | 200 | ||
216 | status = acpi_ut_acquire_mutex (ACPI_MTX_NAMESPACE); | 201 | status = acpi_ut_acquire_mutex(ACPI_MTX_NAMESPACE); |
217 | if (ACPI_FAILURE (status)) { | 202 | if (ACPI_FAILURE(status)) { |
218 | return (status); | 203 | return (status); |
219 | } | 204 | } |
220 | 205 | ||
@@ -223,17 +208,16 @@ acpi_get_next_object ( | |||
223 | if (!child) { | 208 | if (!child) { |
224 | /* Start search at the beginning of the specified scope */ | 209 | /* Start search at the beginning of the specified scope */ |
225 | 210 | ||
226 | parent_node = acpi_ns_map_handle_to_node (parent); | 211 | parent_node = acpi_ns_map_handle_to_node(parent); |
227 | if (!parent_node) { | 212 | if (!parent_node) { |
228 | status = AE_BAD_PARAMETER; | 213 | status = AE_BAD_PARAMETER; |
229 | goto unlock_and_exit; | 214 | goto unlock_and_exit; |
230 | } | 215 | } |
231 | } | 216 | } else { |
232 | else { | ||
233 | /* Non-null handle, ignore the parent */ | 217 | /* Non-null handle, ignore the parent */ |
234 | /* Convert and validate the handle */ | 218 | /* Convert and validate the handle */ |
235 | 219 | ||
236 | child_node = acpi_ns_map_handle_to_node (child); | 220 | child_node = acpi_ns_map_handle_to_node(child); |
237 | if (!child_node) { | 221 | if (!child_node) { |
238 | status = AE_BAD_PARAMETER; | 222 | status = AE_BAD_PARAMETER; |
239 | goto unlock_and_exit; | 223 | goto unlock_and_exit; |
@@ -242,20 +226,19 @@ acpi_get_next_object ( | |||
242 | 226 | ||
243 | /* Internal function does the real work */ | 227 | /* Internal function does the real work */ |
244 | 228 | ||
245 | node = acpi_ns_get_next_node (type, parent_node, child_node); | 229 | node = acpi_ns_get_next_node(type, parent_node, child_node); |
246 | if (!node) { | 230 | if (!node) { |
247 | status = AE_NOT_FOUND; | 231 | status = AE_NOT_FOUND; |
248 | goto unlock_and_exit; | 232 | goto unlock_and_exit; |
249 | } | 233 | } |
250 | 234 | ||
251 | if (ret_handle) { | 235 | if (ret_handle) { |
252 | *ret_handle = acpi_ns_convert_entry_to_handle (node); | 236 | *ret_handle = acpi_ns_convert_entry_to_handle(node); |
253 | } | 237 | } |
254 | 238 | ||
239 | unlock_and_exit: | ||
255 | 240 | ||
256 | unlock_and_exit: | 241 | (void)acpi_ut_release_mutex(ACPI_MTX_NAMESPACE); |
257 | |||
258 | (void) acpi_ut_release_mutex (ACPI_MTX_NAMESPACE); | ||
259 | return (status); | 242 | return (status); |
260 | } | 243 | } |
261 | 244 | ||