diff options
Diffstat (limited to 'drivers/acpi/acpica/nsrepair2.c')
-rw-r--r-- | drivers/acpi/acpica/nsrepair2.c | 110 |
1 files changed, 10 insertions, 100 deletions
diff --git a/drivers/acpi/acpica/nsrepair2.c b/drivers/acpi/acpica/nsrepair2.c index f13691c1cca5..61bd0f6755d2 100644 --- a/drivers/acpi/acpica/nsrepair2.c +++ b/drivers/acpi/acpica/nsrepair2.c | |||
@@ -6,7 +6,7 @@ | |||
6 | *****************************************************************************/ | 6 | *****************************************************************************/ |
7 | 7 | ||
8 | /* | 8 | /* |
9 | * Copyright (C) 2000 - 2009, Intel Corp. | 9 | * Copyright (C) 2000 - 2010, Intel Corp. |
10 | * All rights reserved. | 10 | * All rights reserved. |
11 | * | 11 | * |
12 | * Redistribution and use in source and binary forms, with or without | 12 | * Redistribution and use in source and binary forms, with or without |
@@ -45,7 +45,6 @@ | |||
45 | #include <acpi/acpi.h> | 45 | #include <acpi/acpi.h> |
46 | #include "accommon.h" | 46 | #include "accommon.h" |
47 | #include "acnamesp.h" | 47 | #include "acnamesp.h" |
48 | #include "acpredef.h" | ||
49 | 48 | ||
50 | #define _COMPONENT ACPI_NAMESPACE | 49 | #define _COMPONENT ACPI_NAMESPACE |
51 | ACPI_MODULE_NAME("nsrepair2") | 50 | ACPI_MODULE_NAME("nsrepair2") |
@@ -93,7 +92,7 @@ acpi_ns_check_sorted_list(struct acpi_predefined_data *data, | |||
93 | u32 sort_index, | 92 | u32 sort_index, |
94 | u8 sort_direction, char *sort_key_name); | 93 | u8 sort_direction, char *sort_key_name); |
95 | 94 | ||
96 | static acpi_status | 95 | static void |
97 | acpi_ns_sort_list(union acpi_operand_object **elements, | 96 | acpi_ns_sort_list(union acpi_operand_object **elements, |
98 | u32 count, u32 index, u8 sort_direction); | 97 | u32 count, u32 index, u8 sort_direction); |
99 | 98 | ||
@@ -443,7 +442,6 @@ acpi_ns_check_sorted_list(struct acpi_predefined_data *data, | |||
443 | union acpi_operand_object *obj_desc; | 442 | union acpi_operand_object *obj_desc; |
444 | u32 i; | 443 | u32 i; |
445 | u32 previous_value; | 444 | u32 previous_value; |
446 | acpi_status status; | ||
447 | 445 | ||
448 | ACPI_FUNCTION_NAME(ns_check_sorted_list); | 446 | ACPI_FUNCTION_NAME(ns_check_sorted_list); |
449 | 447 | ||
@@ -494,19 +492,15 @@ acpi_ns_check_sorted_list(struct acpi_predefined_data *data, | |||
494 | 492 | ||
495 | /* | 493 | /* |
496 | * The list must be sorted in the specified order. If we detect a | 494 | * The list must be sorted in the specified order. If we detect a |
497 | * discrepancy, issue a warning and sort the entire list | 495 | * discrepancy, sort the entire list. |
498 | */ | 496 | */ |
499 | if (((sort_direction == ACPI_SORT_ASCENDING) && | 497 | if (((sort_direction == ACPI_SORT_ASCENDING) && |
500 | (obj_desc->integer.value < previous_value)) || | 498 | (obj_desc->integer.value < previous_value)) || |
501 | ((sort_direction == ACPI_SORT_DESCENDING) && | 499 | ((sort_direction == ACPI_SORT_DESCENDING) && |
502 | (obj_desc->integer.value > previous_value))) { | 500 | (obj_desc->integer.value > previous_value))) { |
503 | status = | 501 | acpi_ns_sort_list(return_object->package.elements, |
504 | acpi_ns_sort_list(return_object->package.elements, | 502 | outer_element_count, sort_index, |
505 | outer_element_count, sort_index, | 503 | sort_direction); |
506 | sort_direction); | ||
507 | if (ACPI_FAILURE(status)) { | ||
508 | return (status); | ||
509 | } | ||
510 | 504 | ||
511 | data->flags |= ACPI_OBJECT_REPAIRED; | 505 | data->flags |= ACPI_OBJECT_REPAIRED; |
512 | 506 | ||
@@ -525,89 +519,6 @@ acpi_ns_check_sorted_list(struct acpi_predefined_data *data, | |||
525 | 519 | ||
526 | /****************************************************************************** | 520 | /****************************************************************************** |
527 | * | 521 | * |
528 | * FUNCTION: acpi_ns_remove_null_elements | ||
529 | * | ||
530 | * PARAMETERS: Data - Pointer to validation data structure | ||
531 | * package_type - An acpi_return_package_types value | ||
532 | * obj_desc - A Package object | ||
533 | * | ||
534 | * RETURN: None. | ||
535 | * | ||
536 | * DESCRIPTION: Remove all NULL package elements from packages that contain | ||
537 | * a variable number of sub-packages. | ||
538 | * | ||
539 | *****************************************************************************/ | ||
540 | |||
541 | void | ||
542 | acpi_ns_remove_null_elements(struct acpi_predefined_data *data, | ||
543 | u8 package_type, | ||
544 | union acpi_operand_object *obj_desc) | ||
545 | { | ||
546 | union acpi_operand_object **source; | ||
547 | union acpi_operand_object **dest; | ||
548 | u32 count; | ||
549 | u32 new_count; | ||
550 | u32 i; | ||
551 | |||
552 | ACPI_FUNCTION_NAME(ns_remove_null_elements); | ||
553 | |||
554 | /* | ||
555 | * PTYPE1 packages contain no subpackages. | ||
556 | * PTYPE2 packages contain a variable number of sub-packages. We can | ||
557 | * safely remove all NULL elements from the PTYPE2 packages. | ||
558 | */ | ||
559 | switch (package_type) { | ||
560 | case ACPI_PTYPE1_FIXED: | ||
561 | case ACPI_PTYPE1_VAR: | ||
562 | case ACPI_PTYPE1_OPTION: | ||
563 | return; | ||
564 | |||
565 | case ACPI_PTYPE2: | ||
566 | case ACPI_PTYPE2_COUNT: | ||
567 | case ACPI_PTYPE2_PKG_COUNT: | ||
568 | case ACPI_PTYPE2_FIXED: | ||
569 | case ACPI_PTYPE2_MIN: | ||
570 | case ACPI_PTYPE2_REV_FIXED: | ||
571 | break; | ||
572 | |||
573 | default: | ||
574 | return; | ||
575 | } | ||
576 | |||
577 | count = obj_desc->package.count; | ||
578 | new_count = count; | ||
579 | |||
580 | source = obj_desc->package.elements; | ||
581 | dest = source; | ||
582 | |||
583 | /* Examine all elements of the package object, remove nulls */ | ||
584 | |||
585 | for (i = 0; i < count; i++) { | ||
586 | if (!*source) { | ||
587 | new_count--; | ||
588 | } else { | ||
589 | *dest = *source; | ||
590 | dest++; | ||
591 | } | ||
592 | source++; | ||
593 | } | ||
594 | |||
595 | /* Update parent package if any null elements were removed */ | ||
596 | |||
597 | if (new_count < count) { | ||
598 | ACPI_DEBUG_PRINT((ACPI_DB_REPAIR, | ||
599 | "%s: Found and removed %u NULL elements\n", | ||
600 | data->pathname, (count - new_count))); | ||
601 | |||
602 | /* NULL terminate list and update the package count */ | ||
603 | |||
604 | *dest = NULL; | ||
605 | obj_desc->package.count = new_count; | ||
606 | } | ||
607 | } | ||
608 | |||
609 | /****************************************************************************** | ||
610 | * | ||
611 | * FUNCTION: acpi_ns_sort_list | 522 | * FUNCTION: acpi_ns_sort_list |
612 | * | 523 | * |
613 | * PARAMETERS: Elements - Package object element list | 524 | * PARAMETERS: Elements - Package object element list |
@@ -615,15 +526,16 @@ acpi_ns_remove_null_elements(struct acpi_predefined_data *data, | |||
615 | * Index - Sort by which package element | 526 | * Index - Sort by which package element |
616 | * sort_direction - Ascending or Descending sort | 527 | * sort_direction - Ascending or Descending sort |
617 | * | 528 | * |
618 | * RETURN: Status | 529 | * RETURN: None |
619 | * | 530 | * |
620 | * DESCRIPTION: Sort the objects that are in a package element list. | 531 | * DESCRIPTION: Sort the objects that are in a package element list. |
621 | * | 532 | * |
622 | * NOTE: Assumes that all NULL elements have been removed from the package. | 533 | * NOTE: Assumes that all NULL elements have been removed from the package, |
534 | * and that all elements have been verified to be of type Integer. | ||
623 | * | 535 | * |
624 | *****************************************************************************/ | 536 | *****************************************************************************/ |
625 | 537 | ||
626 | static acpi_status | 538 | static void |
627 | acpi_ns_sort_list(union acpi_operand_object **elements, | 539 | acpi_ns_sort_list(union acpi_operand_object **elements, |
628 | u32 count, u32 index, u8 sort_direction) | 540 | u32 count, u32 index, u8 sort_direction) |
629 | { | 541 | { |
@@ -652,6 +564,4 @@ acpi_ns_sort_list(union acpi_operand_object **elements, | |||
652 | } | 564 | } |
653 | } | 565 | } |
654 | } | 566 | } |
655 | |||
656 | return (AE_OK); | ||
657 | } | 567 | } |