Blame view

drivers/acpi/acpica/nsobject.c 12.7 KB
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
1
2
3
4
5
6
7
8
  /*******************************************************************************
   *
   * Module Name: nsobject - Utilities for objects attached to namespace
   *                         table entries
   *
   ******************************************************************************/
  
  /*
75a44ce00   Len Brown   ACPICA: update In...
9
   * Copyright (C) 2000 - 2008, Intel Corp.
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
   * All rights reserved.
   *
   * Redistribution and use in source and binary forms, with or without
   * modification, are permitted provided that the following conditions
   * are met:
   * 1. Redistributions of source code must retain the above copyright
   *    notice, this list of conditions, and the following disclaimer,
   *    without modification.
   * 2. Redistributions in binary form must reproduce at minimum a disclaimer
   *    substantially similar to the "NO WARRANTY" disclaimer below
   *    ("Disclaimer") and any redistribution must be conditioned upon
   *    including a substantially similar Disclaimer requirement for further
   *    binary redistribution.
   * 3. Neither the names of the above-listed copyright holders nor the names
   *    of any contributors may be used to endorse or promote products derived
   *    from this software without specific prior written permission.
   *
   * Alternatively, this software may be distributed under the terms of the
   * GNU General Public License ("GPL") version 2 as published by the Free
   * Software Foundation.
   *
   * NO WARRANTY
   * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
   * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
   * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR
   * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
   * HOLDERS OR CONTRIBUTORS BE LIABLE FOR SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
   * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
   * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
   * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
   * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING
   * IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
   * POSSIBILITY OF SUCH DAMAGES.
   */
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
44
  #include <acpi/acpi.h>
e2f7a7772   Len Brown   ACPICA: hide priv...
45
46
  #include "accommon.h"
  #include "acnamesp.h"
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
47

1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
48
  #define _COMPONENT          ACPI_NAMESPACE
4be44fcd3   Len Brown   [ACPI] Lindent al...
49
  ACPI_MODULE_NAME("nsobject")
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
50
51
52
53
54
55
56
57
58
59
  
  /*******************************************************************************
   *
   * FUNCTION:    acpi_ns_attach_object
   *
   * PARAMETERS:  Node                - Parent Node
   *              Object              - Object to be attached
   *              Type                - Type of object, or ACPI_TYPE_ANY if not
   *                                    known
   *
44f6c0124   Robert Moore   ACPICA 20050408 f...
60
61
   * RETURN:      Status
   *
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
62
63
64
65
66
67
68
69
70
   * DESCRIPTION: Record the given object as the value associated with the
   *              name whose acpi_handle is passed.  If Object is NULL
   *              and Type is ACPI_TYPE_ANY, set the name as having no value.
   *              Note: Future may require that the Node->Flags field be passed
   *              as a parameter.
   *
   * MUTEX:       Assumes namespace is locked
   *
   ******************************************************************************/
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
71
  acpi_status
4be44fcd3   Len Brown   [ACPI] Lindent al...
72
73
  acpi_ns_attach_object(struct acpi_namespace_node *node,
  		      union acpi_operand_object *object, acpi_object_type type)
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
74
  {
4be44fcd3   Len Brown   [ACPI] Lindent al...
75
76
77
  	union acpi_operand_object *obj_desc;
  	union acpi_operand_object *last_obj_desc;
  	acpi_object_type object_type = ACPI_TYPE_ANY;
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
78

b229cf92e   Bob Moore   ACPI: ACPICA 2006...
79
  	ACPI_FUNCTION_TRACE(ns_attach_object);
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
80
81
82
83
84
  
  	/*
  	 * Parameter validation
  	 */
  	if (!node) {
52fc0b026   Bob Moore   [ACPI] ACPICA 200...
85

1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
86
  		/* Invalid handle */
b229cf92e   Bob Moore   ACPI: ACPICA 2006...
87
  		ACPI_ERROR((AE_INFO, "Null NamedObj handle"));
4be44fcd3   Len Brown   [ACPI] Lindent al...
88
  		return_ACPI_STATUS(AE_BAD_PARAMETER);
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
89
90
91
  	}
  
  	if (!object && (ACPI_TYPE_ANY != type)) {
52fc0b026   Bob Moore   [ACPI] ACPICA 200...
92

1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
93
  		/* Null object */
b8e4d8935   Bob Moore   [ACPI] ACPICA 200...
94
95
  		ACPI_ERROR((AE_INFO,
  			    "Null object, but type not ACPI_TYPE_ANY"));
4be44fcd3   Len Brown   [ACPI] Lindent al...
96
  		return_ACPI_STATUS(AE_BAD_PARAMETER);
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
97
  	}
4be44fcd3   Len Brown   [ACPI] Lindent al...
98
  	if (ACPI_GET_DESCRIPTOR_TYPE(node) != ACPI_DESC_TYPE_NAMED) {
52fc0b026   Bob Moore   [ACPI] ACPICA 200...
99

1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
100
  		/* Not a name handle */
b8e4d8935   Bob Moore   [ACPI] ACPICA 200...
101
102
  		ACPI_ERROR((AE_INFO, "Invalid handle %p [%s]",
  			    node, acpi_ut_get_descriptor_name(node)));
4be44fcd3   Len Brown   [ACPI] Lindent al...
103
  		return_ACPI_STATUS(AE_BAD_PARAMETER);
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
104
105
106
107
108
  	}
  
  	/* Check if this object is already attached */
  
  	if (node->object == object) {
4be44fcd3   Len Brown   [ACPI] Lindent al...
109
  		ACPI_DEBUG_PRINT((ACPI_DB_EXEC,
b229cf92e   Bob Moore   ACPI: ACPICA 2006...
110
111
  				  "Obj %p already installed in NameObj %p
  ",
4be44fcd3   Len Brown   [ACPI] Lindent al...
112
  				  object, node));
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
113

4be44fcd3   Len Brown   [ACPI] Lindent al...
114
  		return_ACPI_STATUS(AE_OK);
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
115
116
117
118
119
  	}
  
  	/* If null object, we will just install it */
  
  	if (!object) {
4be44fcd3   Len Brown   [ACPI] Lindent al...
120
  		obj_desc = NULL;
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
121
122
123
124
125
126
127
  		object_type = ACPI_TYPE_ANY;
  	}
  
  	/*
  	 * If the source object is a namespace Node with an attached object,
  	 * we will use that (attached) object
  	 */
4be44fcd3   Len Brown   [ACPI] Lindent al...
128
129
  	else if ((ACPI_GET_DESCRIPTOR_TYPE(object) == ACPI_DESC_TYPE_NAMED) &&
  		 ((struct acpi_namespace_node *)object)->object) {
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
130
131
132
133
  		/*
  		 * Value passed is a name handle and that name has a
  		 * non-null value.  Use that name's value and type.
  		 */
4be44fcd3   Len Brown   [ACPI] Lindent al...
134
135
  		obj_desc = ((struct acpi_namespace_node *)object)->object;
  		object_type = ((struct acpi_namespace_node *)object)->type;
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
136
137
138
139
140
141
142
  	}
  
  	/*
  	 * Otherwise, we will use the parameter object, but we must type
  	 * it first
  	 */
  	else {
4be44fcd3   Len Brown   [ACPI] Lindent al...
143
  		obj_desc = (union acpi_operand_object *)object;
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
144
145
146
147
148
  
  		/* Use the given type */
  
  		object_type = type;
  	}
4be44fcd3   Len Brown   [ACPI] Lindent al...
149
150
151
  	ACPI_DEBUG_PRINT((ACPI_DB_EXEC, "Installing %p into Node %p [%4.4s]
  ",
  			  obj_desc, node, acpi_ut_get_node_name(node)));
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
152
153
154
155
  
  	/* Detach an existing attached object if present */
  
  	if (node->object) {
4be44fcd3   Len Brown   [ACPI] Lindent al...
156
  		acpi_ns_detach_object(node);
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
157
158
159
160
161
162
163
  	}
  
  	if (obj_desc) {
  		/*
  		 * Must increment the new value's reference count
  		 * (if it is an internal object)
  		 */
4be44fcd3   Len Brown   [ACPI] Lindent al...
164
  		acpi_ut_add_reference(obj_desc);
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
165
166
167
168
169
170
171
172
173
174
175
176
177
178
  
  		/*
  		 * Handle objects with multiple descriptors - walk
  		 * to the end of the descriptor list
  		 */
  		last_obj_desc = obj_desc;
  		while (last_obj_desc->common.next_object) {
  			last_obj_desc = last_obj_desc->common.next_object;
  		}
  
  		/* Install the object at the front of the object list */
  
  		last_obj_desc->common.next_object = node->object;
  	}
4be44fcd3   Len Brown   [ACPI] Lindent al...
179
180
  	node->type = (u8) object_type;
  	node->object = obj_desc;
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
181

4be44fcd3   Len Brown   [ACPI] Lindent al...
182
  	return_ACPI_STATUS(AE_OK);
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
183
  }
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
184
185
186
187
  /*******************************************************************************
   *
   * FUNCTION:    acpi_ns_detach_object
   *
44f6c0124   Robert Moore   ACPICA 20050408 f...
188
   * PARAMETERS:  Node           - A Namespace node whose object will be detached
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
189
190
191
192
193
194
195
196
   *
   * RETURN:      None.
   *
   * DESCRIPTION: Detach/delete an object associated with a namespace node.
   *              if the object is an allocated object, it is freed.
   *              Otherwise, the field is simply cleared.
   *
   ******************************************************************************/
4be44fcd3   Len Brown   [ACPI] Lindent al...
197
  void acpi_ns_detach_object(struct acpi_namespace_node *node)
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
198
  {
4be44fcd3   Len Brown   [ACPI] Lindent al...
199
  	union acpi_operand_object *obj_desc;
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
200

b229cf92e   Bob Moore   ACPI: ACPICA 2006...
201
  	ACPI_FUNCTION_TRACE(ns_detach_object);
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
202
203
  
  	obj_desc = node->object;
3371c19c2   Bob Moore   ACPICA: Remove AC...
204
  	if (!obj_desc || (obj_desc->common.type == ACPI_TYPE_LOCAL_DATA)) {
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
205
206
  		return_VOID;
  	}
b2f7ddcfc   Lin Ming   ACPICA: New: Acpi...
207
208
209
210
211
212
213
214
  	if (node->flags & ANOBJ_ALLOCATED_BUFFER) {
  
  		/* Free the dynamic aml buffer */
  
  		if (obj_desc->common.type == ACPI_TYPE_METHOD) {
  			ACPI_FREE(obj_desc->method.aml_start);
  		}
  	}
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
215
216
217
  	/* Clear the entry in all cases */
  
  	node->object = NULL;
4be44fcd3   Len Brown   [ACPI] Lindent al...
218
  	if (ACPI_GET_DESCRIPTOR_TYPE(obj_desc) == ACPI_DESC_TYPE_OPERAND) {
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
219
220
  		node->object = obj_desc->common.next_object;
  		if (node->object &&
3371c19c2   Bob Moore   ACPICA: Remove AC...
221
  		    ((node->object)->common.type != ACPI_TYPE_LOCAL_DATA)) {
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
222
223
224
225
226
227
228
  			node->object = node->object->common.next_object;
  		}
  	}
  
  	/* Reset the node type to untyped */
  
  	node->type = ACPI_TYPE_ANY;
4be44fcd3   Len Brown   [ACPI] Lindent al...
229
230
231
  	ACPI_DEBUG_PRINT((ACPI_DB_NAMES, "Node %p [%4.4s] Object %p
  ",
  			  node, acpi_ut_get_node_name(node), obj_desc));
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
232
233
  
  	/* Remove one reference on the object (and all subobjects) */
4be44fcd3   Len Brown   [ACPI] Lindent al...
234
  	acpi_ut_remove_reference(obj_desc);
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
235
236
  	return_VOID;
  }
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
237
238
239
240
  /*******************************************************************************
   *
   * FUNCTION:    acpi_ns_get_attached_object
   *
44f6c0124   Robert Moore   ACPICA 20050408 f...
241
   * PARAMETERS:  Node             - Namespace node
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
242
243
244
245
246
247
248
   *
   * RETURN:      Current value of the object field from the Node whose
   *              handle is passed
   *
   * DESCRIPTION: Obtain the object attached to a namespace node.
   *
   ******************************************************************************/
4be44fcd3   Len Brown   [ACPI] Lindent al...
249
250
251
  union acpi_operand_object *acpi_ns_get_attached_object(struct
  						       acpi_namespace_node
  						       *node)
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
252
  {
b229cf92e   Bob Moore   ACPI: ACPICA 2006...
253
  	ACPI_FUNCTION_TRACE_PTR(ns_get_attached_object, node);
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
254
255
  
  	if (!node) {
b8e4d8935   Bob Moore   [ACPI] ACPICA 200...
256
  		ACPI_WARNING((AE_INFO, "Null Node ptr"));
4be44fcd3   Len Brown   [ACPI] Lindent al...
257
  		return_PTR(NULL);
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
258
259
260
  	}
  
  	if (!node->object ||
4be44fcd3   Len Brown   [ACPI] Lindent al...
261
262
263
  	    ((ACPI_GET_DESCRIPTOR_TYPE(node->object) != ACPI_DESC_TYPE_OPERAND)
  	     && (ACPI_GET_DESCRIPTOR_TYPE(node->object) !=
  		 ACPI_DESC_TYPE_NAMED))
3371c19c2   Bob Moore   ACPICA: Remove AC...
264
  	    || ((node->object)->common.type == ACPI_TYPE_LOCAL_DATA)) {
4be44fcd3   Len Brown   [ACPI] Lindent al...
265
  		return_PTR(NULL);
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
266
  	}
4be44fcd3   Len Brown   [ACPI] Lindent al...
267
  	return_PTR(node->object);
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
268
  }
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
269
270
271
272
  /*******************************************************************************
   *
   * FUNCTION:    acpi_ns_get_secondary_object
   *
44f6c0124   Robert Moore   ACPICA 20050408 f...
273
   * PARAMETERS:  Node             - Namespace node
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
274
275
276
277
278
279
280
   *
   * RETURN:      Current value of the object field from the Node whose
   *              handle is passed.
   *
   * DESCRIPTION: Obtain a secondary object associated with a namespace node.
   *
   ******************************************************************************/
4be44fcd3   Len Brown   [ACPI] Lindent al...
281
282
283
  union acpi_operand_object *acpi_ns_get_secondary_object(union
  							acpi_operand_object
  							*obj_desc)
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
284
  {
b229cf92e   Bob Moore   ACPI: ACPICA 2006...
285
  	ACPI_FUNCTION_TRACE_PTR(ns_get_secondary_object, obj_desc);
4be44fcd3   Len Brown   [ACPI] Lindent al...
286
287
  
  	if ((!obj_desc) ||
3371c19c2   Bob Moore   ACPICA: Remove AC...
288
  	    (obj_desc->common.type == ACPI_TYPE_LOCAL_DATA) ||
4be44fcd3   Len Brown   [ACPI] Lindent al...
289
  	    (!obj_desc->common.next_object) ||
3371c19c2   Bob Moore   ACPICA: Remove AC...
290
  	    ((obj_desc->common.next_object)->common.type ==
4be44fcd3   Len Brown   [ACPI] Lindent al...
291
292
  	     ACPI_TYPE_LOCAL_DATA)) {
  		return_PTR(NULL);
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
293
  	}
4be44fcd3   Len Brown   [ACPI] Lindent al...
294
  	return_PTR(obj_desc->common.next_object);
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
295
  }
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
  /*******************************************************************************
   *
   * FUNCTION:    acpi_ns_attach_data
   *
   * PARAMETERS:  Node            - Namespace node
   *              Handler         - Handler to be associated with the data
   *              Data            - Data to be attached
   *
   * RETURN:      Status
   *
   * DESCRIPTION: Low-level attach data.  Create and attach a Data object.
   *
   ******************************************************************************/
  
  acpi_status
4be44fcd3   Len Brown   [ACPI] Lindent al...
311
312
  acpi_ns_attach_data(struct acpi_namespace_node *node,
  		    acpi_object_handler handler, void *data)
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
313
  {
4be44fcd3   Len Brown   [ACPI] Lindent al...
314
315
316
  	union acpi_operand_object *prev_obj_desc;
  	union acpi_operand_object *obj_desc;
  	union acpi_operand_object *data_desc;
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
317
318
319
320
321
322
  
  	/* We only allow one attachment per handler */
  
  	prev_obj_desc = NULL;
  	obj_desc = node->object;
  	while (obj_desc) {
3371c19c2   Bob Moore   ACPICA: Remove AC...
323
  		if ((obj_desc->common.type == ACPI_TYPE_LOCAL_DATA) &&
4be44fcd3   Len Brown   [ACPI] Lindent al...
324
  		    (obj_desc->data.handler == handler)) {
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
325
326
327
328
329
330
331
332
  			return (AE_ALREADY_EXISTS);
  		}
  
  		prev_obj_desc = obj_desc;
  		obj_desc = obj_desc->common.next_object;
  	}
  
  	/* Create an internal object for the data */
4be44fcd3   Len Brown   [ACPI] Lindent al...
333
  	data_desc = acpi_ut_create_internal_object(ACPI_TYPE_LOCAL_DATA);
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
334
335
336
337
338
339
340
341
342
343
344
  	if (!data_desc) {
  		return (AE_NO_MEMORY);
  	}
  
  	data_desc->data.handler = handler;
  	data_desc->data.pointer = data;
  
  	/* Install the data object */
  
  	if (prev_obj_desc) {
  		prev_obj_desc->common.next_object = data_desc;
4be44fcd3   Len Brown   [ACPI] Lindent al...
345
  	} else {
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
346
347
348
349
350
  		node->object = data_desc;
  	}
  
  	return (AE_OK);
  }
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
  /*******************************************************************************
   *
   * FUNCTION:    acpi_ns_detach_data
   *
   * PARAMETERS:  Node            - Namespace node
   *              Handler         - Handler associated with the data
   *
   * RETURN:      Status
   *
   * DESCRIPTION: Low-level detach data.  Delete the data node, but the caller
   *              is responsible for the actual data.
   *
   ******************************************************************************/
  
  acpi_status
4be44fcd3   Len Brown   [ACPI] Lindent al...
366
367
  acpi_ns_detach_data(struct acpi_namespace_node * node,
  		    acpi_object_handler handler)
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
368
  {
4be44fcd3   Len Brown   [ACPI] Lindent al...
369
370
  	union acpi_operand_object *obj_desc;
  	union acpi_operand_object *prev_obj_desc;
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
371
372
373
374
  
  	prev_obj_desc = NULL;
  	obj_desc = node->object;
  	while (obj_desc) {
3371c19c2   Bob Moore   ACPICA: Remove AC...
375
  		if ((obj_desc->common.type == ACPI_TYPE_LOCAL_DATA) &&
4be44fcd3   Len Brown   [ACPI] Lindent al...
376
  		    (obj_desc->data.handler == handler)) {
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
377
  			if (prev_obj_desc) {
4be44fcd3   Len Brown   [ACPI] Lindent al...
378
379
380
  				prev_obj_desc->common.next_object =
  				    obj_desc->common.next_object;
  			} else {
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
381
382
  				node->object = obj_desc->common.next_object;
  			}
4be44fcd3   Len Brown   [ACPI] Lindent al...
383
  			acpi_ut_remove_reference(obj_desc);
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
384
385
386
387
388
389
390
391
392
  			return (AE_OK);
  		}
  
  		prev_obj_desc = obj_desc;
  		obj_desc = obj_desc->common.next_object;
  	}
  
  	return (AE_NOT_FOUND);
  }
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
  /*******************************************************************************
   *
   * FUNCTION:    acpi_ns_get_attached_data
   *
   * PARAMETERS:  Node            - Namespace node
   *              Handler         - Handler associated with the data
   *              Data            - Where the data is returned
   *
   * RETURN:      Status
   *
   * DESCRIPTION: Low level interface to obtain data previously associated with
   *              a namespace node.
   *
   ******************************************************************************/
  
  acpi_status
4be44fcd3   Len Brown   [ACPI] Lindent al...
409
410
  acpi_ns_get_attached_data(struct acpi_namespace_node * node,
  			  acpi_object_handler handler, void **data)
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
411
  {
4be44fcd3   Len Brown   [ACPI] Lindent al...
412
  	union acpi_operand_object *obj_desc;
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
413
414
415
  
  	obj_desc = node->object;
  	while (obj_desc) {
3371c19c2   Bob Moore   ACPICA: Remove AC...
416
  		if ((obj_desc->common.type == ACPI_TYPE_LOCAL_DATA) &&
4be44fcd3   Len Brown   [ACPI] Lindent al...
417
  		    (obj_desc->data.handler == handler)) {
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
418
419
420
421
422
423
424
425
426
  			*data = obj_desc->data.pointer;
  			return (AE_OK);
  		}
  
  		obj_desc = obj_desc->common.next_object;
  	}
  
  	return (AE_NOT_FOUND);
  }