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