From 091f4d718620a79698e1c8ca3e9acbf78eb62da3 Mon Sep 17 00:00:00 2001 From: Bob Moore Date: Thu, 21 Jan 2010 09:28:32 +0800 Subject: ACPICA: Predefined name repair: fix NULL package elements For the predefined methods that return fixed-length packages (or subpackages), attempt repair for a NULL element. Create an Integer of value 0, a NULL String, or a zero-length buffer as appropriate. http://www.acpica.org/bugzilla/show_bug.cgi?id=818 Signed-off-by: Bob Moore Signed-off-by: Lin Ming Signed-off-by: Len Brown --- drivers/acpi/acpica/nsrepair2.c | 84 ----------------------------------------- 1 file changed, 84 deletions(-) (limited to 'drivers/acpi/acpica/nsrepair2.c') diff --git a/drivers/acpi/acpica/nsrepair2.c b/drivers/acpi/acpica/nsrepair2.c index 29ff5d14e1d..61bd0f6755d 100644 --- a/drivers/acpi/acpica/nsrepair2.c +++ b/drivers/acpi/acpica/nsrepair2.c @@ -45,7 +45,6 @@ #include #include "accommon.h" #include "acnamesp.h" -#include "acpredef.h" #define _COMPONENT ACPI_NAMESPACE ACPI_MODULE_NAME("nsrepair2") @@ -518,89 +517,6 @@ acpi_ns_check_sorted_list(struct acpi_predefined_data *data, return (AE_OK); } -/****************************************************************************** - * - * FUNCTION: acpi_ns_remove_null_elements - * - * PARAMETERS: Data - Pointer to validation data structure - * package_type - An acpi_return_package_types value - * obj_desc - A Package object - * - * RETURN: None. - * - * DESCRIPTION: Remove all NULL package elements from packages that contain - * a variable number of sub-packages. - * - *****************************************************************************/ - -void -acpi_ns_remove_null_elements(struct acpi_predefined_data *data, - u8 package_type, - union acpi_operand_object *obj_desc) -{ - union acpi_operand_object **source; - union acpi_operand_object **dest; - u32 count; - u32 new_count; - u32 i; - - ACPI_FUNCTION_NAME(ns_remove_null_elements); - - /* - * PTYPE1 packages contain no subpackages. - * PTYPE2 packages contain a variable number of sub-packages. We can - * safely remove all NULL elements from the PTYPE2 packages. - */ - switch (package_type) { - case ACPI_PTYPE1_FIXED: - case ACPI_PTYPE1_VAR: - case ACPI_PTYPE1_OPTION: - return; - - case ACPI_PTYPE2: - case ACPI_PTYPE2_COUNT: - case ACPI_PTYPE2_PKG_COUNT: - case ACPI_PTYPE2_FIXED: - case ACPI_PTYPE2_MIN: - case ACPI_PTYPE2_REV_FIXED: - break; - - default: - return; - } - - count = obj_desc->package.count; - new_count = count; - - source = obj_desc->package.elements; - dest = source; - - /* Examine all elements of the package object, remove nulls */ - - for (i = 0; i < count; i++) { - if (!*source) { - new_count--; - } else { - *dest = *source; - dest++; - } - source++; - } - - /* Update parent package if any null elements were removed */ - - if (new_count < count) { - ACPI_DEBUG_PRINT((ACPI_DB_REPAIR, - "%s: Found and removed %u NULL elements\n", - data->pathname, (count - new_count))); - - /* NULL terminate list and update the package count */ - - *dest = NULL; - obj_desc->package.count = new_count; - } -} - /****************************************************************************** * * FUNCTION: acpi_ns_sort_list -- cgit v1.2.3