aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/acpi/utilities/utobject.c
diff options
context:
space:
mode:
authorLen Brown <len.brown@intel.com>2005-08-05 00:44:28 -0400
committerLen Brown <len.brown@intel.com>2005-08-05 00:45:14 -0400
commit4be44fcd3bf648b782f4460fd06dfae6c42ded4b (patch)
tree5b5b7d296ea58786f53b95e5eac9565ff66890b0 /drivers/acpi/utilities/utobject.c
parentc65ade4dc8b486e8c8b9b0a6399789a5428e2039 (diff)
[ACPI] Lindent all ACPI files
Signed-off-by: Len Brown <len.brown@intel.com>
Diffstat (limited to 'drivers/acpi/utilities/utobject.c')
-rw-r--r--drivers/acpi/utilities/utobject.c324
1 files changed, 138 insertions, 186 deletions
diff --git a/drivers/acpi/utilities/utobject.c b/drivers/acpi/utilities/utobject.c
index 19178e142951..3015e1540053 100644
--- a/drivers/acpi/utilities/utobject.c
+++ b/drivers/acpi/utilities/utobject.c
@@ -41,34 +41,26 @@
41 * POSSIBILITY OF SUCH DAMAGES. 41 * POSSIBILITY OF SUCH DAMAGES.
42 */ 42 */
43 43
44
45#include <acpi/acpi.h> 44#include <acpi/acpi.h>
46#include <acpi/acnamesp.h> 45#include <acpi/acnamesp.h>
47#include <acpi/amlcode.h> 46#include <acpi/amlcode.h>
48 47
49
50#define _COMPONENT ACPI_UTILITIES 48#define _COMPONENT ACPI_UTILITIES
51 ACPI_MODULE_NAME ("utobject") 49ACPI_MODULE_NAME("utobject")
52 50
53/* Local prototypes */ 51/* Local prototypes */
54
55static acpi_status 52static acpi_status
56acpi_ut_get_simple_object_size ( 53acpi_ut_get_simple_object_size(union acpi_operand_object *obj,
57 union acpi_operand_object *obj, 54 acpi_size * obj_length);
58 acpi_size *obj_length);
59 55
60static acpi_status 56static acpi_status
61acpi_ut_get_package_object_size ( 57acpi_ut_get_package_object_size(union acpi_operand_object *obj,
62 union acpi_operand_object *obj, 58 acpi_size * obj_length);
63 acpi_size *obj_length);
64 59
65static acpi_status 60static acpi_status
66acpi_ut_get_element_length ( 61acpi_ut_get_element_length(u8 object_type,
67 u8 object_type, 62 union acpi_operand_object *source_object,
68 union acpi_operand_object *source_object, 63 union acpi_generic_state *state, void *context);
69 union acpi_generic_state *state,
70 void *context);
71
72 64
73/******************************************************************************* 65/*******************************************************************************
74 * 66 *
@@ -91,26 +83,25 @@ acpi_ut_get_element_length (
91 * 83 *
92 ******************************************************************************/ 84 ******************************************************************************/
93 85
94union acpi_operand_object * 86union acpi_operand_object *acpi_ut_create_internal_object_dbg(char *module_name,
95acpi_ut_create_internal_object_dbg ( 87 u32 line_number,
96 char *module_name, 88 u32 component_id,
97 u32 line_number, 89 acpi_object_type
98 u32 component_id, 90 type)
99 acpi_object_type type)
100{ 91{
101 union acpi_operand_object *object; 92 union acpi_operand_object *object;
102 union acpi_operand_object *second_object; 93 union acpi_operand_object *second_object;
103
104
105 ACPI_FUNCTION_TRACE_STR ("ut_create_internal_object_dbg",
106 acpi_ut_get_type_name (type));
107 94
95 ACPI_FUNCTION_TRACE_STR("ut_create_internal_object_dbg",
96 acpi_ut_get_type_name(type));
108 97
109 /* Allocate the raw object descriptor */ 98 /* Allocate the raw object descriptor */
110 99
111 object = acpi_ut_allocate_object_desc_dbg (module_name, line_number, component_id); 100 object =
101 acpi_ut_allocate_object_desc_dbg(module_name, line_number,
102 component_id);
112 if (!object) { 103 if (!object) {
113 return_PTR (NULL); 104 return_PTR(NULL);
114 } 105 }
115 106
116 switch (type) { 107 switch (type) {
@@ -119,11 +110,12 @@ acpi_ut_create_internal_object_dbg (
119 110
120 /* These types require a secondary object */ 111 /* These types require a secondary object */
121 112
122 second_object = acpi_ut_allocate_object_desc_dbg (module_name, 113 second_object = acpi_ut_allocate_object_desc_dbg(module_name,
123 line_number, component_id); 114 line_number,
115 component_id);
124 if (!second_object) { 116 if (!second_object) {
125 acpi_ut_delete_object_desc (object); 117 acpi_ut_delete_object_desc(object);
126 return_PTR (NULL); 118 return_PTR(NULL);
127 } 119 }
128 120
129 second_object->common.type = ACPI_TYPE_LOCAL_EXTRA; 121 second_object->common.type = ACPI_TYPE_LOCAL_EXTRA;
@@ -149,10 +141,9 @@ acpi_ut_create_internal_object_dbg (
149 141
150 /* Any per-type initialization should go here */ 142 /* Any per-type initialization should go here */
151 143
152 return_PTR (object); 144 return_PTR(object);
153} 145}
154 146
155
156/******************************************************************************* 147/*******************************************************************************
157 * 148 *
158 * FUNCTION: acpi_ut_create_buffer_object 149 * FUNCTION: acpi_ut_create_buffer_object
@@ -165,22 +156,18 @@ acpi_ut_create_internal_object_dbg (
165 * 156 *
166 ******************************************************************************/ 157 ******************************************************************************/
167 158
168union acpi_operand_object * 159union acpi_operand_object *acpi_ut_create_buffer_object(acpi_size buffer_size)
169acpi_ut_create_buffer_object (
170 acpi_size buffer_size)
171{ 160{
172 union acpi_operand_object *buffer_desc; 161 union acpi_operand_object *buffer_desc;
173 u8 *buffer = NULL; 162 u8 *buffer = NULL;
174
175
176 ACPI_FUNCTION_TRACE_U32 ("ut_create_buffer_object", buffer_size);
177 163
164 ACPI_FUNCTION_TRACE_U32("ut_create_buffer_object", buffer_size);
178 165
179 /* Create a new Buffer object */ 166 /* Create a new Buffer object */
180 167
181 buffer_desc = acpi_ut_create_internal_object (ACPI_TYPE_BUFFER); 168 buffer_desc = acpi_ut_create_internal_object(ACPI_TYPE_BUFFER);
182 if (!buffer_desc) { 169 if (!buffer_desc) {
183 return_PTR (NULL); 170 return_PTR(NULL);
184 } 171 }
185 172
186 /* Create an actual buffer only if size > 0 */ 173 /* Create an actual buffer only if size > 0 */
@@ -188,12 +175,11 @@ acpi_ut_create_buffer_object (
188 if (buffer_size > 0) { 175 if (buffer_size > 0) {
189 /* Allocate the actual buffer */ 176 /* Allocate the actual buffer */
190 177
191 buffer = ACPI_MEM_CALLOCATE (buffer_size); 178 buffer = ACPI_MEM_CALLOCATE(buffer_size);
192 if (!buffer) { 179 if (!buffer) {
193 ACPI_REPORT_ERROR (("create_buffer: could not allocate size %X\n", 180 ACPI_REPORT_ERROR(("create_buffer: could not allocate size %X\n", (u32) buffer_size));
194 (u32) buffer_size)); 181 acpi_ut_remove_reference(buffer_desc);
195 acpi_ut_remove_reference (buffer_desc); 182 return_PTR(NULL);
196 return_PTR (NULL);
197 } 183 }
198 } 184 }
199 185
@@ -205,10 +191,9 @@ acpi_ut_create_buffer_object (
205 191
206 /* Return the new buffer descriptor */ 192 /* Return the new buffer descriptor */
207 193
208 return_PTR (buffer_desc); 194 return_PTR(buffer_desc);
209} 195}
210 196
211
212/******************************************************************************* 197/*******************************************************************************
213 * 198 *
214 * FUNCTION: acpi_ut_create_string_object 199 * FUNCTION: acpi_ut_create_string_object
@@ -223,34 +208,29 @@ acpi_ut_create_buffer_object (
223 * 208 *
224 ******************************************************************************/ 209 ******************************************************************************/
225 210
226union acpi_operand_object * 211union acpi_operand_object *acpi_ut_create_string_object(acpi_size string_size)
227acpi_ut_create_string_object (
228 acpi_size string_size)
229{ 212{
230 union acpi_operand_object *string_desc; 213 union acpi_operand_object *string_desc;
231 char *string; 214 char *string;
232
233
234 ACPI_FUNCTION_TRACE_U32 ("ut_create_string_object", string_size);
235 215
216 ACPI_FUNCTION_TRACE_U32("ut_create_string_object", string_size);
236 217
237 /* Create a new String object */ 218 /* Create a new String object */
238 219
239 string_desc = acpi_ut_create_internal_object (ACPI_TYPE_STRING); 220 string_desc = acpi_ut_create_internal_object(ACPI_TYPE_STRING);
240 if (!string_desc) { 221 if (!string_desc) {
241 return_PTR (NULL); 222 return_PTR(NULL);
242 } 223 }
243 224
244 /* 225 /*
245 * Allocate the actual string buffer -- (Size + 1) for NULL terminator. 226 * Allocate the actual string buffer -- (Size + 1) for NULL terminator.
246 * NOTE: Zero-length strings are NULL terminated 227 * NOTE: Zero-length strings are NULL terminated
247 */ 228 */
248 string = ACPI_MEM_CALLOCATE (string_size + 1); 229 string = ACPI_MEM_CALLOCATE(string_size + 1);
249 if (!string) { 230 if (!string) {
250 ACPI_REPORT_ERROR (("create_string: could not allocate size %X\n", 231 ACPI_REPORT_ERROR(("create_string: could not allocate size %X\n", (u32) string_size));
251 (u32) string_size)); 232 acpi_ut_remove_reference(string_desc);
252 acpi_ut_remove_reference (string_desc); 233 return_PTR(NULL);
253 return_PTR (NULL);
254 } 234 }
255 235
256 /* Complete string object initialization */ 236 /* Complete string object initialization */
@@ -260,10 +240,9 @@ acpi_ut_create_string_object (
260 240
261 /* Return the new string descriptor */ 241 /* Return the new string descriptor */
262 242
263 return_PTR (string_desc); 243 return_PTR(string_desc);
264} 244}
265 245
266
267/******************************************************************************* 246/*******************************************************************************
268 * 247 *
269 * FUNCTION: acpi_ut_valid_internal_object 248 * FUNCTION: acpi_ut_valid_internal_object
@@ -276,24 +255,21 @@ acpi_ut_create_string_object (
276 * 255 *
277 ******************************************************************************/ 256 ******************************************************************************/
278 257
279u8 258u8 acpi_ut_valid_internal_object(void *object)
280acpi_ut_valid_internal_object (
281 void *object)
282{ 259{
283 260
284 ACPI_FUNCTION_NAME ("ut_valid_internal_object"); 261 ACPI_FUNCTION_NAME("ut_valid_internal_object");
285
286 262
287 /* Check for a null pointer */ 263 /* Check for a null pointer */
288 264
289 if (!object) { 265 if (!object) {
290 ACPI_DEBUG_PRINT ((ACPI_DB_INFO, "**** Null Object Ptr\n")); 266 ACPI_DEBUG_PRINT((ACPI_DB_INFO, "**** Null Object Ptr\n"));
291 return (FALSE); 267 return (FALSE);
292 } 268 }
293 269
294 /* Check the descriptor type field */ 270 /* Check the descriptor type field */
295 271
296 switch (ACPI_GET_DESCRIPTOR_TYPE (object)) { 272 switch (ACPI_GET_DESCRIPTOR_TYPE(object)) {
297 case ACPI_DESC_TYPE_OPERAND: 273 case ACPI_DESC_TYPE_OPERAND:
298 274
299 /* The object appears to be a valid union acpi_operand_object */ 275 /* The object appears to be a valid union acpi_operand_object */
@@ -301,16 +277,15 @@ acpi_ut_valid_internal_object (
301 return (TRUE); 277 return (TRUE);
302 278
303 default: 279 default:
304 ACPI_DEBUG_PRINT ((ACPI_DB_INFO, 280 ACPI_DEBUG_PRINT((ACPI_DB_INFO,
305 "%p is not not an ACPI operand obj [%s]\n", 281 "%p is not not an ACPI operand obj [%s]\n",
306 object, acpi_ut_get_descriptor_name (object))); 282 object, acpi_ut_get_descriptor_name(object)));
307 break; 283 break;
308 } 284 }
309 285
310 return (FALSE); 286 return (FALSE);
311} 287}
312 288
313
314/******************************************************************************* 289/*******************************************************************************
315 * 290 *
316 * FUNCTION: acpi_ut_allocate_object_desc_dbg 291 * FUNCTION: acpi_ut_allocate_object_desc_dbg
@@ -326,37 +301,31 @@ acpi_ut_valid_internal_object (
326 * 301 *
327 ******************************************************************************/ 302 ******************************************************************************/
328 303
329void * 304void *acpi_ut_allocate_object_desc_dbg(char *module_name,
330acpi_ut_allocate_object_desc_dbg ( 305 u32 line_number, u32 component_id)
331 char *module_name,
332 u32 line_number,
333 u32 component_id)
334{ 306{
335 union acpi_operand_object *object; 307 union acpi_operand_object *object;
336
337 308
338 ACPI_FUNCTION_TRACE ("ut_allocate_object_desc_dbg"); 309 ACPI_FUNCTION_TRACE("ut_allocate_object_desc_dbg");
339 310
340 311 object = acpi_os_acquire_object(acpi_gbl_operand_cache);
341 object = acpi_os_acquire_object (acpi_gbl_operand_cache);
342 if (!object) { 312 if (!object) {
343 _ACPI_REPORT_ERROR (module_name, line_number, component_id, 313 _ACPI_REPORT_ERROR(module_name, line_number, component_id,
344 ("Could not allocate an object descriptor\n")); 314 ("Could not allocate an object descriptor\n"));
345 315
346 return_PTR (NULL); 316 return_PTR(NULL);
347 } 317 }
348 318
349 /* Mark the descriptor type */ 319 /* Mark the descriptor type */
350 memset(object, 0, sizeof(union acpi_operand_object)); 320 memset(object, 0, sizeof(union acpi_operand_object));
351 ACPI_SET_DESCRIPTOR_TYPE (object, ACPI_DESC_TYPE_OPERAND); 321 ACPI_SET_DESCRIPTOR_TYPE(object, ACPI_DESC_TYPE_OPERAND);
352 322
353 ACPI_DEBUG_PRINT ((ACPI_DB_ALLOCATIONS, "%p Size %X\n", 323 ACPI_DEBUG_PRINT((ACPI_DB_ALLOCATIONS, "%p Size %X\n",
354 object, (u32) sizeof (union acpi_operand_object))); 324 object, (u32) sizeof(union acpi_operand_object)));
355 325
356 return_PTR (object); 326 return_PTR(object);
357} 327}
358 328
359
360/******************************************************************************* 329/*******************************************************************************
361 * 330 *
362 * FUNCTION: acpi_ut_delete_object_desc 331 * FUNCTION: acpi_ut_delete_object_desc
@@ -369,27 +338,23 @@ acpi_ut_allocate_object_desc_dbg (
369 * 338 *
370 ******************************************************************************/ 339 ******************************************************************************/
371 340
372void 341void acpi_ut_delete_object_desc(union acpi_operand_object *object)
373acpi_ut_delete_object_desc (
374 union acpi_operand_object *object)
375{ 342{
376 ACPI_FUNCTION_TRACE_PTR ("ut_delete_object_desc", object); 343 ACPI_FUNCTION_TRACE_PTR("ut_delete_object_desc", object);
377
378 344
379 /* Object must be an union acpi_operand_object */ 345 /* Object must be an union acpi_operand_object */
380 346
381 if (ACPI_GET_DESCRIPTOR_TYPE (object) != ACPI_DESC_TYPE_OPERAND) { 347 if (ACPI_GET_DESCRIPTOR_TYPE(object) != ACPI_DESC_TYPE_OPERAND) {
382 ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, 348 ACPI_DEBUG_PRINT((ACPI_DB_ERROR,
383 "%p is not an ACPI Operand object [%s]\n", object, 349 "%p is not an ACPI Operand object [%s]\n",
384 acpi_ut_get_descriptor_name (object))); 350 object, acpi_ut_get_descriptor_name(object)));
385 return_VOID; 351 return_VOID;
386 } 352 }
387 353
388 (void) acpi_os_release_object (acpi_gbl_operand_cache, object); 354 (void)acpi_os_release_object(acpi_gbl_operand_cache, object);
389 return_VOID; 355 return_VOID;
390} 356}
391 357
392
393/******************************************************************************* 358/*******************************************************************************
394 * 359 *
395 * FUNCTION: acpi_ut_get_simple_object_size 360 * FUNCTION: acpi_ut_get_simple_object_size
@@ -408,16 +373,13 @@ acpi_ut_delete_object_desc (
408 ******************************************************************************/ 373 ******************************************************************************/
409 374
410static acpi_status 375static acpi_status
411acpi_ut_get_simple_object_size ( 376acpi_ut_get_simple_object_size(union acpi_operand_object *internal_object,
412 union acpi_operand_object *internal_object, 377 acpi_size * obj_length)
413 acpi_size *obj_length)
414{ 378{
415 acpi_size length; 379 acpi_size length;
416 acpi_status status = AE_OK; 380 acpi_status status = AE_OK;
417
418
419 ACPI_FUNCTION_TRACE_PTR ("ut_get_simple_object_size", internal_object);
420 381
382 ACPI_FUNCTION_TRACE_PTR("ut_get_simple_object_size", internal_object);
421 383
422 /* 384 /*
423 * Handle a null object (Could be a uninitialized package 385 * Handle a null object (Could be a uninitialized package
@@ -425,18 +387,18 @@ acpi_ut_get_simple_object_size (
425 */ 387 */
426 if (!internal_object) { 388 if (!internal_object) {
427 *obj_length = 0; 389 *obj_length = 0;
428 return_ACPI_STATUS (AE_OK); 390 return_ACPI_STATUS(AE_OK);
429 } 391 }
430 392
431 /* Start with the length of the Acpi object */ 393 /* Start with the length of the Acpi object */
432 394
433 length = sizeof (union acpi_object); 395 length = sizeof(union acpi_object);
434 396
435 if (ACPI_GET_DESCRIPTOR_TYPE (internal_object) == ACPI_DESC_TYPE_NAMED) { 397 if (ACPI_GET_DESCRIPTOR_TYPE(internal_object) == ACPI_DESC_TYPE_NAMED) {
436 /* Object is a named object (reference), just return the length */ 398 /* Object is a named object (reference), just return the length */
437 399
438 *obj_length = ACPI_ROUND_UP_TO_NATIVE_WORD (length); 400 *obj_length = ACPI_ROUND_UP_TO_NATIVE_WORD(length);
439 return_ACPI_STATUS (status); 401 return_ACPI_STATUS(status);
440 } 402 }
441 403
442 /* 404 /*
@@ -445,19 +407,17 @@ acpi_ut_get_simple_object_size (
445 * must be accessed bytewise or there may be alignment problems on 407 * must be accessed bytewise or there may be alignment problems on
446 * certain processors 408 * certain processors
447 */ 409 */
448 switch (ACPI_GET_OBJECT_TYPE (internal_object)) { 410 switch (ACPI_GET_OBJECT_TYPE(internal_object)) {
449 case ACPI_TYPE_STRING: 411 case ACPI_TYPE_STRING:
450 412
451 length += (acpi_size) internal_object->string.length + 1; 413 length += (acpi_size) internal_object->string.length + 1;
452 break; 414 break;
453 415
454
455 case ACPI_TYPE_BUFFER: 416 case ACPI_TYPE_BUFFER:
456 417
457 length += (acpi_size) internal_object->buffer.length; 418 length += (acpi_size) internal_object->buffer.length;
458 break; 419 break;
459 420
460
461 case ACPI_TYPE_INTEGER: 421 case ACPI_TYPE_INTEGER:
462 case ACPI_TYPE_PROCESSOR: 422 case ACPI_TYPE_PROCESSOR:
463 case ACPI_TYPE_POWER: 423 case ACPI_TYPE_POWER:
@@ -467,7 +427,6 @@ acpi_ut_get_simple_object_size (
467 */ 427 */
468 break; 428 break;
469 429
470
471 case ACPI_TYPE_LOCAL_REFERENCE: 430 case ACPI_TYPE_LOCAL_REFERENCE:
472 431
473 switch (internal_object->reference.opcode) { 432 switch (internal_object->reference.opcode) {
@@ -477,8 +436,10 @@ acpi_ut_get_simple_object_size (
477 * Get the actual length of the full pathname to this object. 436 * Get the actual length of the full pathname to this object.
478 * The reference will be converted to the pathname to the object 437 * The reference will be converted to the pathname to the object
479 */ 438 */
480 length += ACPI_ROUND_UP_TO_NATIVE_WORD ( 439 length +=
481 acpi_ns_get_pathname_length (internal_object->reference.node)); 440 ACPI_ROUND_UP_TO_NATIVE_WORD
441 (acpi_ns_get_pathname_length
442 (internal_object->reference.node));
482 break; 443 break;
483 444
484 default: 445 default:
@@ -488,19 +449,21 @@ acpi_ut_get_simple_object_size (
488 * Notably, Locals and Args are not supported, but this may be 449 * Notably, Locals and Args are not supported, but this may be
489 * required eventually. 450 * required eventually.
490 */ 451 */
491 ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, 452 ACPI_DEBUG_PRINT((ACPI_DB_ERROR,
492 "Unsupported Reference opcode=%X in object %p\n", 453 "Unsupported Reference opcode=%X in object %p\n",
493 internal_object->reference.opcode, internal_object)); 454 internal_object->reference.opcode,
455 internal_object));
494 status = AE_TYPE; 456 status = AE_TYPE;
495 break; 457 break;
496 } 458 }
497 break; 459 break;
498 460
499
500 default: 461 default:
501 462
502 ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, "Unsupported type=%X in object %p\n", 463 ACPI_DEBUG_PRINT((ACPI_DB_ERROR,
503 ACPI_GET_OBJECT_TYPE (internal_object), internal_object)); 464 "Unsupported type=%X in object %p\n",
465 ACPI_GET_OBJECT_TYPE(internal_object),
466 internal_object));
504 status = AE_TYPE; 467 status = AE_TYPE;
505 break; 468 break;
506 } 469 }
@@ -511,11 +474,10 @@ acpi_ut_get_simple_object_size (
511 * on a machine word boundary. (preventing alignment faults on some 474 * on a machine word boundary. (preventing alignment faults on some
512 * machines.) 475 * machines.)
513 */ 476 */
514 *obj_length = ACPI_ROUND_UP_TO_NATIVE_WORD (length); 477 *obj_length = ACPI_ROUND_UP_TO_NATIVE_WORD(length);
515 return_ACPI_STATUS (status); 478 return_ACPI_STATUS(status);
516} 479}
517 480
518
519/******************************************************************************* 481/*******************************************************************************
520 * 482 *
521 * FUNCTION: acpi_ut_get_element_length 483 * FUNCTION: acpi_ut_get_element_length
@@ -529,16 +491,13 @@ acpi_ut_get_simple_object_size (
529 ******************************************************************************/ 491 ******************************************************************************/
530 492
531static acpi_status 493static acpi_status
532acpi_ut_get_element_length ( 494acpi_ut_get_element_length(u8 object_type,
533 u8 object_type, 495 union acpi_operand_object *source_object,
534 union acpi_operand_object *source_object, 496 union acpi_generic_state *state, void *context)
535 union acpi_generic_state *state,
536 void *context)
537{ 497{
538 acpi_status status = AE_OK; 498 acpi_status status = AE_OK;
539 struct acpi_pkg_info *info = (struct acpi_pkg_info *) context; 499 struct acpi_pkg_info *info = (struct acpi_pkg_info *)context;
540 acpi_size object_space; 500 acpi_size object_space;
541
542 501
543 switch (object_type) { 502 switch (object_type) {
544 case ACPI_COPY_TYPE_SIMPLE: 503 case ACPI_COPY_TYPE_SIMPLE:
@@ -547,15 +506,16 @@ acpi_ut_get_element_length (
547 * Simple object - just get the size (Null object/entry is handled 506 * Simple object - just get the size (Null object/entry is handled
548 * here also) and sum it into the running package length 507 * here also) and sum it into the running package length
549 */ 508 */
550 status = acpi_ut_get_simple_object_size (source_object, &object_space); 509 status =
551 if (ACPI_FAILURE (status)) { 510 acpi_ut_get_simple_object_size(source_object,
511 &object_space);
512 if (ACPI_FAILURE(status)) {
552 return (status); 513 return (status);
553 } 514 }
554 515
555 info->length += object_space; 516 info->length += object_space;
556 break; 517 break;
557 518
558
559 case ACPI_COPY_TYPE_PACKAGE: 519 case ACPI_COPY_TYPE_PACKAGE:
560 520
561 /* Package object - nothing much to do here, let the walk handle it */ 521 /* Package object - nothing much to do here, let the walk handle it */
@@ -564,7 +524,6 @@ acpi_ut_get_element_length (
564 state->pkg.this_target_obj = NULL; 524 state->pkg.this_target_obj = NULL;
565 break; 525 break;
566 526
567
568 default: 527 default:
569 528
570 /* No other types allowed */ 529 /* No other types allowed */
@@ -575,7 +534,6 @@ acpi_ut_get_element_length (
575 return (status); 534 return (status);
576} 535}
577 536
578
579/******************************************************************************* 537/*******************************************************************************
580 * 538 *
581 * FUNCTION: acpi_ut_get_package_object_size 539 * FUNCTION: acpi_ut_get_package_object_size
@@ -594,25 +552,22 @@ acpi_ut_get_element_length (
594 ******************************************************************************/ 552 ******************************************************************************/
595 553
596static acpi_status 554static acpi_status
597acpi_ut_get_package_object_size ( 555acpi_ut_get_package_object_size(union acpi_operand_object *internal_object,
598 union acpi_operand_object *internal_object, 556 acpi_size * obj_length)
599 acpi_size *obj_length)
600{ 557{
601 acpi_status status; 558 acpi_status status;
602 struct acpi_pkg_info info; 559 struct acpi_pkg_info info;
603 560
561 ACPI_FUNCTION_TRACE_PTR("ut_get_package_object_size", internal_object);
604 562
605 ACPI_FUNCTION_TRACE_PTR ("ut_get_package_object_size", internal_object); 563 info.length = 0;
606
607
608 info.length = 0;
609 info.object_space = 0; 564 info.object_space = 0;
610 info.num_packages = 1; 565 info.num_packages = 1;
611 566
612 status = acpi_ut_walk_package_tree (internal_object, NULL, 567 status = acpi_ut_walk_package_tree(internal_object, NULL,
613 acpi_ut_get_element_length, &info); 568 acpi_ut_get_element_length, &info);
614 if (ACPI_FAILURE (status)) { 569 if (ACPI_FAILURE(status)) {
615 return_ACPI_STATUS (status); 570 return_ACPI_STATUS(status);
616 } 571 }
617 572
618 /* 573 /*
@@ -620,16 +575,15 @@ acpi_ut_get_package_object_size (
620 * just add the length of the package objects themselves. 575 * just add the length of the package objects themselves.
621 * Round up to the next machine word. 576 * Round up to the next machine word.
622 */ 577 */
623 info.length += ACPI_ROUND_UP_TO_NATIVE_WORD (sizeof (union acpi_object)) * 578 info.length += ACPI_ROUND_UP_TO_NATIVE_WORD(sizeof(union acpi_object)) *
624 (acpi_size) info.num_packages; 579 (acpi_size) info.num_packages;
625 580
626 /* Return the total package length */ 581 /* Return the total package length */
627 582
628 *obj_length = info.length; 583 *obj_length = info.length;
629 return_ACPI_STATUS (status); 584 return_ACPI_STATUS(status);
630} 585}
631 586
632
633/******************************************************************************* 587/*******************************************************************************
634 * 588 *
635 * FUNCTION: acpi_ut_get_object_size 589 * FUNCTION: acpi_ut_get_object_size
@@ -645,25 +599,23 @@ acpi_ut_get_package_object_size (
645 ******************************************************************************/ 599 ******************************************************************************/
646 600
647acpi_status 601acpi_status
648acpi_ut_get_object_size ( 602acpi_ut_get_object_size(union acpi_operand_object *internal_object,
649 union acpi_operand_object *internal_object, 603 acpi_size * obj_length)
650 acpi_size *obj_length)
651{ 604{
652 acpi_status status; 605 acpi_status status;
653 606
654 607 ACPI_FUNCTION_ENTRY();
655 ACPI_FUNCTION_ENTRY (); 608
656 609 if ((ACPI_GET_DESCRIPTOR_TYPE(internal_object) ==
657 610 ACPI_DESC_TYPE_OPERAND)
658 if ((ACPI_GET_DESCRIPTOR_TYPE (internal_object) == ACPI_DESC_TYPE_OPERAND) && 611 && (ACPI_GET_OBJECT_TYPE(internal_object) == ACPI_TYPE_PACKAGE)) {
659 (ACPI_GET_OBJECT_TYPE (internal_object) == ACPI_TYPE_PACKAGE)) { 612 status =
660 status = acpi_ut_get_package_object_size (internal_object, obj_length); 613 acpi_ut_get_package_object_size(internal_object,
661 } 614 obj_length);
662 else { 615 } else {
663 status = acpi_ut_get_simple_object_size (internal_object, obj_length); 616 status =
617 acpi_ut_get_simple_object_size(internal_object, obj_length);
664 } 618 }
665 619
666 return (status); 620 return (status);
667} 621}
668
669