diff options
Diffstat (limited to 'drivers/acpi/parser/psutils.c')
-rw-r--r-- | drivers/acpi/parser/psutils.c | 105 |
1 files changed, 34 insertions, 71 deletions
diff --git a/drivers/acpi/parser/psutils.c b/drivers/acpi/parser/psutils.c index 4221b41ae1a..2075efbb432 100644 --- a/drivers/acpi/parser/psutils.c +++ b/drivers/acpi/parser/psutils.c @@ -41,14 +41,12 @@ * POSSIBILITY OF SUCH DAMAGES. */ - #include <acpi/acpi.h> #include <acpi/acparser.h> #include <acpi/amlcode.h> #define _COMPONENT ACPI_PARSER - ACPI_MODULE_NAME ("psutils") - +ACPI_MODULE_NAME("psutils") /******************************************************************************* * @@ -61,15 +59,11 @@ * DESCRIPTION: Create a Scope and associated namepath op with the root name * ******************************************************************************/ - -union acpi_parse_object * -acpi_ps_create_scope_op ( - void) +union acpi_parse_object *acpi_ps_create_scope_op(void) { - union acpi_parse_object *scope_op; + union acpi_parse_object *scope_op; - - scope_op = acpi_ps_alloc_op (AML_SCOPE_OP); + scope_op = acpi_ps_alloc_op(AML_SCOPE_OP); if (!scope_op) { return (NULL); } @@ -78,7 +72,6 @@ acpi_ps_create_scope_op ( return (scope_op); } - /******************************************************************************* * * FUNCTION: acpi_ps_init_op @@ -92,23 +85,19 @@ acpi_ps_create_scope_op ( * ******************************************************************************/ -void -acpi_ps_init_op ( - union acpi_parse_object *op, - u16 opcode) +void acpi_ps_init_op(union acpi_parse_object *op, u16 opcode) { - ACPI_FUNCTION_ENTRY (); - + ACPI_FUNCTION_ENTRY(); op->common.data_type = ACPI_DESC_TYPE_PARSER; op->common.aml_opcode = opcode; - ACPI_DISASM_ONLY_MEMBERS (ACPI_STRNCPY (op->common.aml_op_name, - (acpi_ps_get_opcode_info (opcode))->name, - sizeof (op->common.aml_op_name))); + ACPI_DISASM_ONLY_MEMBERS(ACPI_STRNCPY(op->common.aml_op_name, + (acpi_ps_get_opcode_info + (opcode))->name, + sizeof(op->common.aml_op_name))); } - /******************************************************************************* * * FUNCTION: acpi_ps_alloc_op @@ -123,29 +112,23 @@ acpi_ps_init_op ( * ******************************************************************************/ -union acpi_parse_object* -acpi_ps_alloc_op ( - u16 opcode) +union acpi_parse_object *acpi_ps_alloc_op(u16 opcode) { - union acpi_parse_object *op; - const struct acpi_opcode_info *op_info; - u8 flags = ACPI_PARSEOP_GENERIC; - - - ACPI_FUNCTION_ENTRY (); + union acpi_parse_object *op; + const struct acpi_opcode_info *op_info; + u8 flags = ACPI_PARSEOP_GENERIC; + ACPI_FUNCTION_ENTRY(); - op_info = acpi_ps_get_opcode_info (opcode); + op_info = acpi_ps_get_opcode_info(opcode); /* Determine type of parse_op required */ if (op_info->flags & AML_DEFER) { flags = ACPI_PARSEOP_DEFERRED; - } - else if (op_info->flags & AML_NAMED) { + } else if (op_info->flags & AML_NAMED) { flags = ACPI_PARSEOP_NAMED; - } - else if (opcode == AML_INT_BYTELIST_OP) { + } else if (opcode == AML_INT_BYTELIST_OP) { flags = ACPI_PARSEOP_BYTELIST; } @@ -154,27 +137,25 @@ acpi_ps_alloc_op ( if (flags == ACPI_PARSEOP_GENERIC) { /* The generic op (default) is by far the most common (16 to 1) */ - op = acpi_os_acquire_object (acpi_gbl_ps_node_cache); + op = acpi_os_acquire_object(acpi_gbl_ps_node_cache); memset(op, 0, sizeof(struct acpi_parse_obj_common)); - } - else { + } else { /* Extended parseop */ - op = acpi_os_acquire_object (acpi_gbl_ps_node_ext_cache); + op = acpi_os_acquire_object(acpi_gbl_ps_node_ext_cache); memset(op, 0, sizeof(struct acpi_parse_obj_named)); } /* Initialize the Op */ if (op) { - acpi_ps_init_op (op, opcode); + acpi_ps_init_op(op, opcode); op->common.flags = flags; } return (op); } - /******************************************************************************* * * FUNCTION: acpi_ps_free_op @@ -188,26 +169,22 @@ acpi_ps_alloc_op ( * ******************************************************************************/ -void -acpi_ps_free_op ( - union acpi_parse_object *op) +void acpi_ps_free_op(union acpi_parse_object *op) { - ACPI_FUNCTION_NAME ("ps_free_op"); - + ACPI_FUNCTION_NAME("ps_free_op"); if (op->common.aml_opcode == AML_INT_RETURN_VALUE_OP) { - ACPI_DEBUG_PRINT ((ACPI_DB_ALLOCATIONS, "Free retval op: %p\n", op)); + ACPI_DEBUG_PRINT((ACPI_DB_ALLOCATIONS, "Free retval op: %p\n", + op)); } if (op->common.flags & ACPI_PARSEOP_GENERIC) { - (void) acpi_os_release_object (acpi_gbl_ps_node_cache, op); - } - else { - (void) acpi_os_release_object (acpi_gbl_ps_node_ext_cache, op); + (void)acpi_os_release_object(acpi_gbl_ps_node_cache, op); + } else { + (void)acpi_os_release_object(acpi_gbl_ps_node_ext_cache, op); } } - /******************************************************************************* * * FUNCTION: Utility functions @@ -216,36 +193,27 @@ acpi_ps_free_op ( * ******************************************************************************/ - /* * Is "c" a namestring lead character? */ -u8 -acpi_ps_is_leading_char ( - u32 c) +u8 acpi_ps_is_leading_char(u32 c) { return ((u8) (c == '_' || (c >= 'A' && c <= 'Z'))); } - /* * Is "c" a namestring prefix character? */ -u8 -acpi_ps_is_prefix_char ( - u32 c) +u8 acpi_ps_is_prefix_char(u32 c) { return ((u8) (c == '\\' || c == '^')); } - /* * Get op's name (4-byte name segment) or 0 if unnamed */ #ifdef ACPI_FUTURE_USAGE -u32 -acpi_ps_get_name ( - union acpi_parse_object *op) +u32 acpi_ps_get_name(union acpi_parse_object * op) { /* The "generic" object has no name associated with it */ @@ -258,16 +226,12 @@ acpi_ps_get_name ( return (op->named.name); } -#endif /* ACPI_FUTURE_USAGE */ - +#endif /* ACPI_FUTURE_USAGE */ /* * Set op's name */ -void -acpi_ps_set_name ( - union acpi_parse_object *op, - u32 name) +void acpi_ps_set_name(union acpi_parse_object *op, u32 name) { /* The "generic" object has no name associated with it */ @@ -278,4 +242,3 @@ acpi_ps_set_name ( op->named.name = name; } - |