aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/acpi/parser/pstree.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/acpi/parser/pstree.c')
-rw-r--r--drivers/acpi/parser/pstree.c159
1 files changed, 83 insertions, 76 deletions
diff --git a/drivers/acpi/parser/pstree.c b/drivers/acpi/parser/pstree.c
index 2140bd1ac10b..d5aafe73fca0 100644
--- a/drivers/acpi/parser/pstree.c
+++ b/drivers/acpi/parser/pstree.c
@@ -49,6 +49,14 @@
49#define _COMPONENT ACPI_PARSER 49#define _COMPONENT ACPI_PARSER
50 ACPI_MODULE_NAME ("pstree") 50 ACPI_MODULE_NAME ("pstree")
51 51
52/* Local prototypes */
53
54#ifdef ACPI_OBSOLETE_FUNCTIONS
55union acpi_parse_object *
56acpi_ps_get_child (
57 union acpi_parse_object *op);
58#endif
59
52 60
53/******************************************************************************* 61/*******************************************************************************
54 * 62 *
@@ -57,7 +65,7 @@
57 * PARAMETERS: Op - Get an argument for this op 65 * PARAMETERS: Op - Get an argument for this op
58 * Argn - Nth argument to get 66 * Argn - Nth argument to get
59 * 67 *
60 * RETURN: The argument (as an Op object). NULL if argument does not exist 68 * RETURN: The argument (as an Op object). NULL if argument does not exist
61 * 69 *
62 * DESCRIPTION: Get the specified op's argument. 70 * DESCRIPTION: Get the specified op's argument.
63 * 71 *
@@ -152,7 +160,6 @@ acpi_ps_append_arg (
152 return; 160 return;
153 } 161 }
154 162
155
156 /* Append the argument to the linked argument list */ 163 /* Append the argument to the linked argument list */
157 164
158 if (op->common.value.arg) { 165 if (op->common.value.arg) {
@@ -164,14 +171,12 @@ acpi_ps_append_arg (
164 } 171 }
165 prev_arg->common.next = arg; 172 prev_arg->common.next = arg;
166 } 173 }
167
168 else { 174 else {
169 /* No argument list, this will be the first argument */ 175 /* No argument list, this will be the first argument */
170 176
171 op->common.value.arg = arg; 177 op->common.value.arg = arg;
172 } 178 }
173 179
174
175 /* Set the parent in this arg and any args linked after it */ 180 /* Set the parent in this arg and any args linked after it */
176 181
177 while (arg) { 182 while (arg) {
@@ -182,73 +187,6 @@ acpi_ps_append_arg (
182 187
183 188
184#ifdef ACPI_FUTURE_USAGE 189#ifdef ACPI_FUTURE_USAGE
185
186/*******************************************************************************
187 *
188 * FUNCTION: acpi_ps_get_child
189 *
190 * PARAMETERS: Op - Get the child of this Op
191 *
192 * RETURN: Child Op, Null if none is found.
193 *
194 * DESCRIPTION: Get op's children or NULL if none
195 *
196 ******************************************************************************/
197union acpi_parse_object *
198acpi_ps_get_child (
199 union acpi_parse_object *op)
200{
201 union acpi_parse_object *child = NULL;
202
203
204 ACPI_FUNCTION_ENTRY ();
205
206
207 switch (op->common.aml_opcode) {
208 case AML_SCOPE_OP:
209 case AML_ELSE_OP:
210 case AML_DEVICE_OP:
211 case AML_THERMAL_ZONE_OP:
212 case AML_INT_METHODCALL_OP:
213
214 child = acpi_ps_get_arg (op, 0);
215 break;
216
217
218 case AML_BUFFER_OP:
219 case AML_PACKAGE_OP:
220 case AML_METHOD_OP:
221 case AML_IF_OP:
222 case AML_WHILE_OP:
223 case AML_FIELD_OP:
224
225 child = acpi_ps_get_arg (op, 1);
226 break;
227
228
229 case AML_POWER_RES_OP:
230 case AML_INDEX_FIELD_OP:
231
232 child = acpi_ps_get_arg (op, 2);
233 break;
234
235
236 case AML_PROCESSOR_OP:
237 case AML_BANK_FIELD_OP:
238
239 child = acpi_ps_get_arg (op, 3);
240 break;
241
242
243 default:
244 /* All others have no children */
245 break;
246 }
247
248 return (child);
249}
250
251
252/******************************************************************************* 190/*******************************************************************************
253 * 191 *
254 * FUNCTION: acpi_ps_get_depth_next 192 * FUNCTION: acpi_ps_get_depth_next
@@ -280,21 +218,21 @@ acpi_ps_get_depth_next (
280 return (NULL); 218 return (NULL);
281 } 219 }
282 220
283 /* look for an argument or child */ 221 /* Look for an argument or child */
284 222
285 next = acpi_ps_get_arg (op, 0); 223 next = acpi_ps_get_arg (op, 0);
286 if (next) { 224 if (next) {
287 return (next); 225 return (next);
288 } 226 }
289 227
290 /* look for a sibling */ 228 /* Look for a sibling */
291 229
292 next = op->common.next; 230 next = op->common.next;
293 if (next) { 231 if (next) {
294 return (next); 232 return (next);
295 } 233 }
296 234
297 /* look for a sibling of parent */ 235 /* Look for a sibling of parent */
298 236
299 parent = op->common.parent; 237 parent = op->common.parent;
300 238
@@ -305,13 +243,13 @@ acpi_ps_get_depth_next (
305 } 243 }
306 244
307 if (arg == origin) { 245 if (arg == origin) {
308 /* reached parent of origin, end search */ 246 /* Reached parent of origin, end search */
309 247
310 return (NULL); 248 return (NULL);
311 } 249 }
312 250
313 if (parent->common.next) { 251 if (parent->common.next) {
314 /* found sibling of parent */ 252 /* Found sibling of parent */
315 253
316 return (parent->common.next); 254 return (parent->common.next);
317 } 255 }
@@ -323,5 +261,74 @@ acpi_ps_get_depth_next (
323 return (next); 261 return (next);
324} 262}
325 263
264
265#ifdef ACPI_OBSOLETE_FUNCTIONS
266/*******************************************************************************
267 *
268 * FUNCTION: acpi_ps_get_child
269 *
270 * PARAMETERS: Op - Get the child of this Op
271 *
272 * RETURN: Child Op, Null if none is found.
273 *
274 * DESCRIPTION: Get op's children or NULL if none
275 *
276 ******************************************************************************/
277
278union acpi_parse_object *
279acpi_ps_get_child (
280 union acpi_parse_object *op)
281{
282 union acpi_parse_object *child = NULL;
283
284
285 ACPI_FUNCTION_ENTRY ();
286
287
288 switch (op->common.aml_opcode) {
289 case AML_SCOPE_OP:
290 case AML_ELSE_OP:
291 case AML_DEVICE_OP:
292 case AML_THERMAL_ZONE_OP:
293 case AML_INT_METHODCALL_OP:
294
295 child = acpi_ps_get_arg (op, 0);
296 break;
297
298
299 case AML_BUFFER_OP:
300 case AML_PACKAGE_OP:
301 case AML_METHOD_OP:
302 case AML_IF_OP:
303 case AML_WHILE_OP:
304 case AML_FIELD_OP:
305
306 child = acpi_ps_get_arg (op, 1);
307 break;
308
309
310 case AML_POWER_RES_OP:
311 case AML_INDEX_FIELD_OP:
312
313 child = acpi_ps_get_arg (op, 2);
314 break;
315
316
317 case AML_PROCESSOR_OP:
318 case AML_BANK_FIELD_OP:
319
320 child = acpi_ps_get_arg (op, 3);
321 break;
322
323
324 default:
325 /* All others have no children */
326 break;
327 }
328
329 return (child);
330}
331#endif
332
326#endif /* ACPI_FUTURE_USAGE */ 333#endif /* ACPI_FUTURE_USAGE */
327 334