aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/acpi/namespace/nsxfeval.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/acpi/namespace/nsxfeval.c')
-rw-r--r--drivers/acpi/namespace/nsxfeval.c430
1 files changed, 196 insertions, 234 deletions
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") 52ACPI_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
78acpi_status 75acpi_status
79acpi_evaluate_object_typed ( 76acpi_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
171acpi_status 166acpi_status
172acpi_evaluate_object ( 167acpi_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}
361EXPORT_SYMBOL(acpi_evaluate_object);
362 356
357EXPORT_SYMBOL(acpi_evaluate_object);
363 358
364/******************************************************************************* 359/*******************************************************************************
365 * 360 *
@@ -392,26 +387,20 @@ EXPORT_SYMBOL(acpi_evaluate_object);
392 ******************************************************************************/ 387 ******************************************************************************/
393 388
394acpi_status 389acpi_status
395acpi_walk_namespace ( 390acpi_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}
435EXPORT_SYMBOL(acpi_walk_namespace);
436 424
425EXPORT_SYMBOL(acpi_walk_namespace);
437 426
438/******************************************************************************* 427/*******************************************************************************
439 * 428 *
@@ -450,29 +439,26 @@ EXPORT_SYMBOL(acpi_walk_namespace);
450 ******************************************************************************/ 439 ******************************************************************************/
451 440
452static acpi_status 441static acpi_status
453acpi_ns_get_device_callback ( 442acpi_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
562acpi_status 547acpi_status
563acpi_get_devices ( 548acpi_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}
610EXPORT_SYMBOL(acpi_get_devices);
611 591
592EXPORT_SYMBOL(acpi_get_devices);
612 593
613/******************************************************************************* 594/*******************************************************************************
614 * 595 *
@@ -625,44 +606,38 @@ EXPORT_SYMBOL(acpi_get_devices);
625 ******************************************************************************/ 606 ******************************************************************************/
626 607
627acpi_status 608acpi_status
628acpi_attach_data ( 609acpi_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
660unlock_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
679acpi_status 654acpi_status
680acpi_detach_data ( 655acpi_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
710unlock_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
730acpi_status 700acpi_status
731acpi_get_data ( 701acpi_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
763unlock_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