[ACPI] ACPICA 20060113
[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                 /* Error because caller specifically asked for a return value */
114
115                 ACPI_REPORT_ERROR(("No return value\n"));
116                 return_ACPI_STATUS(AE_NULL_OBJECT);
117         }
118
119         /* Examine the object type returned from evaluate_object */
120
121         if (((union acpi_object *)return_buffer->pointer)->type == return_type) {
122                 return_ACPI_STATUS(AE_OK);
123         }
124
125         /* Return object type does not match requested type */
126
127         ACPI_REPORT_ERROR(("Incorrect return type [%s] requested [%s]\n",
128                            acpi_ut_get_type_name(((union acpi_object *)
129                                                   return_buffer->pointer)->
130                                                  type),
131                            acpi_ut_get_type_name(return_type)));
132
133         if (must_free) {
134                 /* Caller used ACPI_ALLOCATE_BUFFER, free the return buffer */
135
136                 acpi_os_free(return_buffer->pointer);
137                 return_buffer->pointer = NULL;
138         }
139
140         return_buffer->length = 0;
141         return_ACPI_STATUS(AE_TYPE);
142 }
143 #endif                          /*  ACPI_FUTURE_USAGE  */
144
145 /*******************************************************************************
146  *
147  * FUNCTION:    acpi_evaluate_object
148  *
149  * PARAMETERS:  Handle              - Object handle (optional)
150  *              Pathname            - Object pathname (optional)
151  *              external_params     - List of parameters to pass to method,
152  *                                    terminated by NULL.  May be NULL
153  *                                    if no parameters are being passed.
154  *              return_buffer       - Where to put method's return value (if
155  *                                    any).  If NULL, no value is returned.
156  *
157  * RETURN:      Status
158  *
159  * DESCRIPTION: Find and evaluate the given object, passing the given
160  *              parameters if necessary.  One of "Handle" or "Pathname" must
161  *              be valid (non-null)
162  *
163  ******************************************************************************/
164
165 acpi_status
166 acpi_evaluate_object(acpi_handle handle,
167                      acpi_string pathname,
168                      struct acpi_object_list *external_params,
169                      struct acpi_buffer *return_buffer)
170 {
171         acpi_status status;
172         acpi_status status2;
173         struct acpi_parameter_info info;
174         acpi_size buffer_space_needed;
175         u32 i;
176
177         ACPI_FUNCTION_TRACE("acpi_evaluate_object");
178
179         info.node = handle;
180         info.parameters = NULL;
181         info.return_object = NULL;
182         info.parameter_type = ACPI_PARAM_ARGS;
183
184         /*
185          * If there are parameters to be passed to the object
186          * (which must be a control method), the external objects
187          * must be converted to internal objects
188          */
189         if (external_params && external_params->count) {
190                 /*
191                  * Allocate a new parameter block for the internal objects
192                  * Add 1 to count to allow for null terminated internal list
193                  */
194                 info.parameters = ACPI_MEM_CALLOCATE(((acpi_size)
195                                                       external_params->count +
196                                                       1) * sizeof(void *));
197                 if (!info.parameters) {
198                         return_ACPI_STATUS(AE_NO_MEMORY);
199                 }
200
201                 /*
202                  * Convert each external object in the list to an
203                  * internal object
204                  */
205                 for (i = 0; i < external_params->count; i++) {
206                         status =
207                             acpi_ut_copy_eobject_to_iobject(&external_params->
208                                                             pointer[i],
209                                                             &info.
210                                                             parameters[i]);
211                         if (ACPI_FAILURE(status)) {
212                                 acpi_ut_delete_internal_object_list(info.
213                                                                     parameters);
214                                 return_ACPI_STATUS(status);
215                         }
216                 }
217                 info.parameters[external_params->count] = NULL;
218         }
219
220         /*
221          * Three major cases:
222          * 1) Fully qualified pathname
223          * 2) No handle, not fully qualified pathname (error)
224          * 3) Valid handle
225          */
226         if ((pathname) && (acpi_ns_valid_root_prefix(pathname[0]))) {
227                 /*
228                  *  The path is fully qualified, just evaluate by name
229                  */
230                 status = acpi_ns_evaluate_by_name(pathname, &info);
231         } else if (!handle) {
232                 /*
233                  * A handle is optional iff a fully qualified pathname
234                  * is specified.  Since we've already handled fully
235                  * qualified names above, this is an error
236                  */
237                 if (!pathname) {
238                         ACPI_REPORT_ERROR(("Both Handle and Pathname are NULL\n"));
239                 } else {
240                         ACPI_REPORT_ERROR(("Handle is NULL and Pathname is relative\n"));
241                 }
242
243                 status = AE_BAD_PARAMETER;
244         } else {
245                 /*
246                  * We get here if we have a handle -- and if we have a
247                  * pathname it is relative.  The handle will be validated
248                  * in the lower procedures
249                  */
250                 if (!pathname) {
251                         /*
252                          * The null pathname case means the handle is for
253                          * the actual object to be evaluated
254                          */
255                         status = acpi_ns_evaluate_by_handle(&info);
256                 } else {
257                         /*
258                          * Both a Handle and a relative Pathname
259                          */
260                         status = acpi_ns_evaluate_relative(pathname, &info);
261                 }
262         }
263
264         /*
265          * If we are expecting a return value, and all went well above,
266          * copy the return value to an external object.
267          */
268         if (return_buffer) {
269                 if (!info.return_object) {
270                         return_buffer->length = 0;
271                 } else {
272                         if (ACPI_GET_DESCRIPTOR_TYPE(info.return_object) ==
273                             ACPI_DESC_TYPE_NAMED) {
274                                 /*
275                                  * If we received a NS Node as a return object, this means that
276                                  * the object we are evaluating has nothing interesting to
277                                  * return (such as a mutex, etc.)  We return an error because
278                                  * these types are essentially unsupported by this interface.
279                                  * We don't check up front because this makes it easier to add
280                                  * support for various types at a later date if necessary.
281                                  */
282                                 status = AE_TYPE;
283                                 info.return_object = NULL;      /* No need to delete a NS Node */
284                                 return_buffer->length = 0;
285                         }
286
287                         if (ACPI_SUCCESS(status)) {
288                                 /*
289                                  * Find out how large a buffer is needed
290                                  * to contain the returned object
291                                  */
292                                 status =
293                                     acpi_ut_get_object_size(info.return_object,
294                                                             &buffer_space_needed);
295                                 if (ACPI_SUCCESS(status)) {
296                                         /* Validate/Allocate/Clear caller buffer */
297
298                                         status =
299                                             acpi_ut_initialize_buffer
300                                             (return_buffer,
301                                              buffer_space_needed);
302                                         if (ACPI_FAILURE(status)) {
303                                                 /*
304                                                  * Caller's buffer is too small or a new one can't be allocated
305                                                  */
306                                                 ACPI_DEBUG_PRINT((ACPI_DB_INFO,
307                                                                   "Needed buffer size %X, %s\n",
308                                                                   (u32)
309                                                                   buffer_space_needed,
310                                                                   acpi_format_exception
311                                                                   (status)));
312                                         } else {
313                                                 /*
314                                                  *  We have enough space for the object, build it
315                                                  */
316                                                 status =
317                                                     acpi_ut_copy_iobject_to_eobject
318                                                     (info.return_object,
319                                                      return_buffer);
320                                         }
321                                 }
322                         }
323                 }
324         }
325
326         if (info.return_object) {
327                 /*
328                  * Delete the internal return object.  NOTE: Interpreter
329                  * must be locked to avoid race condition.
330                  */
331                 status2 = acpi_ex_enter_interpreter();
332                 if (ACPI_SUCCESS(status2)) {
333                         /*
334                          * Delete the internal return object. (Or at least
335                          * decrement the reference count by one)
336                          */
337                         acpi_ut_remove_reference(info.return_object);
338                         acpi_ex_exit_interpreter();
339                 }
340         }
341
342         /*
343          * Free the input parameter list (if we created one),
344          */
345         if (info.parameters) {
346                 /* Free the allocated parameter block */
347
348                 acpi_ut_delete_internal_object_list(info.parameters);
349         }
350
351         return_ACPI_STATUS(status);
352 }
353
354 EXPORT_SYMBOL(acpi_evaluate_object);
355
356 /*******************************************************************************
357  *
358  * FUNCTION:    acpi_walk_namespace
359  *
360  * PARAMETERS:  Type                - acpi_object_type to search for
361  *              start_object        - Handle in namespace where search begins
362  *              max_depth           - Depth to which search is to reach
363  *              user_function       - Called when an object of "Type" is found
364  *              Context             - Passed to user function
365  *              return_value        - Location where return value of
366  *                                    user_function is put if terminated early
367  *
368  * RETURNS      Return value from the user_function if terminated early.
369  *              Otherwise, returns NULL.
370  *
371  * DESCRIPTION: Performs a modified depth-first walk of the namespace tree,
372  *              starting (and ending) at the object specified by start_handle.
373  *              The user_function is called whenever an object that matches
374  *              the type parameter is found.  If the user function returns
375  *              a non-zero value, the search is terminated immediately and this
376  *              value is returned to the caller.
377  *
378  *              The point of this procedure is to provide a generic namespace
379  *              walk routine that can be called from multiple places to
380  *              provide multiple services;  the User Function can be tailored
381  *              to each task, whether it is a print function, a compare
382  *              function, etc.
383  *
384  ******************************************************************************/
385
386 acpi_status
387 acpi_walk_namespace(acpi_object_type type,
388                     acpi_handle start_object,
389                     u32 max_depth,
390                     acpi_walk_callback user_function,
391                     void *context, void **return_value)
392 {
393         acpi_status status;
394
395         ACPI_FUNCTION_TRACE("acpi_walk_namespace");
396
397         /* Parameter validation */
398
399         if ((type > ACPI_TYPE_LOCAL_MAX) || (!max_depth) || (!user_function)) {
400                 return_ACPI_STATUS(AE_BAD_PARAMETER);
401         }
402
403         /*
404          * Lock the namespace around the walk.
405          * The namespace will be unlocked/locked around each call
406          * to the user function - since this function
407          * must be allowed to make Acpi calls itself.
408          */
409         status = acpi_ut_acquire_mutex(ACPI_MTX_NAMESPACE);
410         if (ACPI_FAILURE(status)) {
411                 return_ACPI_STATUS(status);
412         }
413
414         status = acpi_ns_walk_namespace(type, start_object, max_depth,
415                                         ACPI_NS_WALK_UNLOCK,
416                                         user_function, context, return_value);
417
418         (void)acpi_ut_release_mutex(ACPI_MTX_NAMESPACE);
419         return_ACPI_STATUS(status);
420 }
421
422 EXPORT_SYMBOL(acpi_walk_namespace);
423
424 /*******************************************************************************
425  *
426  * FUNCTION:    acpi_ns_get_device_callback
427  *
428  * PARAMETERS:  Callback from acpi_get_device
429  *
430  * RETURN:      Status
431  *
432  * DESCRIPTION: Takes callbacks from walk_namespace and filters out all non-
433  *              present devices, or if they specified a HID, it filters based
434  *              on that.
435  *
436  ******************************************************************************/
437
438 static acpi_status
439 acpi_ns_get_device_callback(acpi_handle obj_handle,
440                             u32 nesting_level,
441                             void *context, void **return_value)
442 {
443         struct acpi_get_devices_info *info = context;
444         acpi_status status;
445         struct acpi_namespace_node *node;
446         u32 flags;
447         struct acpi_device_id hid;
448         struct acpi_compatible_id_list *cid;
449         acpi_native_uint i;
450
451         status = acpi_ut_acquire_mutex(ACPI_MTX_NAMESPACE);
452         if (ACPI_FAILURE(status)) {
453                 return (status);
454         }
455
456         node = acpi_ns_map_handle_to_node(obj_handle);
457         status = acpi_ut_release_mutex(ACPI_MTX_NAMESPACE);
458         if (ACPI_FAILURE(status)) {
459                 return (status);
460         }
461
462         if (!node) {
463                 return (AE_BAD_PARAMETER);
464         }
465
466         /* Run _STA to determine if device is present */
467
468         status = acpi_ut_execute_STA(node, &flags);
469         if (ACPI_FAILURE(status)) {
470                 return (AE_CTRL_DEPTH);
471         }
472
473         if (!(flags & ACPI_STA_DEVICE_PRESENT)) {
474                 /* Don't examine children of the device if not present */
475
476                 return (AE_CTRL_DEPTH);
477         }
478
479         /* Filter based on device HID & CID */
480
481         if (info->hid != NULL) {
482                 status = acpi_ut_execute_HID(node, &hid);
483                 if (status == AE_NOT_FOUND) {
484                         return (AE_OK);
485                 } else if (ACPI_FAILURE(status)) {
486                         return (AE_CTRL_DEPTH);
487                 }
488
489                 if (ACPI_STRNCMP(hid.value, info->hid, sizeof(hid.value)) != 0) {
490                         /* Get the list of Compatible IDs */
491
492                         status = acpi_ut_execute_CID(node, &cid);
493                         if (status == AE_NOT_FOUND) {
494                                 return (AE_OK);
495                         } else if (ACPI_FAILURE(status)) {
496                                 return (AE_CTRL_DEPTH);
497                         }
498
499                         /* Walk the CID list */
500
501                         for (i = 0; i < cid->count; i++) {
502                                 if (ACPI_STRNCMP(cid->id[i].value, info->hid,
503                                                  sizeof(struct
504                                                         acpi_compatible_id)) !=
505                                     0) {
506                                         ACPI_MEM_FREE(cid);
507                                         return (AE_OK);
508                                 }
509                         }
510                         ACPI_MEM_FREE(cid);
511                 }
512         }
513
514         status = info->user_function(obj_handle, nesting_level, info->context,
515                                      return_value);
516         return (status);
517 }
518
519 /*******************************************************************************
520  *
521  * FUNCTION:    acpi_get_devices
522  *
523  * PARAMETERS:  HID                 - HID to search for. Can be NULL.
524  *              user_function       - Called when a matching object is found
525  *              Context             - Passed to user function
526  *              return_value        - Location where return value of
527  *                                    user_function is put if terminated early
528  *
529  * RETURNS      Return value from the user_function if terminated early.
530  *              Otherwise, returns NULL.
531  *
532  * DESCRIPTION: Performs a modified depth-first walk of the namespace tree,
533  *              starting (and ending) at the object specified by start_handle.
534  *              The user_function is called whenever an object of type
535  *              Device is found.  If the user function returns
536  *              a non-zero value, the search is terminated immediately and this
537  *              value is returned to the caller.
538  *
539  *              This is a wrapper for walk_namespace, but the callback performs
540  *              additional filtering. Please see acpi_get_device_callback.
541  *
542  ******************************************************************************/
543
544 acpi_status
545 acpi_get_devices(char *HID,
546                  acpi_walk_callback user_function,
547                  void *context, void **return_value)
548 {
549         acpi_status status;
550         struct acpi_get_devices_info info;
551
552         ACPI_FUNCTION_TRACE("acpi_get_devices");
553
554         /* Parameter validation */
555
556         if (!user_function) {
557                 return_ACPI_STATUS(AE_BAD_PARAMETER);
558         }
559
560         /*
561          * We're going to call their callback from OUR callback, so we need
562          * to know what it is, and their context parameter.
563          */
564         info.context = context;
565         info.user_function = user_function;
566         info.hid = HID;
567
568         /*
569          * Lock the namespace around the walk.
570          * The namespace will be unlocked/locked around each call
571          * to the user function - since this function
572          * must be allowed to make Acpi calls itself.
573          */
574         status = acpi_ut_acquire_mutex(ACPI_MTX_NAMESPACE);
575         if (ACPI_FAILURE(status)) {
576                 return_ACPI_STATUS(status);
577         }
578
579         status = acpi_ns_walk_namespace(ACPI_TYPE_DEVICE,
580                                         ACPI_ROOT_OBJECT, ACPI_UINT32_MAX,
581                                         ACPI_NS_WALK_UNLOCK,
582                                         acpi_ns_get_device_callback, &info,
583                                         return_value);
584
585         (void)acpi_ut_release_mutex(ACPI_MTX_NAMESPACE);
586         return_ACPI_STATUS(status);
587 }
588
589 EXPORT_SYMBOL(acpi_get_devices);
590
591 /*******************************************************************************
592  *
593  * FUNCTION:    acpi_attach_data
594  *
595  * PARAMETERS:  obj_handle          - Namespace node
596  *              Handler             - Handler for this attachment
597  *              Data                - Pointer to data to be attached
598  *
599  * RETURN:      Status
600  *
601  * DESCRIPTION: Attach arbitrary data and handler to a namespace node.
602  *
603  ******************************************************************************/
604
605 acpi_status
606 acpi_attach_data(acpi_handle obj_handle,
607                  acpi_object_handler handler, void *data)
608 {
609         struct acpi_namespace_node *node;
610         acpi_status status;
611
612         /* Parameter validation */
613
614         if (!obj_handle || !handler || !data) {
615                 return (AE_BAD_PARAMETER);
616         }
617
618         status = acpi_ut_acquire_mutex(ACPI_MTX_NAMESPACE);
619         if (ACPI_FAILURE(status)) {
620                 return (status);
621         }
622
623         /* Convert and validate the handle */
624
625         node = acpi_ns_map_handle_to_node(obj_handle);
626         if (!node) {
627                 status = AE_BAD_PARAMETER;
628                 goto unlock_and_exit;
629         }
630
631         status = acpi_ns_attach_data(node, handler, data);
632
633       unlock_and_exit:
634         (void)acpi_ut_release_mutex(ACPI_MTX_NAMESPACE);
635         return (status);
636 }
637
638 /*******************************************************************************
639  *
640  * FUNCTION:    acpi_detach_data
641  *
642  * PARAMETERS:  obj_handle          - Namespace node handle
643  *              Handler             - Handler used in call to acpi_attach_data
644  *
645  * RETURN:      Status
646  *
647  * DESCRIPTION: Remove data that was previously attached to a node.
648  *
649  ******************************************************************************/
650
651 acpi_status
652 acpi_detach_data(acpi_handle obj_handle, acpi_object_handler handler)
653 {
654         struct acpi_namespace_node *node;
655         acpi_status status;
656
657         /* Parameter validation */
658
659         if (!obj_handle || !handler) {
660                 return (AE_BAD_PARAMETER);
661         }
662
663         status = acpi_ut_acquire_mutex(ACPI_MTX_NAMESPACE);
664         if (ACPI_FAILURE(status)) {
665                 return (status);
666         }
667
668         /* Convert and validate the handle */
669
670         node = acpi_ns_map_handle_to_node(obj_handle);
671         if (!node) {
672                 status = AE_BAD_PARAMETER;
673                 goto unlock_and_exit;
674         }
675
676         status = acpi_ns_detach_data(node, handler);
677
678       unlock_and_exit:
679         (void)acpi_ut_release_mutex(ACPI_MTX_NAMESPACE);
680         return (status);
681 }
682
683 /*******************************************************************************
684  *
685  * FUNCTION:    acpi_get_data
686  *
687  * PARAMETERS:  obj_handle          - Namespace node
688  *              Handler             - Handler used in call to attach_data
689  *              Data                - Where the data is returned
690  *
691  * RETURN:      Status
692  *
693  * DESCRIPTION: Retrieve data that was previously attached to a namespace node.
694  *
695  ******************************************************************************/
696
697 acpi_status
698 acpi_get_data(acpi_handle obj_handle, acpi_object_handler handler, void **data)
699 {
700         struct acpi_namespace_node *node;
701         acpi_status status;
702
703         /* Parameter validation */
704
705         if (!obj_handle || !handler || !data) {
706                 return (AE_BAD_PARAMETER);
707         }
708
709         status = acpi_ut_acquire_mutex(ACPI_MTX_NAMESPACE);
710         if (ACPI_FAILURE(status)) {
711                 return (status);
712         }
713
714         /* Convert and validate the handle */
715
716         node = acpi_ns_map_handle_to_node(obj_handle);
717         if (!node) {
718                 status = AE_BAD_PARAMETER;
719                 goto unlock_and_exit;
720         }
721
722         status = acpi_ns_get_attached_data(node, handler, data);
723
724       unlock_and_exit:
725         (void)acpi_ut_release_mutex(ACPI_MTX_NAMESPACE);
726         return (status);
727 }