[ACPI] ACPICA 20060210
[pandora-kernel.git] / drivers / acpi / namespace / nsxfeval.c
1 /*******************************************************************************
2  *
3  * Module Name: nsxfeval - Public interfaces to the ACPI subsystem
4  *                         ACPI Object evaluation interfaces
5  *
6  ******************************************************************************/
7
8 /*
9  * Copyright (C) 2000 - 2006, R. Byron Moore
10  * All rights reserved.
11  *
12  * Redistribution and use in source and binary forms, with or without
13  * modification, are permitted provided that the following conditions
14  * are met:
15  * 1. Redistributions of source code must retain the above copyright
16  *    notice, this list of conditions, and the following disclaimer,
17  *    without modification.
18  * 2. Redistributions in binary form must reproduce at minimum a disclaimer
19  *    substantially similar to the "NO WARRANTY" disclaimer below
20  *    ("Disclaimer") and any redistribution must be conditioned upon
21  *    including a substantially similar Disclaimer requirement for further
22  *    binary redistribution.
23  * 3. Neither the names of the above-listed copyright holders nor the names
24  *    of any contributors may be used to endorse or promote products derived
25  *    from this software without specific prior written permission.
26  *
27  * Alternatively, this software may be distributed under the terms of the
28  * GNU General Public License ("GPL") version 2 as published by the Free
29  * Software Foundation.
30  *
31  * NO WARRANTY
32  * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
33  * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
34  * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR
35  * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
36  * HOLDERS OR CONTRIBUTORS BE LIABLE FOR SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
37  * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
38  * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
39  * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
40  * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING
41  * IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
42  * POSSIBILITY OF SUCH DAMAGES.
43  */
44
45 #include <linux/module.h>
46
47 #include <acpi/acpi.h>
48 #include <acpi/acnamesp.h>
49 #include <acpi/acinterp.h>
50
51 #define _COMPONENT          ACPI_NAMESPACE
52 ACPI_MODULE_NAME("nsxfeval")
53
54 /*******************************************************************************
55  *
56  * FUNCTION:    acpi_evaluate_object_typed
57  *
58  * PARAMETERS:  Handle              - Object handle (optional)
59  *              Pathname            - Object pathname (optional)
60  *              external_params     - List of parameters to pass to method,
61  *                                    terminated by NULL.  May be NULL
62  *                                    if no parameters are being passed.
63  *              return_buffer       - Where to put method's return value (if
64  *                                    any).  If NULL, no value is returned.
65  *              return_type         - Expected type of return object
66  *
67  * RETURN:      Status
68  *
69  * DESCRIPTION: Find and evaluate the given object, passing the given
70  *              parameters if necessary.  One of "Handle" or "Pathname" must
71  *              be valid (non-null)
72  *
73  ******************************************************************************/
74 #ifdef ACPI_FUTURE_USAGE
75 acpi_status
76 acpi_evaluate_object_typed(acpi_handle handle,
77                            acpi_string pathname,
78                            struct acpi_object_list *external_params,
79                            struct acpi_buffer *return_buffer,
80                            acpi_object_type return_type)
81 {
82         acpi_status status;
83         u8 must_free = FALSE;
84
85         ACPI_FUNCTION_TRACE("acpi_evaluate_object_typed");
86
87         /* Return buffer must be valid */
88
89         if (!return_buffer) {
90                 return_ACPI_STATUS(AE_BAD_PARAMETER);
91         }
92
93         if (return_buffer->length == ACPI_ALLOCATE_BUFFER) {
94                 must_free = TRUE;
95         }
96
97         /* Evaluate the object */
98
99         status =
100             acpi_evaluate_object(handle, pathname, external_params,
101                                  return_buffer);
102         if (ACPI_FAILURE(status)) {
103                 return_ACPI_STATUS(status);
104         }
105
106         /* Type ANY means "don't care" */
107
108         if (return_type == ACPI_TYPE_ANY) {
109                 return_ACPI_STATUS(AE_OK);
110         }
111
112         if (return_buffer->length == 0) {
113
114                 /* Error because caller specifically asked for a return value */
115
116                 ACPI_ERROR((AE_INFO, "No return value"));
117                 return_ACPI_STATUS(AE_NULL_OBJECT);
118         }
119
120         /* Examine the object type returned from evaluate_object */
121
122         if (((union acpi_object *)return_buffer->pointer)->type == return_type) {
123                 return_ACPI_STATUS(AE_OK);
124         }
125
126         /* Return object type does not match requested type */
127
128         ACPI_ERROR((AE_INFO,
129                     "Incorrect return type [%s] requested [%s]",
130                     acpi_ut_get_type_name(((union acpi_object *)return_buffer->
131                                            pointer)->type),
132                     acpi_ut_get_type_name(return_type)));
133
134         if (must_free) {
135
136                 /* Caller used ACPI_ALLOCATE_BUFFER, free the return buffer */
137
138                 acpi_os_free(return_buffer->pointer);
139                 return_buffer->pointer = NULL;
140         }
141
142         return_buffer->length = 0;
143         return_ACPI_STATUS(AE_TYPE);
144 }
145 #endif                          /*  ACPI_FUTURE_USAGE  */
146
147 /*******************************************************************************
148  *
149  * FUNCTION:    acpi_evaluate_object
150  *
151  * PARAMETERS:  Handle              - Object handle (optional)
152  *              Pathname            - Object pathname (optional)
153  *              external_params     - List of parameters to pass to method,
154  *                                    terminated by NULL.  May be NULL
155  *                                    if no parameters are being passed.
156  *              return_buffer       - Where to put method's return value (if
157  *                                    any).  If NULL, no value is returned.
158  *
159  * RETURN:      Status
160  *
161  * DESCRIPTION: Find and evaluate the given object, passing the given
162  *              parameters if necessary.  One of "Handle" or "Pathname" must
163  *              be valid (non-null)
164  *
165  ******************************************************************************/
166
167 acpi_status
168 acpi_evaluate_object(acpi_handle handle,
169                      acpi_string pathname,
170                      struct acpi_object_list *external_params,
171                      struct acpi_buffer *return_buffer)
172 {
173         acpi_status status;
174         acpi_status status2;
175         struct acpi_parameter_info info;
176         acpi_size buffer_space_needed;
177         u32 i;
178
179         ACPI_FUNCTION_TRACE("acpi_evaluate_object");
180
181         info.node = handle;
182         info.parameters = NULL;
183         info.return_object = NULL;
184         info.parameter_type = ACPI_PARAM_ARGS;
185
186         /*
187          * If there are parameters to be passed to the object
188          * (which must be a control method), the external objects
189          * must be converted to internal objects
190          */
191         if (external_params && external_params->count) {
192                 /*
193                  * Allocate a new parameter block for the internal objects
194                  * Add 1 to count to allow for null terminated internal list
195                  */
196                 info.parameters = ACPI_MEM_CALLOCATE(((acpi_size)
197                                                       external_params->count +
198                                                       1) * sizeof(void *));
199                 if (!info.parameters) {
200                         return_ACPI_STATUS(AE_NO_MEMORY);
201                 }
202
203                 /*
204                  * Convert each external object in the list to an
205                  * internal object
206                  */
207                 for (i = 0; i < external_params->count; i++) {
208                         status =
209                             acpi_ut_copy_eobject_to_iobject(&external_params->
210                                                             pointer[i],
211                                                             &info.
212                                                             parameters[i]);
213                         if (ACPI_FAILURE(status)) {
214                                 acpi_ut_delete_internal_object_list(info.
215                                                                     parameters);
216                                 return_ACPI_STATUS(status);
217                         }
218                 }
219                 info.parameters[external_params->count] = NULL;
220         }
221
222         /*
223          * Three major cases:
224          * 1) Fully qualified pathname
225          * 2) No handle, not fully qualified pathname (error)
226          * 3) Valid handle
227          */
228         if ((pathname) && (acpi_ns_valid_root_prefix(pathname[0]))) {
229
230                 /* The path is fully qualified, just evaluate by name */
231
232                 status = acpi_ns_evaluate_by_name(pathname, &info);
233         } else if (!handle) {
234                 /*
235                  * A handle is optional iff a fully qualified pathname
236                  * is specified.  Since we've already handled fully
237                  * qualified names above, this is an error
238                  */
239                 if (!pathname) {
240                         ACPI_DEBUG_PRINT((ACPI_DB_INFO,
241                                           "Both Handle and Pathname are NULL"));
242                 } else {
243                         ACPI_DEBUG_PRINT((ACPI_DB_INFO,
244                                           "Null Handle with relative pathname [%s]",
245                                           pathname));
246                 }
247
248                 status = AE_BAD_PARAMETER;
249         } else {
250                 /*
251                  * We get here if we have a handle -- and if we have a
252                  * pathname it is relative.  The handle will be validated
253                  * in the lower procedures
254                  */
255                 if (!pathname) {
256                         /*
257                          * The null pathname case means the handle is for
258                          * the actual object to be evaluated
259                          */
260                         status = acpi_ns_evaluate_by_handle(&info);
261                 } else {
262                         /* Both a Handle and a relative Pathname */
263
264                         status = acpi_ns_evaluate_relative(pathname, &info);
265                 }
266         }
267
268         /*
269          * If we are expecting a return value, and all went well above,
270          * copy the return value to an external object.
271          */
272         if (return_buffer) {
273                 if (!info.return_object) {
274                         return_buffer->length = 0;
275                 } else {
276                         if (ACPI_GET_DESCRIPTOR_TYPE(info.return_object) ==
277                             ACPI_DESC_TYPE_NAMED) {
278                                 /*
279                                  * If we received a NS Node as a return object, this means that
280                                  * the object we are evaluating has nothing interesting to
281                                  * return (such as a mutex, etc.)  We return an error because
282                                  * these types are essentially unsupported by this interface.
283                                  * We don't check up front because this makes it easier to add
284                                  * support for various types at a later date if necessary.
285                                  */
286                                 status = AE_TYPE;
287                                 info.return_object = NULL;      /* No need to delete a NS Node */
288                                 return_buffer->length = 0;
289                         }
290
291                         if (ACPI_SUCCESS(status)) {
292                                 /*
293                                  * Find out how large a buffer is needed
294                                  * to contain the returned object
295                                  */
296                                 status =
297                                     acpi_ut_get_object_size(info.return_object,
298                                                             &buffer_space_needed);
299                                 if (ACPI_SUCCESS(status)) {
300
301                                         /* Validate/Allocate/Clear caller buffer */
302
303                                         status =
304                                             acpi_ut_initialize_buffer
305                                             (return_buffer,
306                                              buffer_space_needed);
307                                         if (ACPI_FAILURE(status)) {
308                                                 /*
309                                                  * Caller's buffer is too small or a new one can't
310                                                  * be allocated
311                                                  */
312                                                 ACPI_DEBUG_PRINT((ACPI_DB_INFO,
313                                                                   "Needed buffer size %X, %s\n",
314                                                                   (u32)
315                                                                   buffer_space_needed,
316                                                                   acpi_format_exception
317                                                                   (status)));
318                                         } else {
319                                                 /* We have enough space for the object, build it */
320
321                                                 status =
322                                                     acpi_ut_copy_iobject_to_eobject
323                                                     (info.return_object,
324                                                      return_buffer);
325                                         }
326                                 }
327                         }
328                 }
329         }
330
331         if (info.return_object) {
332                 /*
333                  * Delete the internal return object.  NOTE: Interpreter
334                  * must be locked to avoid race condition.
335                  */
336                 status2 = acpi_ex_enter_interpreter();
337                 if (ACPI_SUCCESS(status2)) {
338                         /*
339                          * Delete the internal return object. (Or at least
340                          * decrement the reference count by one)
341                          */
342                         acpi_ut_remove_reference(info.return_object);
343                         acpi_ex_exit_interpreter();
344                 }
345         }
346
347         /* Free the input parameter list (if we created one) */
348
349         if (info.parameters) {
350
351                 /* Free the allocated parameter block */
352
353                 acpi_ut_delete_internal_object_list(info.parameters);
354         }
355
356         return_ACPI_STATUS(status);
357 }
358
359 EXPORT_SYMBOL(acpi_evaluate_object);
360
361 /*******************************************************************************
362  *
363  * FUNCTION:    acpi_walk_namespace
364  *
365  * PARAMETERS:  Type                - acpi_object_type to search for
366  *              start_object        - Handle in namespace where search begins
367  *              max_depth           - Depth to which search is to reach
368  *              user_function       - Called when an object of "Type" is found
369  *              Context             - Passed to user function
370  *              return_value        - Location where return value of
371  *                                    user_function is put if terminated early
372  *
373  * RETURNS      Return value from the user_function if terminated early.
374  *              Otherwise, returns NULL.
375  *
376  * DESCRIPTION: Performs a modified depth-first walk of the namespace tree,
377  *              starting (and ending) at the object specified by start_handle.
378  *              The user_function is called whenever an object that matches
379  *              the type parameter is found.  If the user function returns
380  *              a non-zero value, the search is terminated immediately and this
381  *              value is returned to the caller.
382  *
383  *              The point of this procedure is to provide a generic namespace
384  *              walk routine that can be called from multiple places to
385  *              provide multiple services;  the User Function can be tailored
386  *              to each task, whether it is a print function, a compare
387  *              function, etc.
388  *
389  ******************************************************************************/
390
391 acpi_status
392 acpi_walk_namespace(acpi_object_type type,
393                     acpi_handle start_object,
394                     u32 max_depth,
395                     acpi_walk_callback user_function,
396                     void *context, void **return_value)
397 {
398         acpi_status status;
399
400         ACPI_FUNCTION_TRACE("acpi_walk_namespace");
401
402         /* Parameter validation */
403
404         if ((type > ACPI_TYPE_LOCAL_MAX) || (!max_depth) || (!user_function)) {
405                 return_ACPI_STATUS(AE_BAD_PARAMETER);
406         }
407
408         /*
409          * Lock the namespace around the walk.
410          * The namespace will be unlocked/locked around each call
411          * to the user function - since this function
412          * must be allowed to make Acpi calls itself.
413          */
414         status = acpi_ut_acquire_mutex(ACPI_MTX_NAMESPACE);
415         if (ACPI_FAILURE(status)) {
416                 return_ACPI_STATUS(status);
417         }
418
419         status = acpi_ns_walk_namespace(type, start_object, max_depth,
420                                         ACPI_NS_WALK_UNLOCK,
421                                         user_function, context, return_value);
422
423         (void)acpi_ut_release_mutex(ACPI_MTX_NAMESPACE);
424         return_ACPI_STATUS(status);
425 }
426
427 EXPORT_SYMBOL(acpi_walk_namespace);
428
429 /*******************************************************************************
430  *
431  * FUNCTION:    acpi_ns_get_device_callback
432  *
433  * PARAMETERS:  Callback from acpi_get_device
434  *
435  * RETURN:      Status
436  *
437  * DESCRIPTION: Takes callbacks from walk_namespace and filters out all non-
438  *              present devices, or if they specified a HID, it filters based
439  *              on that.
440  *
441  ******************************************************************************/
442
443 static acpi_status
444 acpi_ns_get_device_callback(acpi_handle obj_handle,
445                             u32 nesting_level,
446                             void *context, void **return_value)
447 {
448         struct acpi_get_devices_info *info = context;
449         acpi_status status;
450         struct acpi_namespace_node *node;
451         u32 flags;
452         struct acpi_device_id hid;
453         struct acpi_compatible_id_list *cid;
454         acpi_native_uint i;
455
456         status = acpi_ut_acquire_mutex(ACPI_MTX_NAMESPACE);
457         if (ACPI_FAILURE(status)) {
458                 return (status);
459         }
460
461         node = acpi_ns_map_handle_to_node(obj_handle);
462         status = acpi_ut_release_mutex(ACPI_MTX_NAMESPACE);
463         if (ACPI_FAILURE(status)) {
464                 return (status);
465         }
466
467         if (!node) {
468                 return (AE_BAD_PARAMETER);
469         }
470
471         /* Run _STA to determine if device is present */
472
473         status = acpi_ut_execute_STA(node, &flags);
474         if (ACPI_FAILURE(status)) {
475                 return (AE_CTRL_DEPTH);
476         }
477
478         if (!(flags & ACPI_STA_DEVICE_PRESENT)) {
479
480                 /* Don't examine children of the device if not present */
481
482                 return (AE_CTRL_DEPTH);
483         }
484
485         /* Filter based on device HID & CID */
486
487         if (info->hid != NULL) {
488                 status = acpi_ut_execute_HID(node, &hid);
489                 if (status == AE_NOT_FOUND) {
490                         return (AE_OK);
491                 } else if (ACPI_FAILURE(status)) {
492                         return (AE_CTRL_DEPTH);
493                 }
494
495                 if (ACPI_STRNCMP(hid.value, info->hid, sizeof(hid.value)) != 0) {
496
497                         /* Get the list of Compatible IDs */
498
499                         status = acpi_ut_execute_CID(node, &cid);
500                         if (status == AE_NOT_FOUND) {
501                                 return (AE_OK);
502                         } else if (ACPI_FAILURE(status)) {
503                                 return (AE_CTRL_DEPTH);
504                         }
505
506                         /* Walk the CID list */
507
508                         for (i = 0; i < cid->count; i++) {
509                                 if (ACPI_STRNCMP(cid->id[i].value, info->hid,
510                                                  sizeof(struct
511                                                         acpi_compatible_id)) !=
512                                     0) {
513                                         ACPI_MEM_FREE(cid);
514                                         return (AE_OK);
515                                 }
516                         }
517                         ACPI_MEM_FREE(cid);
518                 }
519         }
520
521         status = info->user_function(obj_handle, nesting_level, info->context,
522                                      return_value);
523         return (status);
524 }
525
526 /*******************************************************************************
527  *
528  * FUNCTION:    acpi_get_devices
529  *
530  * PARAMETERS:  HID                 - HID to search for. Can be NULL.
531  *              user_function       - Called when a matching object is found
532  *              Context             - Passed to user function
533  *              return_value        - Location where return value of
534  *                                    user_function is put if terminated early
535  *
536  * RETURNS      Return value from the user_function if terminated early.
537  *              Otherwise, returns NULL.
538  *
539  * DESCRIPTION: Performs a modified depth-first walk of the namespace tree,
540  *              starting (and ending) at the object specified by start_handle.
541  *              The user_function is called whenever an object of type
542  *              Device is found.  If the user function returns
543  *              a non-zero value, the search is terminated immediately and this
544  *              value is returned to the caller.
545  *
546  *              This is a wrapper for walk_namespace, but the callback performs
547  *              additional filtering. Please see acpi_get_device_callback.
548  *
549  ******************************************************************************/
550
551 acpi_status
552 acpi_get_devices(char *HID,
553                  acpi_walk_callback user_function,
554                  void *context, void **return_value)
555 {
556         acpi_status status;
557         struct acpi_get_devices_info info;
558
559         ACPI_FUNCTION_TRACE("acpi_get_devices");
560
561         /* Parameter validation */
562
563         if (!user_function) {
564                 return_ACPI_STATUS(AE_BAD_PARAMETER);
565         }
566
567         /*
568          * We're going to call their callback from OUR callback, so we need
569          * to know what it is, and their context parameter.
570          */
571         info.hid = HID;
572         info.context = context;
573         info.user_function = user_function;
574
575         /*
576          * Lock the namespace around the walk.
577          * The namespace will be unlocked/locked around each call
578          * to the user function - since this function
579          * must be allowed to make Acpi calls itself.
580          */
581         status = acpi_ut_acquire_mutex(ACPI_MTX_NAMESPACE);
582         if (ACPI_FAILURE(status)) {
583                 return_ACPI_STATUS(status);
584         }
585
586         status = acpi_ns_walk_namespace(ACPI_TYPE_DEVICE, ACPI_ROOT_OBJECT,
587                                         ACPI_UINT32_MAX, ACPI_NS_WALK_UNLOCK,
588                                         acpi_ns_get_device_callback, &info,
589                                         return_value);
590
591         (void)acpi_ut_release_mutex(ACPI_MTX_NAMESPACE);
592         return_ACPI_STATUS(status);
593 }
594
595 EXPORT_SYMBOL(acpi_get_devices);
596
597 /*******************************************************************************
598  *
599  * FUNCTION:    acpi_attach_data
600  *
601  * PARAMETERS:  obj_handle          - Namespace node
602  *              Handler             - Handler for this attachment
603  *              Data                - Pointer to data to be attached
604  *
605  * RETURN:      Status
606  *
607  * DESCRIPTION: Attach arbitrary data and handler to a namespace node.
608  *
609  ******************************************************************************/
610
611 acpi_status
612 acpi_attach_data(acpi_handle obj_handle,
613                  acpi_object_handler handler, void *data)
614 {
615         struct acpi_namespace_node *node;
616         acpi_status status;
617
618         /* Parameter validation */
619
620         if (!obj_handle || !handler || !data) {
621                 return (AE_BAD_PARAMETER);
622         }
623
624         status = acpi_ut_acquire_mutex(ACPI_MTX_NAMESPACE);
625         if (ACPI_FAILURE(status)) {
626                 return (status);
627         }
628
629         /* Convert and validate the handle */
630
631         node = acpi_ns_map_handle_to_node(obj_handle);
632         if (!node) {
633                 status = AE_BAD_PARAMETER;
634                 goto unlock_and_exit;
635         }
636
637         status = acpi_ns_attach_data(node, handler, data);
638
639       unlock_and_exit:
640         (void)acpi_ut_release_mutex(ACPI_MTX_NAMESPACE);
641         return (status);
642 }
643
644 /*******************************************************************************
645  *
646  * FUNCTION:    acpi_detach_data
647  *
648  * PARAMETERS:  obj_handle          - Namespace node handle
649  *              Handler             - Handler used in call to acpi_attach_data
650  *
651  * RETURN:      Status
652  *
653  * DESCRIPTION: Remove data that was previously attached to a node.
654  *
655  ******************************************************************************/
656
657 acpi_status
658 acpi_detach_data(acpi_handle obj_handle, acpi_object_handler handler)
659 {
660         struct acpi_namespace_node *node;
661         acpi_status status;
662
663         /* Parameter validation */
664
665         if (!obj_handle || !handler) {
666                 return (AE_BAD_PARAMETER);
667         }
668
669         status = acpi_ut_acquire_mutex(ACPI_MTX_NAMESPACE);
670         if (ACPI_FAILURE(status)) {
671                 return (status);
672         }
673
674         /* Convert and validate the handle */
675
676         node = acpi_ns_map_handle_to_node(obj_handle);
677         if (!node) {
678                 status = AE_BAD_PARAMETER;
679                 goto unlock_and_exit;
680         }
681
682         status = acpi_ns_detach_data(node, handler);
683
684       unlock_and_exit:
685         (void)acpi_ut_release_mutex(ACPI_MTX_NAMESPACE);
686         return (status);
687 }
688
689 /*******************************************************************************
690  *
691  * FUNCTION:    acpi_get_data
692  *
693  * PARAMETERS:  obj_handle          - Namespace node
694  *              Handler             - Handler used in call to attach_data
695  *              Data                - Where the data is returned
696  *
697  * RETURN:      Status
698  *
699  * DESCRIPTION: Retrieve data that was previously attached to a namespace node.
700  *
701  ******************************************************************************/
702
703 acpi_status
704 acpi_get_data(acpi_handle obj_handle, acpi_object_handler handler, void **data)
705 {
706         struct acpi_namespace_node *node;
707         acpi_status status;
708
709         /* Parameter validation */
710
711         if (!obj_handle || !handler || !data) {
712                 return (AE_BAD_PARAMETER);
713         }
714
715         status = acpi_ut_acquire_mutex(ACPI_MTX_NAMESPACE);
716         if (ACPI_FAILURE(status)) {
717                 return (status);
718         }
719
720         /* Convert and validate the handle */
721
722         node = acpi_ns_map_handle_to_node(obj_handle);
723         if (!node) {
724                 status = AE_BAD_PARAMETER;
725                 goto unlock_and_exit;
726         }
727
728         status = acpi_ns_get_attached_data(node, handler, data);
729
730       unlock_and_exit:
731         (void)acpi_ut_release_mutex(ACPI_MTX_NAMESPACE);
732         return (status);
733 }