aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/acpi/namespace/nssearch.c
diff options
context:
space:
mode:
authorLen Brown <len.brown@intel.com>2005-08-05 00:44:28 -0400
committerLen Brown <len.brown@intel.com>2005-08-05 00:45:14 -0400
commit4be44fcd3bf648b782f4460fd06dfae6c42ded4b (patch)
tree5b5b7d296ea58786f53b95e5eac9565ff66890b0 /drivers/acpi/namespace/nssearch.c
parentc65ade4dc8b486e8c8b9b0a6399789a5428e2039 (diff)
[ACPI] Lindent all ACPI files
Signed-off-by: Len Brown <len.brown@intel.com>
Diffstat (limited to 'drivers/acpi/namespace/nssearch.c')
-rw-r--r--drivers/acpi/namespace/nssearch.c205
1 files changed, 98 insertions, 107 deletions
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") 48ACPI_MODULE_NAME("nssearch")
51 49
52/* Local prototypes */ 50/* Local prototypes */
53
54static acpi_status 51static acpi_status
55acpi_ns_search_parent_tree ( 52acpi_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
89acpi_status 84acpi_status
90acpi_ns_search_node ( 85acpi_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
196static acpi_status 194static acpi_status
197acpi_ns_search_parent_tree ( 195acpi_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
288acpi_status 284acpi_status
289acpi_ns_search_and_enter ( 285acpi_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