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