summaryrefslogtreecommitdiff
path: root/drivers/acpi/namespace
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/acpi/namespace')
-rw-r--r--drivers/acpi/namespace/nsaccess.c355
-rw-r--r--drivers/acpi/namespace/nsalloc.c350
-rw-r--r--drivers/acpi/namespace/nsdump.c461
-rw-r--r--drivers/acpi/namespace/nsdumpdv.c74
-rw-r--r--drivers/acpi/namespace/nseval.c274
-rw-r--r--drivers/acpi/namespace/nsinit.c257
-rw-r--r--drivers/acpi/namespace/nsload.c264
-rw-r--r--drivers/acpi/namespace/nsnames.c118
-rw-r--r--drivers/acpi/namespace/nsobject.c209
-rw-r--r--drivers/acpi/namespace/nsparse.c84
-rw-r--r--drivers/acpi/namespace/nssearch.c205
-rw-r--r--drivers/acpi/namespace/nsutils.c502
-rw-r--r--drivers/acpi/namespace/nswalk.c105
-rw-r--r--drivers/acpi/namespace/nsxfeval.c430
-rw-r--r--drivers/acpi/namespace/nsxfname.c173
-rw-r--r--drivers/acpi/namespace/nsxfobj.c91
16 files changed, 1721 insertions, 2231 deletions
diff --git a/drivers/acpi/namespace/nsaccess.c b/drivers/acpi/namespace/nsaccess.c
index ece7a9dedd5c..edfbe34600f5 100644
--- a/drivers/acpi/namespace/nsaccess.c
+++ b/drivers/acpi/namespace/nsaccess.c
@@ -41,16 +41,13 @@
* POSSIBILITY OF SUCH DAMAGES.
*/
-
#include <acpi/acpi.h>
#include <acpi/amlcode.h>
#include <acpi/acnamesp.h>
#include <acpi/acdispat.h>
-
#define _COMPONENT ACPI_NAMESPACE
- ACPI_MODULE_NAME ("nsaccess")
-
+ACPI_MODULE_NAME("nsaccess")
/*******************************************************************************
*
@@ -65,24 +62,19 @@
* MUTEX: Locks namespace for entire execution
*
******************************************************************************/
-
-acpi_status
-acpi_ns_root_initialize (
- void)
+acpi_status acpi_ns_root_initialize(void)
{
- acpi_status status;
+ acpi_status status;
const struct acpi_predefined_names *init_val = NULL;
- struct acpi_namespace_node *new_node;
- union acpi_operand_object *obj_desc;
- acpi_string val = NULL;
-
-
- ACPI_FUNCTION_TRACE ("ns_root_initialize");
+ struct acpi_namespace_node *new_node;
+ union acpi_operand_object *obj_desc;
+ acpi_string val = NULL;
+ ACPI_FUNCTION_TRACE("ns_root_initialize");
- status = acpi_ut_acquire_mutex (ACPI_MTX_NAMESPACE);
- if (ACPI_FAILURE (status)) {
- return_ACPI_STATUS (status);
+ status = acpi_ut_acquire_mutex(ACPI_MTX_NAMESPACE);
+ if (ACPI_FAILURE(status)) {
+ return_ACPI_STATUS(status);
}
/*
@@ -102,24 +94,26 @@ acpi_ns_root_initialize (
/* Enter the pre-defined names in the name table */
- ACPI_DEBUG_PRINT ((ACPI_DB_INFO,
- "Entering predefined entries into namespace\n"));
+ ACPI_DEBUG_PRINT((ACPI_DB_INFO,
+ "Entering predefined entries into namespace\n"));
for (init_val = acpi_gbl_pre_defined_names; init_val->name; init_val++) {
/* _OSI is optional for now, will be permanent later */
- if (!ACPI_STRCMP (init_val->name, "_OSI") && !acpi_gbl_create_osi_method) {
+ if (!ACPI_STRCMP(init_val->name, "_OSI")
+ && !acpi_gbl_create_osi_method) {
continue;
}
- status = acpi_ns_lookup (NULL, init_val->name, init_val->type,
- ACPI_IMODE_LOAD_PASS2, ACPI_NS_NO_UPSEARCH,
- NULL, &new_node);
+ status = acpi_ns_lookup(NULL, init_val->name, init_val->type,
+ ACPI_IMODE_LOAD_PASS2,
+ ACPI_NS_NO_UPSEARCH, NULL, &new_node);
- if (ACPI_FAILURE (status) || (!new_node)) /* Must be on same line for code converter */ {
- ACPI_DEBUG_PRINT ((ACPI_DB_ERROR,
- "Could not create predefined name %s, %s\n",
- init_val->name, acpi_format_exception (status)));
+ if (ACPI_FAILURE(status) || (!new_node)) { /* Must be on same line for code converter */
+ ACPI_DEBUG_PRINT((ACPI_DB_ERROR,
+ "Could not create predefined name %s, %s\n",
+ init_val->name,
+ acpi_format_exception(status)));
}
/*
@@ -128,11 +122,11 @@ acpi_ns_root_initialize (
* initial value, create the initial value.
*/
if (init_val->val) {
- status = acpi_os_predefined_override (init_val, &val);
- if (ACPI_FAILURE (status)) {
- ACPI_DEBUG_PRINT ((ACPI_DB_ERROR,
- "Could not override predefined %s\n",
- init_val->name));
+ status = acpi_os_predefined_override(init_val, &val);
+ if (ACPI_FAILURE(status)) {
+ ACPI_DEBUG_PRINT((ACPI_DB_ERROR,
+ "Could not override predefined %s\n",
+ init_val->name));
}
if (!val) {
@@ -143,7 +137,8 @@ acpi_ns_root_initialize (
* Entry requests an initial value, allocate a
* descriptor for it.
*/
- obj_desc = acpi_ut_create_internal_object (init_val->type);
+ obj_desc =
+ acpi_ut_create_internal_object(init_val->type);
if (!obj_desc) {
status = AE_NO_MEMORY;
goto unlock_and_exit;
@@ -156,55 +151,62 @@ acpi_ns_root_initialize (
*/
switch (init_val->type) {
case ACPI_TYPE_METHOD:
- obj_desc->method.param_count = (u8) ACPI_TO_INTEGER (val);
+ obj_desc->method.param_count =
+ (u8) ACPI_TO_INTEGER(val);
obj_desc->common.flags |= AOPOBJ_DATA_VALID;
-#if defined (_ACPI_ASL_COMPILER) || defined (_ACPI_DUMP_App)
+#if defined (ACPI_ASL_COMPILER)
- /*
- * i_aSL Compiler cheats by putting parameter count
- * in the owner_iD
- */
- new_node->owner_id = obj_desc->method.param_count;
+ /* save the parameter count for the i_aSL compiler */
+
+ new_node->value = obj_desc->method.param_count;
#else
/* Mark this as a very SPECIAL method */
- obj_desc->method.method_flags = AML_METHOD_INTERNAL_ONLY;
- obj_desc->method.implementation = acpi_ut_osi_implementation;
+ obj_desc->method.method_flags =
+ AML_METHOD_INTERNAL_ONLY;
+
+#ifndef ACPI_DUMP_APP
+ obj_desc->method.implementation =
+ acpi_ut_osi_implementation;
+#endif
#endif
break;
case ACPI_TYPE_INTEGER:
- obj_desc->integer.value = ACPI_TO_INTEGER (val);
+ obj_desc->integer.value = ACPI_TO_INTEGER(val);
break;
-
case ACPI_TYPE_STRING:
/*
* Build an object around the static string
*/
- obj_desc->string.length = (u32) ACPI_STRLEN (val);
+ obj_desc->string.length =
+ (u32) ACPI_STRLEN(val);
obj_desc->string.pointer = val;
obj_desc->common.flags |= AOPOBJ_STATIC_POINTER;
break;
-
case ACPI_TYPE_MUTEX:
obj_desc->mutex.node = new_node;
- obj_desc->mutex.sync_level = (u8) (ACPI_TO_INTEGER (val) - 1);
+ obj_desc->mutex.sync_level =
+ (u8) (ACPI_TO_INTEGER(val) - 1);
- if (ACPI_STRCMP (init_val->name, "_GL_") == 0) {
+ if (ACPI_STRCMP(init_val->name, "_GL_") == 0) {
/*
* Create a counting semaphore for the
* global lock
*/
- status = acpi_os_create_semaphore (ACPI_NO_UNIT_LIMIT,
- 1, &obj_desc->mutex.semaphore);
- if (ACPI_FAILURE (status)) {
- acpi_ut_remove_reference (obj_desc);
+ status =
+ acpi_os_create_semaphore
+ (ACPI_NO_UNIT_LIMIT, 1,
+ &obj_desc->mutex.semaphore);
+ if (ACPI_FAILURE(status)) {
+ acpi_ut_remove_reference
+ (obj_desc);
goto unlock_and_exit;
}
@@ -212,56 +214,58 @@ acpi_ns_root_initialize (
* We just created the mutex for the
* global lock, save it
*/
- acpi_gbl_global_lock_semaphore = obj_desc->mutex.semaphore;
- }
- else {
+ acpi_gbl_global_lock_semaphore =
+ obj_desc->mutex.semaphore;
+ } else {
/* Create a mutex */
- status = acpi_os_create_semaphore (1, 1,
- &obj_desc->mutex.semaphore);
- if (ACPI_FAILURE (status)) {
- acpi_ut_remove_reference (obj_desc);
+ status = acpi_os_create_semaphore(1, 1,
+ &obj_desc->
+ mutex.
+ semaphore);
+ if (ACPI_FAILURE(status)) {
+ acpi_ut_remove_reference
+ (obj_desc);
goto unlock_and_exit;
}
}
break;
-
default:
- ACPI_REPORT_ERROR (("Unsupported initial type value %X\n",
- init_val->type));
- acpi_ut_remove_reference (obj_desc);
+ ACPI_REPORT_ERROR(("Unsupported initial type value %X\n", init_val->type));
+ acpi_ut_remove_reference(obj_desc);
obj_desc = NULL;
continue;
}
/* Store pointer to value descriptor in the Node */
- status = acpi_ns_attach_object (new_node, obj_desc,
- ACPI_GET_OBJECT_TYPE (obj_desc));
+ status = acpi_ns_attach_object(new_node, obj_desc,
+ ACPI_GET_OBJECT_TYPE
+ (obj_desc));
/* Remove local reference to the object */
- acpi_ut_remove_reference (obj_desc);
+ acpi_ut_remove_reference(obj_desc);
}
}
-
-unlock_and_exit:
- (void) acpi_ut_release_mutex (ACPI_MTX_NAMESPACE);
+ unlock_and_exit:
+ (void)acpi_ut_release_mutex(ACPI_MTX_NAMESPACE);
/* Save a handle to "_GPE", it is always present */
- if (ACPI_SUCCESS (status)) {
- status = acpi_ns_get_node_by_path ("\\_GPE", NULL, ACPI_NS_NO_UPSEARCH,
- &acpi_gbl_fadt_gpe_device);
+ if (ACPI_SUCCESS(status)) {
+ status =
+ acpi_ns_get_node_by_path("\\_GPE", NULL,
+ ACPI_NS_NO_UPSEARCH,
+ &acpi_gbl_fadt_gpe_device);
}
- return_ACPI_STATUS (status);
+ return_ACPI_STATUS(status);
}
-
/*******************************************************************************
*
* FUNCTION: acpi_ns_lookup
@@ -286,62 +290,57 @@ unlock_and_exit:
******************************************************************************/
acpi_status
-acpi_ns_lookup (
- union acpi_generic_state *scope_info,
- char *pathname,
- acpi_object_type type,
- acpi_interpreter_mode interpreter_mode,
- u32 flags,
- struct acpi_walk_state *walk_state,
- struct acpi_namespace_node **return_node)
+acpi_ns_lookup(union acpi_generic_state *scope_info,
+ char *pathname,
+ acpi_object_type type,
+ acpi_interpreter_mode interpreter_mode,
+ u32 flags,
+ struct acpi_walk_state *walk_state,
+ struct acpi_namespace_node **return_node)
{
- acpi_status status;
- char *path = pathname;
- struct acpi_namespace_node *prefix_node;
- struct acpi_namespace_node *current_node = NULL;
- struct acpi_namespace_node *this_node = NULL;
- u32 num_segments;
- u32 num_carats;
- acpi_name simple_name;
- acpi_object_type type_to_check_for;
- acpi_object_type this_search_type;
- u32 search_parent_flag = ACPI_NS_SEARCH_PARENT;
- u32 local_flags = flags & ~(ACPI_NS_ERROR_IF_FOUND |
- ACPI_NS_SEARCH_PARENT);
-
-
- ACPI_FUNCTION_TRACE ("ns_lookup");
-
+ acpi_status status;
+ char *path = pathname;
+ struct acpi_namespace_node *prefix_node;
+ struct acpi_namespace_node *current_node = NULL;
+ struct acpi_namespace_node *this_node = NULL;
+ u32 num_segments;
+ u32 num_carats;
+ acpi_name simple_name;
+ acpi_object_type type_to_check_for;
+ acpi_object_type this_search_type;
+ u32 search_parent_flag = ACPI_NS_SEARCH_PARENT;
+ u32 local_flags = flags & ~(ACPI_NS_ERROR_IF_FOUND |
+ ACPI_NS_SEARCH_PARENT);
+
+ ACPI_FUNCTION_TRACE("ns_lookup");
if (!return_node) {
- return_ACPI_STATUS (AE_BAD_PARAMETER);
+ return_ACPI_STATUS(AE_BAD_PARAMETER);
}
acpi_gbl_ns_lookup_count++;
*return_node = ACPI_ENTRY_NOT_FOUND;
if (!acpi_gbl_root_node) {
- return_ACPI_STATUS (AE_NO_NAMESPACE);
+ return_ACPI_STATUS(AE_NO_NAMESPACE);
}
/*
* Get the prefix scope.
* A null scope means use the root scope
*/
- if ((!scope_info) ||
- (!scope_info->scope.node)) {
- ACPI_DEBUG_PRINT ((ACPI_DB_NAMES,
- "Null scope prefix, using root node (%p)\n",
- acpi_gbl_root_node));
+ if ((!scope_info) || (!scope_info->scope.node)) {
+ ACPI_DEBUG_PRINT((ACPI_DB_NAMES,
+ "Null scope prefix, using root node (%p)\n",
+ acpi_gbl_root_node));
prefix_node = acpi_gbl_root_node;
- }
- else {
+ } else {
prefix_node = scope_info->scope.node;
- if (ACPI_GET_DESCRIPTOR_TYPE (prefix_node) != ACPI_DESC_TYPE_NAMED) {
- ACPI_REPORT_ERROR (("ns_lookup: %p is not a namespace node [%s]\n",
- prefix_node, acpi_ut_get_descriptor_name (prefix_node)));
- return_ACPI_STATUS (AE_AML_INTERNAL);
+ if (ACPI_GET_DESCRIPTOR_TYPE(prefix_node) !=
+ ACPI_DESC_TYPE_NAMED) {
+ ACPI_REPORT_ERROR(("ns_lookup: %p is not a namespace node [%s]\n", prefix_node, acpi_ut_get_descriptor_name(prefix_node)));
+ return_ACPI_STATUS(AE_AML_INTERNAL);
}
/*
@@ -349,9 +348,9 @@ acpi_ns_lookup (
* Device/Method, etc.) It could be a Package or other object node.
* Backup up the tree to find the containing scope node.
*/
- while (!acpi_ns_opens_scope (prefix_node->type) &&
- prefix_node->type != ACPI_TYPE_ANY) {
- prefix_node = acpi_ns_get_parent_node (prefix_node);
+ while (!acpi_ns_opens_scope(prefix_node->type) &&
+ prefix_node->type != ACPI_TYPE_ANY) {
+ prefix_node = acpi_ns_get_parent_node(prefix_node);
}
}
@@ -366,13 +365,13 @@ acpi_ns_lookup (
/* A Null name_path is allowed and refers to the root */
num_segments = 0;
- this_node = acpi_gbl_root_node;
- path = "";
+ this_node = acpi_gbl_root_node;
+ path = "";
- ACPI_DEBUG_PRINT ((ACPI_DB_NAMES,
- "Null Pathname (Zero segments), Flags=%X\n", flags));
- }
- else {
+ ACPI_DEBUG_PRINT((ACPI_DB_NAMES,
+ "Null Pathname (Zero segments), Flags=%X\n",
+ flags));
+ } else {
/*
* Name pointer is valid (and must be in internal name format)
*
@@ -396,15 +395,16 @@ acpi_ns_lookup (
path++;
- ACPI_DEBUG_PRINT ((ACPI_DB_NAMES,
- "Path is absolute from root [%p]\n", this_node));
- }
- else {
+ ACPI_DEBUG_PRINT((ACPI_DB_NAMES,
+ "Path is absolute from root [%p]\n",
+ this_node));
+ } else {
/* Pathname is relative to current scope, start there */
- ACPI_DEBUG_PRINT ((ACPI_DB_NAMES,
- "Searching relative to prefix scope [%4.4s] (%p)\n",
- acpi_ut_get_node_name (prefix_node), prefix_node));
+ ACPI_DEBUG_PRINT((ACPI_DB_NAMES,
+ "Searching relative to prefix scope [%4.4s] (%p)\n",
+ acpi_ut_get_node_name(prefix_node),
+ prefix_node));
/*
* Handle multiple Parent Prefixes (carat) by just getting
@@ -425,20 +425,20 @@ acpi_ns_lookup (
/* Backup to the parent node */
num_carats++;
- this_node = acpi_ns_get_parent_node (this_node);
+ this_node = acpi_ns_get_parent_node(this_node);
if (!this_node) {
/* Current scope has no parent scope */
- ACPI_REPORT_ERROR (
- ("ACPI path has too many parent prefixes (^) - reached beyond root node\n"));
- return_ACPI_STATUS (AE_NOT_FOUND);
+ ACPI_REPORT_ERROR(("ACPI path has too many parent prefixes (^) - reached beyond root node\n"));
+ return_ACPI_STATUS(AE_NOT_FOUND);
}
}
if (search_parent_flag == ACPI_NS_NO_UPSEARCH) {
- ACPI_DEBUG_PRINT ((ACPI_DB_NAMES,
- "Search scope is [%4.4s], path has %d carat(s)\n",
- acpi_ut_get_node_name (this_node), num_carats));
+ ACPI_DEBUG_PRINT((ACPI_DB_NAMES,
+ "Search scope is [%4.4s], path has %d carat(s)\n",
+ acpi_ut_get_node_name
+ (this_node), num_carats));
}
}
@@ -464,9 +464,9 @@ acpi_ns_lookup (
num_segments = 0;
type = this_node->type;
- ACPI_DEBUG_PRINT ((ACPI_DB_NAMES,
- "Prefix-only Pathname (Zero name segments), Flags=%X\n",
- flags));
+ ACPI_DEBUG_PRINT((ACPI_DB_NAMES,
+ "Prefix-only Pathname (Zero name segments), Flags=%X\n",
+ flags));
break;
case AML_DUAL_NAME_PREFIX:
@@ -480,8 +480,9 @@ acpi_ns_lookup (
num_segments = 2;
path++;
- ACPI_DEBUG_PRINT ((ACPI_DB_NAMES,
- "Dual Pathname (2 segments, Flags=%X)\n", flags));
+ ACPI_DEBUG_PRINT((ACPI_DB_NAMES,
+ "Dual Pathname (2 segments, Flags=%X)\n",
+ flags));
break;
case AML_MULTI_NAME_PREFIX_OP:
@@ -493,12 +494,12 @@ acpi_ns_lookup (
/* Extract segment count, point to first name segment */
path++;
- num_segments = (u32) (u8) *path;
+ num_segments = (u32) (u8) * path;
path++;
- ACPI_DEBUG_PRINT ((ACPI_DB_NAMES,
- "Multi Pathname (%d Segments, Flags=%X) \n",
- num_segments, flags));
+ ACPI_DEBUG_PRINT((ACPI_DB_NAMES,
+ "Multi Pathname (%d Segments, Flags=%X) \n",
+ num_segments, flags));
break;
default:
@@ -508,15 +509,15 @@ acpi_ns_lookup (
*/
num_segments = 1;
- ACPI_DEBUG_PRINT ((ACPI_DB_NAMES,
- "Simple Pathname (1 segment, Flags=%X)\n", flags));
+ ACPI_DEBUG_PRINT((ACPI_DB_NAMES,
+ "Simple Pathname (1 segment, Flags=%X)\n",
+ flags));
break;
}
- ACPI_DEBUG_EXEC (acpi_ns_print_pathname (num_segments, path));
+ ACPI_DEBUG_EXEC(acpi_ns_print_pathname(num_segments, path));
}
-
/*
* Search namespace for each segment of the name. Loop through and
* verify (or add to the namespace) each name segment.
@@ -540,7 +541,7 @@ acpi_ns_lookup (
* requested it AND we have a single, non-fully-qualified name_seg
*/
if ((search_parent_flag != ACPI_NS_NO_UPSEARCH) &&
- (flags & ACPI_NS_SEARCH_PARENT)) {
+ (flags & ACPI_NS_SEARCH_PARENT)) {
local_flags |= ACPI_NS_SEARCH_PARENT;
}
@@ -553,24 +554,28 @@ acpi_ns_lookup (
/* Extract one ACPI name from the front of the pathname */
- ACPI_MOVE_32_TO_32 (&simple_name, path);
+ ACPI_MOVE_32_TO_32(&simple_name, path);
/* Try to find the single (4 character) ACPI name */
- status = acpi_ns_search_and_enter (simple_name, walk_state, current_node,
- interpreter_mode, this_search_type, local_flags, &this_node);
- if (ACPI_FAILURE (status)) {
+ status =
+ acpi_ns_search_and_enter(simple_name, walk_state,
+ current_node, interpreter_mode,
+ this_search_type, local_flags,
+ &this_node);
+ if (ACPI_FAILURE(status)) {
if (status == AE_NOT_FOUND) {
/* Name not found in ACPI namespace */
- ACPI_DEBUG_PRINT ((ACPI_DB_NAMES,
- "Name [%4.4s] not found in scope [%4.4s] %p\n",
- (char *) &simple_name, (char *) &current_node->name,
- current_node));
+ ACPI_DEBUG_PRINT((ACPI_DB_NAMES,
+ "Name [%4.4s] not found in scope [%4.4s] %p\n",
+ (char *)&simple_name,
+ (char *)&current_node->name,
+ current_node));
}
*return_node = this_node;
- return_ACPI_STATUS (status);
+ return_ACPI_STATUS(status);
}
/*
@@ -586,19 +591,16 @@ acpi_ns_lookup (
*
* Then we have a type mismatch. Just warn and ignore it.
*/
- if ((num_segments == 0) &&
- (type_to_check_for != ACPI_TYPE_ANY) &&
- (type_to_check_for != ACPI_TYPE_LOCAL_ALIAS) &&
- (type_to_check_for != ACPI_TYPE_LOCAL_METHOD_ALIAS) &&
- (type_to_check_for != ACPI_TYPE_LOCAL_SCOPE) &&
- (this_node->type != ACPI_TYPE_ANY) &&
- (this_node->type != type_to_check_for)) {
+ if ((num_segments == 0) &&
+ (type_to_check_for != ACPI_TYPE_ANY) &&
+ (type_to_check_for != ACPI_TYPE_LOCAL_ALIAS) &&
+ (type_to_check_for != ACPI_TYPE_LOCAL_METHOD_ALIAS) &&
+ (type_to_check_for != ACPI_TYPE_LOCAL_SCOPE) &&
+ (this_node->type != ACPI_TYPE_ANY) &&
+ (this_node->type != type_to_check_for)) {
/* Complain about a type mismatch */
- ACPI_REPORT_WARNING (
- ("ns_lookup: Type mismatch on %4.4s (%s), searching for (%s)\n",
- (char *) &simple_name, acpi_ut_get_type_name (this_node->type),
- acpi_ut_get_type_name (type_to_check_for)));
+ ACPI_REPORT_WARNING(("ns_lookup: Type mismatch on %4.4s (%s), searching for (%s)\n", (char *)&simple_name, acpi_ut_get_type_name(this_node->type), acpi_ut_get_type_name(type_to_check_for)));
}
/*
@@ -624,15 +626,16 @@ acpi_ns_lookup (
* If entry is a type which opens a scope, push the new scope on the
* scope stack.
*/
- if (acpi_ns_opens_scope (type)) {
- status = acpi_ds_scope_stack_push (this_node, type, walk_state);
- if (ACPI_FAILURE (status)) {
- return_ACPI_STATUS (status);
+ if (acpi_ns_opens_scope(type)) {
+ status =
+ acpi_ds_scope_stack_push(this_node, type,
+ walk_state);
+ if (ACPI_FAILURE(status)) {
+ return_ACPI_STATUS(status);
}
}
}
*return_node = this_node;
- return_ACPI_STATUS (AE_OK);
+ return_ACPI_STATUS(AE_OK);
}
-
diff --git a/drivers/acpi/namespace/nsalloc.c b/drivers/acpi/namespace/nsalloc.c
index 5653a19d7172..cc7a85f8cfe6 100644
--- a/drivers/acpi/namespace/nsalloc.c
+++ b/drivers/acpi/namespace/nsalloc.c
@@ -41,20 +41,14 @@
* POSSIBILITY OF SUCH DAMAGES.
*/
-
#include <acpi/acpi.h>
#include <acpi/acnamesp.h>
-
#define _COMPONENT ACPI_NAMESPACE
- ACPI_MODULE_NAME ("nsalloc")
+ACPI_MODULE_NAME("nsalloc")
/* Local prototypes */
-
-static void
-acpi_ns_remove_reference (
- struct acpi_namespace_node *node);
-
+static void acpi_ns_remove_reference(struct acpi_namespace_node *node);
/*******************************************************************************
*
@@ -68,31 +62,26 @@ acpi_ns_remove_reference (
*
******************************************************************************/
-struct acpi_namespace_node *
-acpi_ns_create_node (
- u32 name)
+struct acpi_namespace_node *acpi_ns_create_node(u32 name)
{
- struct acpi_namespace_node *node;
-
+ struct acpi_namespace_node *node;
- ACPI_FUNCTION_TRACE ("ns_create_node");
+ ACPI_FUNCTION_TRACE("ns_create_node");
-
- node = ACPI_MEM_CALLOCATE (sizeof (struct acpi_namespace_node));
+ node = ACPI_MEM_CALLOCATE(sizeof(struct acpi_namespace_node));
if (!node) {
- return_PTR (NULL);
+ return_PTR(NULL);
}
- ACPI_MEM_TRACKING (acpi_gbl_memory_lists[ACPI_MEM_LIST_NSNODE].total_allocated++);
+ ACPI_MEM_TRACKING(acpi_gbl_ns_node_list->total_allocated++);
- node->name.integer = name;
+ node->name.integer = name;
node->reference_count = 1;
- ACPI_SET_DESCRIPTOR_TYPE (node, ACPI_DESC_TYPE_NAMED);
+ ACPI_SET_DESCRIPTOR_TYPE(node, ACPI_DESC_TYPE_NAMED);
- return_PTR (node);
+ return_PTR(node);
}
-
/*******************************************************************************
*
* FUNCTION: acpi_ns_delete_node
@@ -105,19 +94,15 @@ acpi_ns_create_node (
*
******************************************************************************/
-void
-acpi_ns_delete_node (
- struct acpi_namespace_node *node)
+void acpi_ns_delete_node(struct acpi_namespace_node *node)
{
- struct acpi_namespace_node *parent_node;
- struct acpi_namespace_node *prev_node;
- struct acpi_namespace_node *next_node;
-
+ struct acpi_namespace_node *parent_node;
+ struct acpi_namespace_node *prev_node;
+ struct acpi_namespace_node *next_node;
- ACPI_FUNCTION_TRACE_PTR ("ns_delete_node", node);
+ ACPI_FUNCTION_TRACE_PTR("ns_delete_node", node);
-
- parent_node = acpi_ns_get_parent_node (node);
+ parent_node = acpi_ns_get_parent_node(node);
prev_node = NULL;
next_node = parent_node->child;
@@ -136,32 +121,29 @@ acpi_ns_delete_node (
if (next_node->flags & ANOBJ_END_OF_PEER_LIST) {
prev_node->flags |= ANOBJ_END_OF_PEER_LIST;
}
- }
- else {
+ } else {
/* Node is first child (has no previous peer) */
if (next_node->flags & ANOBJ_END_OF_PEER_LIST) {
/* No peers at all */
parent_node->child = NULL;
- }
- else { /* Link peer list to parent */
+ } else { /* Link peer list to parent */
parent_node->child = next_node->peer;
}
}
- ACPI_MEM_TRACKING (acpi_gbl_memory_lists[ACPI_MEM_LIST_NSNODE].total_freed++);
+ ACPI_MEM_TRACKING(acpi_gbl_ns_node_list->total_freed++);
/*
* Detach an object if there is one then delete the node
*/
- acpi_ns_detach_object (node);
- ACPI_MEM_FREE (node);
+ acpi_ns_detach_object(node);
+ ACPI_MEM_FREE(node);
return_VOID;
}
-
/*******************************************************************************
*
* FUNCTION: acpi_ns_install_node
@@ -176,30 +158,20 @@ acpi_ns_delete_node (
* DESCRIPTION: Initialize a new namespace node and install it amongst
* its peers.
*
- * Note: Current namespace lookup is linear search. However, the
- * nodes are linked in alphabetical order to 1) put all reserved
- * names (start with underscore) first, and to 2) make a readable
- * namespace dump.
+ * Note: Current namespace lookup is linear search. This appears
+ * to be sufficient as namespace searches consume only a small
+ * fraction of the execution time of the ACPI subsystem.
*
******************************************************************************/
-void
-acpi_ns_install_node (
- struct acpi_walk_state *walk_state,
- struct acpi_namespace_node *parent_node, /* Parent */
- struct acpi_namespace_node *node, /* New Child*/
- acpi_object_type type)
+void acpi_ns_install_node(struct acpi_walk_state *walk_state, struct acpi_namespace_node *parent_node, /* Parent */
+ struct acpi_namespace_node *node, /* New Child */
+ acpi_object_type type)
{
- u16 owner_id = 0;
- struct acpi_namespace_node *child_node;
-#ifdef ACPI_ALPHABETIC_NAMESPACE
-
- struct acpi_namespace_node *previous_child_node;
-#endif
-
-
- ACPI_FUNCTION_TRACE ("ns_install_node");
+ acpi_owner_id owner_id = 0;
+ struct acpi_namespace_node *child_node;
+ ACPI_FUNCTION_TRACE("ns_install_node");
/*
* Get the owner ID from the Walk state
@@ -217,59 +189,7 @@ acpi_ns_install_node (
parent_node->child = node;
node->flags |= ANOBJ_END_OF_PEER_LIST;
node->peer = parent_node;
- }
- else {
-#ifdef ACPI_ALPHABETIC_NAMESPACE
- /*
- * Walk the list whilst searching for the correct
- * alphabetic placement.
- */
- previous_child_node = NULL;
- while (acpi_ns_compare_names (acpi_ut_get_node_name (child_node),
- acpi_ut_get_node_name (node)) < 0) {
- if (child_node->flags & ANOBJ_END_OF_PEER_LIST) {
- /* Last peer; Clear end-of-list flag */
-
- child_node->flags &= ~ANOBJ_END_OF_PEER_LIST;
-
- /* This node is the new peer to the child node */
-
- child_node->peer = node;
-
- /* This node is the new end-of-list */
-
- node->flags |= ANOBJ_END_OF_PEER_LIST;
- node->peer = parent_node;
- break;
- }
-
- /* Get next peer */
-
- previous_child_node = child_node;
- child_node = child_node->peer;
- }
-
- /* Did the node get inserted at the end-of-list? */
-
- if (!(node->flags & ANOBJ_END_OF_PEER_LIST)) {
- /*
- * Loop above terminated without reaching the end-of-list.
- * Insert the new node at the current location
- */
- if (previous_child_node) {
- /* Insert node alphabetically */
-
- node->peer = child_node;
- previous_child_node->peer = node;
- }
- else {
- /* Insert node alphabetically at start of list */
-
- node->peer = child_node;
- parent_node->child = node;
- }
- }
-#else
+ } else {
while (!(child_node->flags & ANOBJ_END_OF_PEER_LIST)) {
child_node = child_node->peer;
}
@@ -279,9 +199,8 @@ acpi_ns_install_node (
/* Clear end-of-list flag */
child_node->flags &= ~ANOBJ_END_OF_PEER_LIST;
- node->flags |= ANOBJ_END_OF_PEER_LIST;
+ node->flags |= ANOBJ_END_OF_PEER_LIST;
node->peer = parent_node;
-#endif
}
/* Init the new entry */
@@ -289,24 +208,25 @@ acpi_ns_install_node (
node->owner_id = owner_id;
node->type = (u8) type;
- ACPI_DEBUG_PRINT ((ACPI_DB_NAMES,
- "%4.4s (%s) [Node %p Owner %X] added to %4.4s (%s) [Node %p]\n",
- acpi_ut_get_node_name (node), acpi_ut_get_type_name (node->type), node, owner_id,
- acpi_ut_get_node_name (parent_node), acpi_ut_get_type_name (parent_node->type),
- parent_node));
+ ACPI_DEBUG_PRINT((ACPI_DB_NAMES,
+ "%4.4s (%s) [Node %p Owner %X] added to %4.4s (%s) [Node %p]\n",
+ acpi_ut_get_node_name(node),
+ acpi_ut_get_type_name(node->type), node, owner_id,
+ acpi_ut_get_node_name(parent_node),
+ acpi_ut_get_type_name(parent_node->type),
+ parent_node));
/*
* Increment the reference count(s) of all parents up to
* the root!
*/
- while ((node = acpi_ns_get_parent_node (node)) != NULL) {
+ while ((node = acpi_ns_get_parent_node(node)) != NULL) {
node->reference_count++;
}
return_VOID;
}
-
/*******************************************************************************
*
* FUNCTION: acpi_ns_delete_children
@@ -320,18 +240,14 @@ acpi_ns_install_node (
*
******************************************************************************/
-void
-acpi_ns_delete_children (
- struct acpi_namespace_node *parent_node)
+void acpi_ns_delete_children(struct acpi_namespace_node *parent_node)
{
- struct acpi_namespace_node *child_node;
- struct acpi_namespace_node *next_node;
- struct acpi_namespace_node *node;
- u8 flags;
-
-
- ACPI_FUNCTION_TRACE_PTR ("ns_delete_children", parent_node);
+ struct acpi_namespace_node *child_node;
+ struct acpi_namespace_node *next_node;
+ struct acpi_namespace_node *node;
+ u8 flags;
+ ACPI_FUNCTION_TRACE_PTR("ns_delete_children", parent_node);
if (!parent_node) {
return_VOID;
@@ -350,48 +266,48 @@ acpi_ns_delete_children (
do {
/* Get the things we need */
- next_node = child_node->peer;
- flags = child_node->flags;
+ next_node = child_node->peer;
+ flags = child_node->flags;
/* Grandchildren should have all been deleted already */
if (child_node->child) {
- ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, "Found a grandchild! P=%p C=%p\n",
- parent_node, child_node));
+ ACPI_DEBUG_PRINT((ACPI_DB_ERROR,
+ "Found a grandchild! P=%p C=%p\n",
+ parent_node, child_node));
}
/* Now we can free this child object */
- ACPI_MEM_TRACKING (acpi_gbl_memory_lists[ACPI_MEM_LIST_NSNODE].total_freed++);
+ ACPI_MEM_TRACKING(acpi_gbl_ns_node_list->total_freed++);
- ACPI_DEBUG_PRINT ((ACPI_DB_ALLOCATIONS, "Object %p, Remaining %X\n",
- child_node, acpi_gbl_current_node_count));
+ ACPI_DEBUG_PRINT((ACPI_DB_ALLOCATIONS,
+ "Object %p, Remaining %X\n", child_node,
+ acpi_gbl_current_node_count));
/*
* Detach an object if there is one, then free the child node
*/
- acpi_ns_detach_object (child_node);
+ acpi_ns_detach_object(child_node);
/*
* Decrement the reference count(s) of all parents up to
* the root! (counts were incremented when the node was created)
*/
node = child_node;
- while ((node = acpi_ns_get_parent_node (node)) != NULL) {
+ while ((node = acpi_ns_get_parent_node(node)) != NULL) {
node->reference_count--;
}
/* There should be only one reference remaining on this node */
if (child_node->reference_count != 1) {
- ACPI_REPORT_WARNING ((
- "Existing references (%d) on node being deleted (%p)\n",
- child_node->reference_count, child_node));
+ ACPI_REPORT_WARNING(("Existing references (%d) on node being deleted (%p)\n", child_node->reference_count, child_node));
}
/* Now we can delete the node */
- ACPI_MEM_FREE (child_node);
+ ACPI_MEM_FREE(child_node);
/* And move on to the next child in the list */
@@ -399,7 +315,6 @@ acpi_ns_delete_children (
} while (!(flags & ANOBJ_END_OF_PEER_LIST));
-
/* Clear the parent's child pointer */
parent_node->child = NULL;
@@ -407,7 +322,6 @@ acpi_ns_delete_children (
return_VOID;
}
-
/*******************************************************************************
*
* FUNCTION: acpi_ns_delete_namespace_subtree
@@ -421,16 +335,12 @@ acpi_ns_delete_children (
*
******************************************************************************/
-void
-acpi_ns_delete_namespace_subtree (
- struct acpi_namespace_node *parent_node)
+void acpi_ns_delete_namespace_subtree(struct acpi_namespace_node *parent_node)
{
- struct acpi_namespace_node *child_node = NULL;
- u32 level = 1;
-
-
- ACPI_FUNCTION_TRACE ("ns_delete_namespace_subtree");
+ struct acpi_namespace_node *child_node = NULL;
+ u32 level = 1;
+ ACPI_FUNCTION_TRACE("ns_delete_namespace_subtree");
if (!parent_node) {
return_VOID;
@@ -443,16 +353,17 @@ acpi_ns_delete_namespace_subtree (
while (level > 0) {
/* Get the next node in this scope (NULL if none) */
- child_node = acpi_ns_get_next_node (ACPI_TYPE_ANY, parent_node,
- child_node);
+ child_node = acpi_ns_get_next_node(ACPI_TYPE_ANY, parent_node,
+ child_node);
if (child_node) {
/* Found a child node - detach any attached object */
- acpi_ns_detach_object (child_node);
+ acpi_ns_detach_object(child_node);
/* Check if this node has any children */
- if (acpi_ns_get_next_node (ACPI_TYPE_ANY, child_node, NULL)) {
+ if (acpi_ns_get_next_node
+ (ACPI_TYPE_ANY, child_node, NULL)) {
/*
* There is at least one child of this node,
* visit the node
@@ -461,8 +372,7 @@ acpi_ns_delete_namespace_subtree (
parent_node = child_node;
child_node = NULL;
}
- }
- else {
+ } else {
/*
* No more children of this parent node.
* Move up to the grandparent.
@@ -473,7 +383,7 @@ acpi_ns_delete_namespace_subtree (
* Now delete all of the children of this parent
* all at the same time.
*/
- acpi_ns_delete_children (parent_node);
+ acpi_ns_delete_children(parent_node);
/* New "last child" is this parent node */
@@ -481,14 +391,13 @@ acpi_ns_delete_namespace_subtree (
/* Move up the tree to the grandparent */
- parent_node = acpi_ns_get_parent_node (parent_node);
+ parent_node = acpi_ns_get_parent_node(parent_node);
}
}
return_VOID;
}
-
/*******************************************************************************
*
* FUNCTION: acpi_ns_remove_reference
@@ -504,16 +413,12 @@ acpi_ns_delete_namespace_subtree (
*
******************************************************************************/
-static void
-acpi_ns_remove_reference (
- struct acpi_namespace_node *node)
+static void acpi_ns_remove_reference(struct acpi_namespace_node *node)
{
- struct acpi_namespace_node *parent_node;
- struct acpi_namespace_node *this_node;
-
-
- ACPI_FUNCTION_ENTRY ();
+ struct acpi_namespace_node *parent_node;
+ struct acpi_namespace_node *this_node;
+ ACPI_FUNCTION_ENTRY();
/*
* Decrement the reference count(s) of this node and all
@@ -523,7 +428,7 @@ acpi_ns_remove_reference (
while (this_node) {
/* Prepare to move up to parent */
- parent_node = acpi_ns_get_parent_node (this_node);
+ parent_node = acpi_ns_get_parent_node(this_node);
/* Decrement the reference count on this node */
@@ -534,15 +439,14 @@ acpi_ns_remove_reference (
if (!this_node->reference_count) {
/* Delete all children and delete the node */
- acpi_ns_delete_children (this_node);
- acpi_ns_delete_node (this_node);
+ acpi_ns_delete_children(this_node);
+ acpi_ns_delete_node(this_node);
}
this_node = parent_node;
}
}
-
/*******************************************************************************
*
* FUNCTION: acpi_ns_delete_namespace_by_owner
@@ -557,23 +461,23 @@ acpi_ns_remove_reference (
*
******************************************************************************/
-void
-acpi_ns_delete_namespace_by_owner (
- u16 owner_id)
+void acpi_ns_delete_namespace_by_owner(acpi_owner_id owner_id)
{
- struct acpi_namespace_node *child_node;
- struct acpi_namespace_node *deletion_node;
- u32 level;
- struct acpi_namespace_node *parent_node;
-
+ struct acpi_namespace_node *child_node;
+ struct acpi_namespace_node *deletion_node;
+ u32 level;
+ struct acpi_namespace_node *parent_node;
- ACPI_FUNCTION_TRACE_U32 ("ns_delete_namespace_by_owner", owner_id);
+ ACPI_FUNCTION_TRACE_U32("ns_delete_namespace_by_owner", owner_id);
+ if (owner_id == 0) {
+ return_VOID;
+ }
- parent_node = acpi_gbl_root_node;
- child_node = NULL;
+ parent_node = acpi_gbl_root_node;
+ child_node = NULL;
deletion_node = NULL;
- level = 1;
+ level = 1;
/*
* Traverse the tree of nodes until we bubble back up
@@ -584,10 +488,12 @@ acpi_ns_delete_namespace_by_owner (
* Get the next child of this parent node. When child_node is NULL,
* the first child of the parent is returned
*/
- child_node = acpi_ns_get_next_node (ACPI_TYPE_ANY, parent_node, child_node);
+ child_node =
+ acpi_ns_get_next_node(ACPI_TYPE_ANY, parent_node,
+ child_node);
if (deletion_node) {
- acpi_ns_remove_reference (deletion_node);
+ acpi_ns_remove_reference(deletion_node);
deletion_node = NULL;
}
@@ -595,12 +501,13 @@ acpi_ns_delete_namespace_by_owner (
if (child_node->owner_id == owner_id) {
/* Found a matching child node - detach any attached object */
- acpi_ns_detach_object (child_node);
+ acpi_ns_detach_object(child_node);
}
/* Check if this node has any children */
- if (acpi_ns_get_next_node (ACPI_TYPE_ANY, child_node, NULL)) {
+ if (acpi_ns_get_next_node
+ (ACPI_TYPE_ANY, child_node, NULL)) {
/*
* There is at least one child of this node,
* visit the node
@@ -608,12 +515,10 @@ acpi_ns_delete_namespace_by_owner (
level++;
parent_node = child_node;
child_node = NULL;
- }
- else if (child_node->owner_id == owner_id) {
+ } else if (child_node->owner_id == owner_id) {
deletion_node = child_node;
}
- }
- else {
+ } else {
/*
* No more children of this parent node.
* Move up to the grandparent.
@@ -631,62 +536,9 @@ acpi_ns_delete_namespace_by_owner (
/* Move up the tree to the grandparent */
- parent_node = acpi_ns_get_parent_node (parent_node);
+ parent_node = acpi_ns_get_parent_node(parent_node);
}
}
return_VOID;
}
-
-
-#ifdef ACPI_ALPHABETIC_NAMESPACE
-/*******************************************************************************
- *
- * FUNCTION: acpi_ns_compare_names
- *
- * PARAMETERS: Name1 - First name to compare
- * Name2 - Second name to compare
- *
- * RETURN: value from strncmp
- *
- * DESCRIPTION: Compare two ACPI names. Names that are prefixed with an
- * underscore are forced to be alphabetically first.
- *
- ******************************************************************************/
-
-int
-acpi_ns_compare_names (
- char *name1,
- char *name2)
-{
- char reversed_name1[ACPI_NAME_SIZE];
- char reversed_name2[ACPI_NAME_SIZE];
- u32 i;
- u32 j;
-
-
- /*
- * Replace all instances of "underscore" with a value that is smaller so
- * that all names that are prefixed with underscore(s) are alphabetically
- * first.
- *
- * Reverse the name bytewise so we can just do a 32-bit compare instead
- * of a strncmp.
- */
- for (i = 0, j= (ACPI_NAME_SIZE - 1); i < ACPI_NAME_SIZE; i++, j--) {
- reversed_name1[j] = name1[i];
- if (name1[i] == '_') {
- reversed_name1[j] = '*';
- }
-
- reversed_name2[j] = name2[i];
- if (name2[i] == '_') {
- reversed_name2[j] = '*';
- }
- }
-
- return (*(int *) reversed_name1 - *(int *) reversed_name2);
-}
-#endif
-
-
diff --git a/drivers/acpi/namespace/nsdump.c b/drivers/acpi/namespace/nsdump.c
index 6c2aef0e0dd4..9faf1d5c86ed 100644
--- a/drivers/acpi/namespace/nsdump.c
+++ b/drivers/acpi/namespace/nsdump.c
@@ -41,31 +41,22 @@
* POSSIBILITY OF SUCH DAMAGES.
*/
-
#include <acpi/acpi.h>
#include <acpi/acnamesp.h>
#include <acpi/acparser.h>
-
#define _COMPONENT ACPI_NAMESPACE
- ACPI_MODULE_NAME ("nsdump")
+ACPI_MODULE_NAME("nsdump")
/* Local prototypes */
-
#ifdef ACPI_OBSOLETE_FUNCTIONS
-void
-acpi_ns_dump_root_devices (
- void);
+void acpi_ns_dump_root_devices(void);
static acpi_status
-acpi_ns_dump_one_device (
- acpi_handle obj_handle,
- u32 level,
- void *context,
- void **return_value);
+acpi_ns_dump_one_device(acpi_handle obj_handle,
+ u32 level, void *context, void **return_value);
#endif
-
#if defined(ACPI_DEBUG_OUTPUT) || defined(ACPI_DEBUGGER)
/*******************************************************************************
*
@@ -80,36 +71,38 @@ acpi_ns_dump_one_device (
*
******************************************************************************/
-void
-acpi_ns_print_pathname (
- u32 num_segments,
- char *pathname)
+void acpi_ns_print_pathname(u32 num_segments, char *pathname)
{
- ACPI_FUNCTION_NAME ("ns_print_pathname");
+ acpi_native_uint i;
+ ACPI_FUNCTION_NAME("ns_print_pathname");
- if (!(acpi_dbg_level & ACPI_LV_NAMES) || !(acpi_dbg_layer & ACPI_NAMESPACE)) {
+ if (!(acpi_dbg_level & ACPI_LV_NAMES)
+ || !(acpi_dbg_layer & ACPI_NAMESPACE)) {
return;
}
/* Print the entire name */
- ACPI_DEBUG_PRINT ((ACPI_DB_NAMES, "["));
+ ACPI_DEBUG_PRINT((ACPI_DB_NAMES, "["));
while (num_segments) {
- acpi_os_printf ("%4.4s", pathname);
- pathname += ACPI_NAME_SIZE;
+ for (i = 0; i < 4; i++) {
+ ACPI_IS_PRINT(pathname[i]) ?
+ acpi_os_printf("%c", pathname[i]) :
+ acpi_os_printf("?");
+ }
+ pathname += ACPI_NAME_SIZE;
num_segments--;
if (num_segments) {
- acpi_os_printf (".");
+ acpi_os_printf(".");
}
}
- acpi_os_printf ("]\n");
+ acpi_os_printf("]\n");
}
-
/*******************************************************************************
*
* FUNCTION: acpi_ns_dump_pathname
@@ -127,15 +120,10 @@ acpi_ns_print_pathname (
******************************************************************************/
void
-acpi_ns_dump_pathname (
- acpi_handle handle,
- char *msg,
- u32 level,
- u32 component)
+acpi_ns_dump_pathname(acpi_handle handle, char *msg, u32 level, u32 component)
{
- ACPI_FUNCTION_TRACE ("ns_dump_pathname");
-
+ ACPI_FUNCTION_TRACE("ns_dump_pathname");
/* Do this only if the requested debug level and component are enabled */
@@ -145,12 +133,11 @@ acpi_ns_dump_pathname (
/* Convert handle to a full pathname and print it (with supplied message) */
- acpi_ns_print_node_pathname (handle, msg);
- acpi_os_printf ("\n");
+ acpi_ns_print_node_pathname(handle, msg);
+ acpi_os_printf("\n");
return_VOID;
}
-
/*******************************************************************************
*
* FUNCTION: acpi_ns_dump_one_object
@@ -168,24 +155,19 @@ acpi_ns_dump_pathname (
******************************************************************************/
acpi_status
-acpi_ns_dump_one_object (
- acpi_handle obj_handle,
- u32 level,
- void *context,
- void **return_value)
+acpi_ns_dump_one_object(acpi_handle obj_handle,
+ u32 level, void *context, void **return_value)
{
- struct acpi_walk_info *info = (struct acpi_walk_info *) context;
- struct acpi_namespace_node *this_node;
- union acpi_operand_object *obj_desc = NULL;
- acpi_object_type obj_type;
- acpi_object_type type;
- u32 bytes_to_dump;
- u32 dbg_level;
- u32 i;
-
-
- ACPI_FUNCTION_NAME ("ns_dump_one_object");
+ struct acpi_walk_info *info = (struct acpi_walk_info *)context;
+ struct acpi_namespace_node *this_node;
+ union acpi_operand_object *obj_desc = NULL;
+ acpi_object_type obj_type;
+ acpi_object_type type;
+ u32 bytes_to_dump;
+ u32 dbg_level;
+ u32 i;
+ ACPI_FUNCTION_NAME("ns_dump_one_object");
/* Is output enabled? */
@@ -194,193 +176,215 @@ acpi_ns_dump_one_object (
}
if (!obj_handle) {
- ACPI_DEBUG_PRINT ((ACPI_DB_INFO, "Null object handle\n"));
+ ACPI_DEBUG_PRINT((ACPI_DB_INFO, "Null object handle\n"));
return (AE_OK);
}
- this_node = acpi_ns_map_handle_to_node (obj_handle);
+ this_node = acpi_ns_map_handle_to_node(obj_handle);
type = this_node->type;
/* Check if the owner matches */
- if ((info->owner_id != ACPI_UINT32_MAX) &&
- (info->owner_id != this_node->owner_id)) {
+ if ((info->owner_id != ACPI_OWNER_ID_MAX) &&
+ (info->owner_id != this_node->owner_id)) {
return (AE_OK);
}
- /* Indent the object according to the level */
+ if (!(info->display_type & ACPI_DISPLAY_SHORT)) {
+ /* Indent the object according to the level */
- acpi_os_printf ("%2d%*s", (u32) level - 1, (int) level * 2, " ");
+ acpi_os_printf("%2d%*s", (u32) level - 1, (int)level * 2, " ");
- /* Check the node type and name */
+ /* Check the node type and name */
- if (type > ACPI_TYPE_LOCAL_MAX) {
- ACPI_REPORT_WARNING (("Invalid ACPI Type %08X\n", type));
- }
+ if (type > ACPI_TYPE_LOCAL_MAX) {
+ ACPI_REPORT_WARNING(("Invalid ACPI Type %08X\n", type));
+ }
+
+ if (!acpi_ut_valid_acpi_name(this_node->name.integer)) {
+ ACPI_REPORT_WARNING(("Invalid ACPI Name %08X\n",
+ this_node->name.integer));
+ }
- if (!acpi_ut_valid_acpi_name (this_node->name.integer)) {
- ACPI_REPORT_WARNING (("Invalid ACPI Name %08X\n",
- this_node->name.integer));
+ acpi_os_printf("%4.4s", acpi_ut_get_node_name(this_node));
}
/*
* Now we can print out the pertinent information
*/
- acpi_os_printf ("%4.4s %-12s %p ",
- acpi_ut_get_node_name (this_node), acpi_ut_get_type_name (type), this_node);
+ acpi_os_printf(" %-12s %p ", acpi_ut_get_type_name(type), this_node);
dbg_level = acpi_dbg_level;
acpi_dbg_level = 0;
- obj_desc = acpi_ns_get_attached_object (this_node);
+ obj_desc = acpi_ns_get_attached_object(this_node);
acpi_dbg_level = dbg_level;
- switch (info->display_type) {
+ switch (info->display_type & ACPI_DISPLAY_MASK) {
case ACPI_DISPLAY_SUMMARY:
if (!obj_desc) {
/* No attached object, we are done */
- acpi_os_printf ("\n");
+ acpi_os_printf("\n");
return (AE_OK);
}
switch (type) {
case ACPI_TYPE_PROCESSOR:
- acpi_os_printf ("ID %X Len %.4X Addr %p\n",
- obj_desc->processor.proc_id, obj_desc->processor.length,
- (char *) obj_desc->processor.address);
+ acpi_os_printf("ID %X Len %.4X Addr %p\n",
+ obj_desc->processor.proc_id,
+ obj_desc->processor.length,
+ (char *)obj_desc->processor.address);
break;
-
case ACPI_TYPE_DEVICE:
- acpi_os_printf ("Notify Object: %p\n", obj_desc);
+ acpi_os_printf("Notify Object: %p\n", obj_desc);
break;
-
case ACPI_TYPE_METHOD:
- acpi_os_printf ("Args %X Len %.4X Aml %p\n",
- (u32) obj_desc->method.param_count,
- obj_desc->method.aml_length, obj_desc->method.aml_start);
+ acpi_os_printf("Args %X Len %.4X Aml %p\n",
+ (u32) obj_desc->method.param_count,
+ obj_desc->method.aml_length,
+ obj_desc->method.aml_start);
break;
-
case ACPI_TYPE_INTEGER:
- acpi_os_printf ("= %8.8X%8.8X\n",
- ACPI_FORMAT_UINT64 (obj_desc->integer.value));
+ acpi_os_printf("= %8.8X%8.8X\n",
+ ACPI_FORMAT_UINT64(obj_desc->integer.
+ value));
break;
-
case ACPI_TYPE_PACKAGE:
if (obj_desc->common.flags & AOPOBJ_DATA_VALID) {
- acpi_os_printf ("Elements %.2X\n",
- obj_desc->package.count);
- }
- else {
- acpi_os_printf ("[Length not yet evaluated]\n");
+ acpi_os_printf("Elements %.2X\n",
+ obj_desc->package.count);
+ } else {
+ acpi_os_printf("[Length not yet evaluated]\n");
}
break;
-
case ACPI_TYPE_BUFFER:
if (obj_desc->common.flags & AOPOBJ_DATA_VALID) {
- acpi_os_printf ("Len %.2X",
- obj_desc->buffer.length);
+ acpi_os_printf("Len %.2X",
+ obj_desc->buffer.length);
/* Dump some of the buffer */
if (obj_desc->buffer.length > 0) {
- acpi_os_printf (" =");
- for (i = 0; (i < obj_desc->buffer.length && i < 12); i++) {
- acpi_os_printf (" %.2hX", obj_desc->buffer.pointer[i]);
+ acpi_os_printf(" =");
+ for (i = 0;
+ (i < obj_desc->buffer.length
+ && i < 12); i++) {
+ acpi_os_printf(" %.2hX",
+ obj_desc->buffer.
+ pointer[i]);
}
}
- acpi_os_printf ("\n");
- }
- else {
- acpi_os_printf ("[Length not yet evaluated]\n");
+ acpi_os_printf("\n");
+ } else {
+ acpi_os_printf("[Length not yet evaluated]\n");
}
break;
-
case ACPI_TYPE_STRING:
- acpi_os_printf ("Len %.2X ", obj_desc->string.length);
- acpi_ut_print_string (obj_desc->string.pointer, 32);
- acpi_os_printf ("\n");
+ acpi_os_printf("Len %.2X ", obj_desc->string.length);
+ acpi_ut_print_string(obj_desc->string.pointer, 32);
+ acpi_os_printf("\n");
break;
-
case ACPI_TYPE_REGION:
- acpi_os_printf ("[%s]",
- acpi_ut_get_region_name (obj_desc->region.space_id));
+ acpi_os_printf("[%s]",
+ acpi_ut_get_region_name(obj_desc->region.
+ space_id));
if (obj_desc->region.flags & AOPOBJ_DATA_VALID) {
- acpi_os_printf (" Addr %8.8X%8.8X Len %.4X\n",
- ACPI_FORMAT_UINT64 (obj_desc->region.address),
- obj_desc->region.length);
- }
- else {
- acpi_os_printf (" [Address/Length not yet evaluated]\n");
+ acpi_os_printf(" Addr %8.8X%8.8X Len %.4X\n",
+ ACPI_FORMAT_UINT64(obj_desc->
+ region.
+ address),
+ obj_desc->region.length);
+ } else {
+ acpi_os_printf
+ (" [Address/Length not yet evaluated]\n");
}
break;
-
case ACPI_TYPE_LOCAL_REFERENCE:
- acpi_os_printf ("[%s]\n",
- acpi_ps_get_opcode_name (obj_desc->reference.opcode));
+ acpi_os_printf("[%s]\n",
+ acpi_ps_get_opcode_name(obj_desc->
+ reference.
+ opcode));
break;
-
case ACPI_TYPE_BUFFER_FIELD:
if (obj_desc->buffer_field.buffer_obj &&
- obj_desc->buffer_field.buffer_obj->buffer.node) {
- acpi_os_printf ("Buf [%4.4s]",
- acpi_ut_get_node_name (obj_desc->buffer_field.buffer_obj->buffer.node));
+ obj_desc->buffer_field.buffer_obj->buffer.node) {
+ acpi_os_printf("Buf [%4.4s]",
+ acpi_ut_get_node_name(obj_desc->
+ buffer_field.
+ buffer_obj->
+ buffer.
+ node));
}
break;
-
case ACPI_TYPE_LOCAL_REGION_FIELD:
- acpi_os_printf ("Rgn [%4.4s]",
- acpi_ut_get_node_name (obj_desc->common_field.region_obj->region.node));
+ acpi_os_printf("Rgn [%4.4s]",
+ acpi_ut_get_node_name(obj_desc->
+ common_field.
+ region_obj->region.
+ node));
break;
-
case ACPI_TYPE_LOCAL_BANK_FIELD:
- acpi_os_printf ("Rgn [%4.4s] Bnk [%4.4s]",
- acpi_ut_get_node_name (obj_desc->common_field.region_obj->region.node),
- acpi_ut_get_node_name (obj_desc->bank_field.bank_obj->common_field.node));
+ acpi_os_printf("Rgn [%4.4s] Bnk [%4.4s]",
+ acpi_ut_get_node_name(obj_desc->
+ common_field.
+ region_obj->region.
+ node),
+ acpi_ut_get_node_name(obj_desc->
+ bank_field.
+ bank_obj->
+ common_field.
+ node));
break;
-
case ACPI_TYPE_LOCAL_INDEX_FIELD:
- acpi_os_printf ("Idx [%4.4s] Dat [%4.4s]",
- acpi_ut_get_node_name (obj_desc->index_field.index_obj->common_field.node),
- acpi_ut_get_node_name (obj_desc->index_field.data_obj->common_field.node));
+ acpi_os_printf("Idx [%4.4s] Dat [%4.4s]",
+ acpi_ut_get_node_name(obj_desc->
+ index_field.
+ index_obj->
+ common_field.node),
+ acpi_ut_get_node_name(obj_desc->
+ index_field.
+ data_obj->
+ common_field.
+ node));
break;
-
case ACPI_TYPE_LOCAL_ALIAS:
case ACPI_TYPE_LOCAL_METHOD_ALIAS:
- acpi_os_printf ("Target %4.4s (%p)\n",
- acpi_ut_get_node_name (obj_desc), obj_desc);
+ acpi_os_printf("Target %4.4s (%p)\n",
+ acpi_ut_get_node_name(obj_desc),
+ obj_desc);
break;
default:
- acpi_os_printf ("Object %p\n", obj_desc);
+ acpi_os_printf("Object %p\n", obj_desc);
break;
}
@@ -392,11 +396,15 @@ acpi_ns_dump_one_object (
case ACPI_TYPE_LOCAL_BANK_FIELD:
case ACPI_TYPE_LOCAL_INDEX_FIELD:
- acpi_os_printf (" Off %.3X Len %.2X Acc %.2hd\n",
- (obj_desc->common_field.base_byte_offset * 8)
- + obj_desc->common_field.start_field_bit_offset,
- obj_desc->common_field.bit_length,
- obj_desc->common_field.access_byte_width);
+ acpi_os_printf(" Off %.3X Len %.2X Acc %.2hd\n",
+ (obj_desc->common_field.
+ base_byte_offset * 8)
+ +
+ obj_desc->common_field.
+ start_field_bit_offset,
+ obj_desc->common_field.bit_length,
+ obj_desc->common_field.
+ access_byte_width);
break;
default:
@@ -404,56 +412,55 @@ acpi_ns_dump_one_object (
}
break;
-
case ACPI_DISPLAY_OBJECTS:
- acpi_os_printf ("O:%p", obj_desc);
+ acpi_os_printf("O:%p", obj_desc);
if (!obj_desc) {
/* No attached object, we are done */
- acpi_os_printf ("\n");
+ acpi_os_printf("\n");
return (AE_OK);
}
- acpi_os_printf ("(R%d)", obj_desc->common.reference_count);
+ acpi_os_printf("(R%d)", obj_desc->common.reference_count);
switch (type) {
case ACPI_TYPE_METHOD:
/* Name is a Method and its AML offset/length are set */
- acpi_os_printf (" M:%p-%X\n", obj_desc->method.aml_start,
- obj_desc->method.aml_length);
+ acpi_os_printf(" M:%p-%X\n", obj_desc->method.aml_start,
+ obj_desc->method.aml_length);
break;
case ACPI_TYPE_INTEGER:
- acpi_os_printf (" I:%8.8X8.8%X\n",
- ACPI_FORMAT_UINT64 (obj_desc->integer.value));
+ acpi_os_printf(" I:%8.8X8.8%X\n",
+ ACPI_FORMAT_UINT64(obj_desc->integer.
+ value));
break;
case ACPI_TYPE_STRING:
- acpi_os_printf (" S:%p-%X\n", obj_desc->string.pointer,
- obj_desc->string.length);
+ acpi_os_printf(" S:%p-%X\n", obj_desc->string.pointer,
+ obj_desc->string.length);
break;
case ACPI_TYPE_BUFFER:
- acpi_os_printf (" B:%p-%X\n", obj_desc->buffer.pointer,
- obj_desc->buffer.length);
+ acpi_os_printf(" B:%p-%X\n", obj_desc->buffer.pointer,
+ obj_desc->buffer.length);
break;
default:
- acpi_os_printf ("\n");
+ acpi_os_printf("\n");
break;
}
break;
-
default:
- acpi_os_printf ("\n");
+ acpi_os_printf("\n");
break;
}
@@ -463,61 +470,58 @@ acpi_ns_dump_one_object (
return (AE_OK);
}
-
/* If there is an attached object, display it */
- dbg_level = acpi_dbg_level;
+ dbg_level = acpi_dbg_level;
acpi_dbg_level = 0;
- obj_desc = acpi_ns_get_attached_object (this_node);
+ obj_desc = acpi_ns_get_attached_object(this_node);
acpi_dbg_level = dbg_level;
/* Dump attached objects */
while (obj_desc) {
obj_type = ACPI_TYPE_INVALID;
- acpi_os_printf (" Attached Object %p: ", obj_desc);
+ acpi_os_printf("Attached Object %p: ", obj_desc);
/* Decode the type of attached object and dump the contents */
- switch (ACPI_GET_DESCRIPTOR_TYPE (obj_desc)) {
+ switch (ACPI_GET_DESCRIPTOR_TYPE(obj_desc)) {
case ACPI_DESC_TYPE_NAMED:
- acpi_os_printf ("(Ptr to Node)\n");
- bytes_to_dump = sizeof (struct acpi_namespace_node);
+ acpi_os_printf("(Ptr to Node)\n");
+ bytes_to_dump = sizeof(struct acpi_namespace_node);
+ ACPI_DUMP_BUFFER(obj_desc, bytes_to_dump);
break;
-
case ACPI_DESC_TYPE_OPERAND:
- obj_type = ACPI_GET_OBJECT_TYPE (obj_desc);
+ obj_type = ACPI_GET_OBJECT_TYPE(obj_desc);
if (obj_type > ACPI_TYPE_LOCAL_MAX) {
- acpi_os_printf ("(Ptr to ACPI Object type %X [UNKNOWN])\n",
- obj_type);
+ acpi_os_printf
+ ("(Ptr to ACPI Object type %X [UNKNOWN])\n",
+ obj_type);
bytes_to_dump = 32;
+ } else {
+ acpi_os_printf
+ ("(Ptr to ACPI Object type %X [%s])\n",
+ obj_type, acpi_ut_get_type_name(obj_type));
+ bytes_to_dump =
+ sizeof(union acpi_operand_object);
}
- else {
- acpi_os_printf ("(Ptr to ACPI Object type %s, %X)\n",
- acpi_ut_get_type_name (obj_type), obj_type);
- bytes_to_dump = sizeof (union acpi_operand_object);
- }
- break;
+ ACPI_DUMP_BUFFER(obj_desc, bytes_to_dump);
+ break;
default:
- acpi_os_printf (
- "(String or Buffer ptr - not an object descriptor) [%s]\n",
- acpi_ut_get_descriptor_name (obj_desc));
- bytes_to_dump = 16;
break;
}
- ACPI_DUMP_BUFFER (obj_desc, bytes_to_dump);
-
/* If value is NOT an internal object, we are done */
- if (ACPI_GET_DESCRIPTOR_TYPE (obj_desc) != ACPI_DESC_TYPE_OPERAND) {
+ if (ACPI_GET_DESCRIPTOR_TYPE(obj_desc) !=
+ ACPI_DESC_TYPE_OPERAND) {
goto cleanup;
}
@@ -525,51 +529,56 @@ acpi_ns_dump_one_object (
* Valid object, get the pointer to next level, if any
*/
switch (obj_type) {
- case ACPI_TYPE_STRING:
- obj_desc = (void *) obj_desc->string.pointer;
- break;
-
case ACPI_TYPE_BUFFER:
- obj_desc = (void *) obj_desc->buffer.pointer;
- break;
+ case ACPI_TYPE_STRING:
+ /*
+ * NOTE: takes advantage of common fields between string/buffer
+ */
+ bytes_to_dump = obj_desc->string.length;
+ obj_desc = (void *)obj_desc->string.pointer;
+ acpi_os_printf("(Buffer/String pointer %p length %X)\n",
+ obj_desc, bytes_to_dump);
+ ACPI_DUMP_BUFFER(obj_desc, bytes_to_dump);
+ goto cleanup;
case ACPI_TYPE_BUFFER_FIELD:
- obj_desc = (union acpi_operand_object *) obj_desc->buffer_field.buffer_obj;
+ obj_desc =
+ (union acpi_operand_object *)obj_desc->buffer_field.
+ buffer_obj;
break;
case ACPI_TYPE_PACKAGE:
- obj_desc = (void *) obj_desc->package.elements;
+ obj_desc = (void *)obj_desc->package.elements;
break;
case ACPI_TYPE_METHOD:
- obj_desc = (void *) obj_desc->method.aml_start;
+ obj_desc = (void *)obj_desc->method.aml_start;
break;
case ACPI_TYPE_LOCAL_REGION_FIELD:
- obj_desc = (void *) obj_desc->field.region_obj;
+ obj_desc = (void *)obj_desc->field.region_obj;
break;
case ACPI_TYPE_LOCAL_BANK_FIELD:
- obj_desc = (void *) obj_desc->bank_field.region_obj;
+ obj_desc = (void *)obj_desc->bank_field.region_obj;
break;
case ACPI_TYPE_LOCAL_INDEX_FIELD:
- obj_desc = (void *) obj_desc->index_field.index_obj;
+ obj_desc = (void *)obj_desc->index_field.index_obj;
break;
default:
goto cleanup;
}
- obj_type = ACPI_TYPE_INVALID; /* Terminate loop after next pass */
+ obj_type = ACPI_TYPE_INVALID; /* Terminate loop after next pass */
}
-cleanup:
- acpi_os_printf ("\n");
+ cleanup:
+ acpi_os_printf("\n");
return (AE_OK);
}
-
#ifdef ACPI_FUTURE_USAGE
/*******************************************************************************
*
@@ -591,29 +600,25 @@ cleanup:
******************************************************************************/
void
-acpi_ns_dump_objects (
- acpi_object_type type,
- u8 display_type,
- u32 max_depth,
- u32 owner_id,
- acpi_handle start_handle)
+acpi_ns_dump_objects(acpi_object_type type,
+ u8 display_type,
+ u32 max_depth,
+ acpi_owner_id owner_id, acpi_handle start_handle)
{
- struct acpi_walk_info info;
-
-
- ACPI_FUNCTION_ENTRY ();
+ struct acpi_walk_info info;
+ ACPI_FUNCTION_ENTRY();
info.debug_level = ACPI_LV_TABLES;
info.owner_id = owner_id;
info.display_type = display_type;
- (void) acpi_ns_walk_namespace (type, start_handle, max_depth,
- ACPI_NS_WALK_NO_UNLOCK, acpi_ns_dump_one_object,
- (void *) &info, NULL);
+ (void)acpi_ns_walk_namespace(type, start_handle, max_depth,
+ ACPI_NS_WALK_NO_UNLOCK,
+ acpi_ns_dump_one_object, (void *)&info,
+ NULL);
}
-#endif /* ACPI_FUTURE_USAGE */
-
+#endif /* ACPI_FUTURE_USAGE */
/*******************************************************************************
*
@@ -628,26 +633,20 @@ acpi_ns_dump_objects (
*
******************************************************************************/
-void
-acpi_ns_dump_entry (
- acpi_handle handle,
- u32 debug_level)
+void acpi_ns_dump_entry(acpi_handle handle, u32 debug_level)
{
- struct acpi_walk_info info;
-
-
- ACPI_FUNCTION_ENTRY ();
+ struct acpi_walk_info info;
+ ACPI_FUNCTION_ENTRY();
info.debug_level = debug_level;
- info.owner_id = ACPI_UINT32_MAX;
+ info.owner_id = ACPI_OWNER_ID_MAX;
info.display_type = ACPI_DISPLAY_SUMMARY;
- (void) acpi_ns_dump_one_object (handle, 1, &info, NULL);
+ (void)acpi_ns_dump_one_object(handle, 1, &info, NULL);
}
-
-#ifdef _ACPI_ASL_COMPILER
+#ifdef ACPI_ASL_COMPILER
/*******************************************************************************
*
* FUNCTION: acpi_ns_dump_tables
@@ -663,23 +662,19 @@ acpi_ns_dump_entry (
*
******************************************************************************/
-void
-acpi_ns_dump_tables (
- acpi_handle search_base,
- u32 max_depth)
+void acpi_ns_dump_tables(acpi_handle search_base, u32 max_depth)
{
- acpi_handle search_handle = search_base;
-
-
- ACPI_FUNCTION_TRACE ("ns_dump_tables");
+ acpi_handle search_handle = search_base;
+ ACPI_FUNCTION_TRACE("ns_dump_tables");
if (!acpi_gbl_root_node) {
/*
* If the name space has not been initialized,
* there is nothing to dump.
*/
- ACPI_DEBUG_PRINT ((ACPI_DB_TABLES, "namespace not initialized!\n"));
+ ACPI_DEBUG_PRINT((ACPI_DB_TABLES,
+ "namespace not initialized!\n"));
return_VOID;
}
@@ -687,12 +682,12 @@ acpi_ns_dump_tables (
/* Entire namespace */
search_handle = acpi_gbl_root_node;
- ACPI_DEBUG_PRINT ((ACPI_DB_TABLES, "\\\n"));
+ ACPI_DEBUG_PRINT((ACPI_DB_TABLES, "\\\n"));
}
- acpi_ns_dump_objects (ACPI_TYPE_ANY, ACPI_DISPLAY_OBJECTS, max_depth,
- ACPI_UINT32_MAX, search_handle);
+ acpi_ns_dump_objects(ACPI_TYPE_ANY, ACPI_DISPLAY_OBJECTS, max_depth,
+ ACPI_OWNER_ID_MAX, search_handle);
return_VOID;
}
-#endif /* _ACPI_ASL_COMPILER */
-#endif /* defined(ACPI_DEBUG_OUTPUT) || defined(ACPI_DEBUGGER) */
+#endif /* _ACPI_ASL_COMPILER */
+#endif /* defined(ACPI_DEBUG_OUTPUT) || defined(ACPI_DEBUGGER) */
diff --git a/drivers/acpi/namespace/nsdumpdv.c b/drivers/acpi/namespace/nsdumpdv.c
index 27c4f7cd2a43..55de883943d6 100644
--- a/drivers/acpi/namespace/nsdumpdv.c
+++ b/drivers/acpi/namespace/nsdumpdv.c
@@ -41,20 +41,15 @@
* POSSIBILITY OF SUCH DAMAGES.
*/
-
#include <acpi/acpi.h>
-
/* TBD: This entire module is apparently obsolete and should be removed */
#define _COMPONENT ACPI_NAMESPACE
- ACPI_MODULE_NAME ("nsdumpdv")
-
+ACPI_MODULE_NAME("nsdumpdv")
#ifdef ACPI_OBSOLETE_FUNCTIONS
#if defined(ACPI_DEBUG_OUTPUT) || defined(ACPI_DEBUGGER)
-
#include <acpi/acnamesp.h>
-
/*******************************************************************************
*
* FUNCTION: acpi_ns_dump_one_device
@@ -70,44 +65,39 @@
* This procedure is a user_function called by acpi_ns_walk_namespace.
*
******************************************************************************/
-
static acpi_status
-acpi_ns_dump_one_device (
- acpi_handle obj_handle,
- u32 level,
- void *context,
- void **return_value)
+acpi_ns_dump_one_device(acpi_handle obj_handle,
+ u32 level, void *context, void **return_value)
{
- struct acpi_buffer buffer;
- struct acpi_device_info *info;
- acpi_status status;
- u32 i;
-
+ struct acpi_buffer buffer;
+ struct acpi_device_info *info;
+ acpi_status status;
+ u32 i;
- ACPI_FUNCTION_NAME ("ns_dump_one_device");
+ ACPI_FUNCTION_NAME("ns_dump_one_device");
-
- status = acpi_ns_dump_one_object (obj_handle, level, context, return_value);
+ status =
+ acpi_ns_dump_one_object(obj_handle, level, context, return_value);
buffer.length = ACPI_ALLOCATE_LOCAL_BUFFER;
- status = acpi_get_object_info (obj_handle, &buffer);
- if (ACPI_SUCCESS (status)) {
+ status = acpi_get_object_info(obj_handle, &buffer);
+ if (ACPI_SUCCESS(status)) {
info = buffer.pointer;
for (i = 0; i < level; i++) {
- ACPI_DEBUG_PRINT_RAW ((ACPI_DB_TABLES, " "));
+ ACPI_DEBUG_PRINT_RAW((ACPI_DB_TABLES, " "));
}
- ACPI_DEBUG_PRINT_RAW ((ACPI_DB_TABLES,
- " HID: %s, ADR: %8.8X%8.8X, Status: %X\n",
- info->hardware_id.value, ACPI_FORMAT_UINT64 (info->address),
- info->current_status));
- ACPI_MEM_FREE (info);
+ ACPI_DEBUG_PRINT_RAW((ACPI_DB_TABLES,
+ " HID: %s, ADR: %8.8X%8.8X, Status: %X\n",
+ info->hardware_id.value,
+ ACPI_FORMAT_UINT64(info->address),
+ info->current_status));
+ ACPI_MEM_FREE(info);
}
return (status);
}
-
/*******************************************************************************
*
* FUNCTION: acpi_ns_dump_root_devices
@@ -120,16 +110,12 @@ acpi_ns_dump_one_device (
*
******************************************************************************/
-void
-acpi_ns_dump_root_devices (
- void)
+void acpi_ns_dump_root_devices(void)
{
- acpi_handle sys_bus_handle;
- acpi_status status;
-
-
- ACPI_FUNCTION_NAME ("ns_dump_root_devices");
+ acpi_handle sys_bus_handle;
+ acpi_status status;
+ ACPI_FUNCTION_NAME("ns_dump_root_devices");
/* Only dump the table if tracing is enabled */
@@ -138,19 +124,17 @@ acpi_ns_dump_root_devices (
}
status = acpi_get_handle(NULL, ACPI_NS_SYSTEM_BUS, &sys_bus_handle);
- if (ACPI_FAILURE (status)) {
+ if (ACPI_FAILURE(status)) {
return;
}
- ACPI_DEBUG_PRINT ((ACPI_DB_TABLES,
- "Display of all devices in the namespace:\n"));
+ ACPI_DEBUG_PRINT((ACPI_DB_TABLES,
+ "Display of all devices in the namespace:\n"));
- status = acpi_ns_walk_namespace (ACPI_TYPE_DEVICE, sys_bus_handle,
- ACPI_UINT32_MAX, ACPI_NS_WALK_NO_UNLOCK,
- acpi_ns_dump_one_device, NULL, NULL);
+ status = acpi_ns_walk_namespace(ACPI_TYPE_DEVICE, sys_bus_handle,
+ ACPI_UINT32_MAX, ACPI_NS_WALK_NO_UNLOCK,
+ acpi_ns_dump_one_device, NULL, NULL);
}
#endif
#endif
-
-
diff --git a/drivers/acpi/namespace/nseval.c b/drivers/acpi/namespace/nseval.c
index 1ae89a1c8826..0191c7d92824 100644
--- a/drivers/acpi/namespace/nseval.c
+++ b/drivers/acpi/namespace/nseval.c
@@ -42,26 +42,19 @@
* POSSIBILITY OF SUCH DAMAGES.
*/
-
#include <acpi/acpi.h>
#include <acpi/acparser.h>
#include <acpi/acinterp.h>
#include <acpi/acnamesp.h>
-
#define _COMPONENT ACPI_NAMESPACE
- ACPI_MODULE_NAME ("nseval")
+ACPI_MODULE_NAME("nseval")
/* Local prototypes */
-
static acpi_status
-acpi_ns_execute_control_method (
- struct acpi_parameter_info *info);
-
-static acpi_status
-acpi_ns_get_object_value (
- struct acpi_parameter_info *info);
+acpi_ns_execute_control_method(struct acpi_parameter_info *info);
+static acpi_status acpi_ns_get_object_value(struct acpi_parameter_info *info);
/*******************************************************************************
*
@@ -85,48 +78,44 @@ acpi_ns_get_object_value (
******************************************************************************/
acpi_status
-acpi_ns_evaluate_relative (
- char *pathname,
- struct acpi_parameter_info *info)
+acpi_ns_evaluate_relative(char *pathname, struct acpi_parameter_info *info)
{
- acpi_status status;
- struct acpi_namespace_node *node = NULL;
- union acpi_generic_state *scope_info;
- char *internal_path = NULL;
-
-
- ACPI_FUNCTION_TRACE ("ns_evaluate_relative");
+ acpi_status status;
+ struct acpi_namespace_node *node = NULL;
+ union acpi_generic_state *scope_info;
+ char *internal_path = NULL;
+ ACPI_FUNCTION_TRACE("ns_evaluate_relative");
/*
* Must have a valid object handle
*/
if (!info || !info->node) {
- return_ACPI_STATUS (AE_BAD_PARAMETER);
+ return_ACPI_STATUS(AE_BAD_PARAMETER);
}
/* Build an internal name string for the method */
- status = acpi_ns_internalize_name (pathname, &internal_path);
- if (ACPI_FAILURE (status)) {
- return_ACPI_STATUS (status);
+ status = acpi_ns_internalize_name(pathname, &internal_path);
+ if (ACPI_FAILURE(status)) {
+ return_ACPI_STATUS(status);
}
- scope_info = acpi_ut_create_generic_state ();
+ scope_info = acpi_ut_create_generic_state();
if (!scope_info) {
goto cleanup1;
}
/* Get the prefix handle and Node */
- status = acpi_ut_acquire_mutex (ACPI_MTX_NAMESPACE);
- if (ACPI_FAILURE (status)) {
+ status = acpi_ut_acquire_mutex(ACPI_MTX_NAMESPACE);
+ if (ACPI_FAILURE(status)) {
goto cleanup;
}
- info->node = acpi_ns_map_handle_to_node (info->node);
+ info->node = acpi_ns_map_handle_to_node(info->node);
if (!info->node) {
- (void) acpi_ut_release_mutex (ACPI_MTX_NAMESPACE);
+ (void)acpi_ut_release_mutex(ACPI_MTX_NAMESPACE);
status = AE_BAD_PARAMETER;
goto cleanup;
}
@@ -134,39 +123,38 @@ acpi_ns_evaluate_relative (
/* Lookup the name in the namespace */
scope_info->scope.node = info->node;
- status = acpi_ns_lookup (scope_info, internal_path, ACPI_TYPE_ANY,
- ACPI_IMODE_EXECUTE, ACPI_NS_NO_UPSEARCH, NULL,
- &node);
+ status = acpi_ns_lookup(scope_info, internal_path, ACPI_TYPE_ANY,
+ ACPI_IMODE_EXECUTE, ACPI_NS_NO_UPSEARCH, NULL,
+ &node);
- (void) acpi_ut_release_mutex (ACPI_MTX_NAMESPACE);
+ (void)acpi_ut_release_mutex(ACPI_MTX_NAMESPACE);
- if (ACPI_FAILURE (status)) {
- ACPI_DEBUG_PRINT ((ACPI_DB_NAMES, "Object [%s] not found [%s]\n",
- pathname, acpi_format_exception (status)));
+ if (ACPI_FAILURE(status)) {
+ ACPI_DEBUG_PRINT((ACPI_DB_NAMES, "Object [%s] not found [%s]\n",
+ pathname, acpi_format_exception(status)));
goto cleanup;
}
/*
* Now that we have a handle to the object, we can attempt to evaluate it.
*/
- ACPI_DEBUG_PRINT ((ACPI_DB_NAMES, "%s [%p] Value %p\n",
- pathname, node, acpi_ns_get_attached_object (node)));
+ ACPI_DEBUG_PRINT((ACPI_DB_NAMES, "%s [%p] Value %p\n",
+ pathname, node, acpi_ns_get_attached_object(node)));
info->node = node;
- status = acpi_ns_evaluate_by_handle (info);
+ status = acpi_ns_evaluate_by_handle(info);
- ACPI_DEBUG_PRINT ((ACPI_DB_NAMES, "*** Completed eval of object %s ***\n",
- pathname));
+ ACPI_DEBUG_PRINT((ACPI_DB_NAMES,
+ "*** Completed eval of object %s ***\n", pathname));
-cleanup:
- acpi_ut_delete_generic_state (scope_info);
+ cleanup:
+ acpi_ut_delete_generic_state(scope_info);
-cleanup1:
- ACPI_MEM_FREE (internal_path);
- return_ACPI_STATUS (status);
+ cleanup1:
+ ACPI_MEM_FREE(internal_path);
+ return_ACPI_STATUS(status);
}
-
/*******************************************************************************
*
* FUNCTION: acpi_ns_evaluate_by_name
@@ -189,68 +177,63 @@ cleanup1:
******************************************************************************/
acpi_status
-acpi_ns_evaluate_by_name (
- char *pathname,
- struct acpi_parameter_info *info)
+acpi_ns_evaluate_by_name(char *pathname, struct acpi_parameter_info *info)
{
- acpi_status status;
- char *internal_path = NULL;
-
-
- ACPI_FUNCTION_TRACE ("ns_evaluate_by_name");
+ acpi_status status;
+ char *internal_path = NULL;
+ ACPI_FUNCTION_TRACE("ns_evaluate_by_name");
/* Build an internal name string for the method */
- status = acpi_ns_internalize_name (pathname, &internal_path);
- if (ACPI_FAILURE (status)) {
- return_ACPI_STATUS (status);
+ status = acpi_ns_internalize_name(pathname, &internal_path);
+ if (ACPI_FAILURE(status)) {
+ return_ACPI_STATUS(status);
}
- status = acpi_ut_acquire_mutex (ACPI_MTX_NAMESPACE);
- if (ACPI_FAILURE (status)) {
+ status = acpi_ut_acquire_mutex(ACPI_MTX_NAMESPACE);
+ if (ACPI_FAILURE(status)) {
goto cleanup;
}
/* Lookup the name in the namespace */
- status = acpi_ns_lookup (NULL, internal_path, ACPI_TYPE_ANY,
- ACPI_IMODE_EXECUTE, ACPI_NS_NO_UPSEARCH, NULL,
- &info->node);
+ status = acpi_ns_lookup(NULL, internal_path, ACPI_TYPE_ANY,
+ ACPI_IMODE_EXECUTE, ACPI_NS_NO_UPSEARCH, NULL,
+ &info->node);
- (void) acpi_ut_release_mutex (ACPI_MTX_NAMESPACE);
+ (void)acpi_ut_release_mutex(ACPI_MTX_NAMESPACE);
- if (ACPI_FAILURE (status)) {
- ACPI_DEBUG_PRINT ((ACPI_DB_NAMES,
- "Object at [%s] was not found, status=%.4X\n",
- pathname, status));
+ if (ACPI_FAILURE(status)) {
+ ACPI_DEBUG_PRINT((ACPI_DB_NAMES,
+ "Object at [%s] was not found, status=%.4X\n",
+ pathname, status));
goto cleanup;
}
/*
* Now that we have a handle to the object, we can attempt to evaluate it.
*/
- ACPI_DEBUG_PRINT ((ACPI_DB_NAMES, "%s [%p] Value %p\n",
- pathname, info->node, acpi_ns_get_attached_object (info->node)));
-
- status = acpi_ns_evaluate_by_handle (info);
+ ACPI_DEBUG_PRINT((ACPI_DB_NAMES, "%s [%p] Value %p\n",
+ pathname, info->node,
+ acpi_ns_get_attached_object(info->node)));
- ACPI_DEBUG_PRINT ((ACPI_DB_NAMES, "*** Completed eval of object %s ***\n",
- pathname));
+ status = acpi_ns_evaluate_by_handle(info);
+ ACPI_DEBUG_PRINT((ACPI_DB_NAMES,
+ "*** Completed eval of object %s ***\n", pathname));
-cleanup:
+ cleanup:
/* Cleanup */
if (internal_path) {
- ACPI_MEM_FREE (internal_path);
+ ACPI_MEM_FREE(internal_path);
}
- return_ACPI_STATUS (status);
+ return_ACPI_STATUS(status);
}
-
/*******************************************************************************
*
* FUNCTION: acpi_ns_evaluate_by_handle
@@ -275,26 +258,22 @@ cleanup:
*
******************************************************************************/
-acpi_status
-acpi_ns_evaluate_by_handle (
- struct acpi_parameter_info *info)
+acpi_status acpi_ns_evaluate_by_handle(struct acpi_parameter_info *info)
{
- acpi_status status;
-
-
- ACPI_FUNCTION_TRACE ("ns_evaluate_by_handle");
+ acpi_status status;
+ ACPI_FUNCTION_TRACE("ns_evaluate_by_handle");
/* Check if namespace has been initialized */
if (!acpi_gbl_root_node) {
- return_ACPI_STATUS (AE_NO_NAMESPACE);
+ return_ACPI_STATUS(AE_NO_NAMESPACE);
}
/* Parameter Validation */
if (!info) {
- return_ACPI_STATUS (AE_BAD_PARAMETER);
+ return_ACPI_STATUS(AE_BAD_PARAMETER);
}
/* Initialize the return value to an invalid object */
@@ -303,23 +282,25 @@ acpi_ns_evaluate_by_handle (
/* Get the prefix handle and Node */
- status = acpi_ut_acquire_mutex (ACPI_MTX_NAMESPACE);
- if (ACPI_FAILURE (status)) {
- return_ACPI_STATUS (status);
+ status = acpi_ut_acquire_mutex(ACPI_MTX_NAMESPACE);
+ if (ACPI_FAILURE(status)) {
+ return_ACPI_STATUS(status);
}
- info->node = acpi_ns_map_handle_to_node (info->node);
+ info->node = acpi_ns_map_handle_to_node(info->node);
if (!info->node) {
- (void) acpi_ut_release_mutex (ACPI_MTX_NAMESPACE);
- return_ACPI_STATUS (AE_BAD_PARAMETER);
+ (void)acpi_ut_release_mutex(ACPI_MTX_NAMESPACE);
+ return_ACPI_STATUS(AE_BAD_PARAMETER);
}
/*
* For a method alias, we must grab the actual method node so that proper
* scoping context will be established before execution.
*/
- if (acpi_ns_get_type (info->node) == ACPI_TYPE_LOCAL_METHOD_ALIAS) {
- info->node = ACPI_CAST_PTR (struct acpi_namespace_node, info->node->object);
+ if (acpi_ns_get_type(info->node) == ACPI_TYPE_LOCAL_METHOD_ALIAS) {
+ info->node =
+ ACPI_CAST_PTR(struct acpi_namespace_node,
+ info->node->object);
}
/*
@@ -329,17 +310,16 @@ acpi_ns_evaluate_by_handle (
*
* In both cases, the namespace is unlocked by the acpi_ns* procedure
*/
- if (acpi_ns_get_type (info->node) == ACPI_TYPE_METHOD) {
+ if (acpi_ns_get_type(info->node) == ACPI_TYPE_METHOD) {
/*
* Case 1) We have an actual control method to execute
*/
- status = acpi_ns_execute_control_method (info);
- }
- else {
+ status = acpi_ns_execute_control_method(info);
+ } else {
/*
* Case 2) Object is NOT a method, just return its current value
*/
- status = acpi_ns_get_object_value (info);
+ status = acpi_ns_get_object_value(info);
}
/*
@@ -355,16 +335,16 @@ acpi_ns_evaluate_by_handle (
* Namespace was unlocked by the handling acpi_ns* function, so we
* just return
*/
- return_ACPI_STATUS (status);
+ return_ACPI_STATUS(status);
}
-
/*******************************************************************************
*
* FUNCTION: acpi_ns_execute_control_method
*
* PARAMETERS: Info - Method info block, contains:
* Node - Method Node to execute
+ * obj_desc - Method object
* Parameters - List of parameters to pass to the method,
* terminated by NULL. Params itself may be
* NULL if no parameters are being passed.
@@ -383,31 +363,29 @@ acpi_ns_evaluate_by_handle (
******************************************************************************/
static acpi_status
-acpi_ns_execute_control_method (
- struct acpi_parameter_info *info)
+acpi_ns_execute_control_method(struct acpi_parameter_info *info)
{
- acpi_status status;
- union acpi_operand_object *obj_desc;
-
-
- ACPI_FUNCTION_TRACE ("ns_execute_control_method");
+ acpi_status status;
+ ACPI_FUNCTION_TRACE("ns_execute_control_method");
/* Verify that there is a method associated with this object */
- obj_desc = acpi_ns_get_attached_object (info->node);
- if (!obj_desc) {
- ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, "No attached method object\n"));
+ info->obj_desc = acpi_ns_get_attached_object(info->node);
+ if (!info->obj_desc) {
+ ACPI_DEBUG_PRINT((ACPI_DB_ERROR,
+ "No attached method object\n"));
- (void) acpi_ut_release_mutex (ACPI_MTX_NAMESPACE);
- return_ACPI_STATUS (AE_NULL_OBJECT);
+ (void)acpi_ut_release_mutex(ACPI_MTX_NAMESPACE);
+ return_ACPI_STATUS(AE_NULL_OBJECT);
}
- ACPI_DUMP_PATHNAME (info->node, "Execute Method:",
- ACPI_LV_INFO, _COMPONENT);
+ ACPI_DUMP_PATHNAME(info->node, "Execute Method:",
+ ACPI_LV_INFO, _COMPONENT);
- ACPI_DEBUG_PRINT ((ACPI_DB_EXEC, "Method at AML address %p Length %X\n",
- obj_desc->method.aml_start + 1, obj_desc->method.aml_length - 1));
+ ACPI_DEBUG_PRINT((ACPI_DB_EXEC, "Method at AML address %p Length %X\n",
+ info->obj_desc->method.aml_start + 1,
+ info->obj_desc->method.aml_length - 1));
/*
* Unlock the namespace before execution. This allows namespace access
@@ -416,27 +394,26 @@ acpi_ns_execute_control_method (
* interpreter locks to ensure that no thread is using the portion of the
* namespace that is being deleted.
*/
- status = acpi_ut_release_mutex (ACPI_MTX_NAMESPACE);
- if (ACPI_FAILURE (status)) {
- return_ACPI_STATUS (status);
+ status = acpi_ut_release_mutex(ACPI_MTX_NAMESPACE);
+ if (ACPI_FAILURE(status)) {
+ return_ACPI_STATUS(status);
}
/*
* Execute the method via the interpreter. The interpreter is locked
* here before calling into the AML parser
*/
- status = acpi_ex_enter_interpreter ();
- if (ACPI_FAILURE (status)) {
- return_ACPI_STATUS (status);
+ status = acpi_ex_enter_interpreter();
+ if (ACPI_FAILURE(status)) {
+ return_ACPI_STATUS(status);
}
- status = acpi_psx_execute (info);
- acpi_ex_exit_interpreter ();
+ status = acpi_ps_execute_method(info);
+ acpi_ex_exit_interpreter();
- return_ACPI_STATUS (status);
+ return_ACPI_STATUS(status);
}
-
/*******************************************************************************
*
* FUNCTION: acpi_ns_get_object_value
@@ -454,16 +431,12 @@ acpi_ns_execute_control_method (
*
******************************************************************************/
-static acpi_status
-acpi_ns_get_object_value (
- struct acpi_parameter_info *info)
+static acpi_status acpi_ns_get_object_value(struct acpi_parameter_info *info)
{
- acpi_status status = AE_OK;
- struct acpi_namespace_node *resolved_node = info->node;
-
-
- ACPI_FUNCTION_TRACE ("ns_get_object_value");
+ acpi_status status = AE_OK;
+ struct acpi_namespace_node *resolved_node = info->node;
+ ACPI_FUNCTION_TRACE("ns_get_object_value");
/*
* Objects require additional resolution steps (e.g., the Node may be a
@@ -486,32 +459,33 @@ acpi_ns_get_object_value (
*
* We must release the namespace lock before entering the intepreter.
*/
- status = acpi_ut_release_mutex (ACPI_MTX_NAMESPACE);
- if (ACPI_FAILURE (status)) {
- return_ACPI_STATUS (status);
+ status = acpi_ut_release_mutex(ACPI_MTX_NAMESPACE);
+ if (ACPI_FAILURE(status)) {
+ return_ACPI_STATUS(status);
}
- status = acpi_ex_enter_interpreter ();
- if (ACPI_SUCCESS (status)) {
- status = acpi_ex_resolve_node_to_value (&resolved_node, NULL);
+ status = acpi_ex_enter_interpreter();
+ if (ACPI_SUCCESS(status)) {
+ status = acpi_ex_resolve_node_to_value(&resolved_node, NULL);
/*
* If acpi_ex_resolve_node_to_value() succeeded, the return value was placed
* in resolved_node.
*/
- acpi_ex_exit_interpreter ();
+ acpi_ex_exit_interpreter();
- if (ACPI_SUCCESS (status)) {
+ if (ACPI_SUCCESS(status)) {
status = AE_CTRL_RETURN_VALUE;
info->return_object = ACPI_CAST_PTR
- (union acpi_operand_object, resolved_node);
- ACPI_DEBUG_PRINT ((ACPI_DB_NAMES, "Returning object %p [%s]\n",
- info->return_object,
- acpi_ut_get_object_type_name (info->return_object)));
+ (union acpi_operand_object, resolved_node);
+ ACPI_DEBUG_PRINT((ACPI_DB_NAMES,
+ "Returning object %p [%s]\n",
+ info->return_object,
+ acpi_ut_get_object_type_name(info->
+ return_object)));
}
}
/* Namespace is unlocked */
- return_ACPI_STATUS (status);
+ return_ACPI_STATUS(status);
}
-
diff --git a/drivers/acpi/namespace/nsinit.c b/drivers/acpi/namespace/nsinit.c
index 362802ae29a2..0a08d2f04a06 100644
--- a/drivers/acpi/namespace/nsinit.c
+++ b/drivers/acpi/namespace/nsinit.c
@@ -41,31 +41,22 @@
* POSSIBILITY OF SUCH DAMAGES.
*/
-
#include <acpi/acpi.h>
#include <acpi/acnamesp.h>
#include <acpi/acdispat.h>
#include <acpi/acinterp.h>
#define _COMPONENT ACPI_NAMESPACE
- ACPI_MODULE_NAME ("nsinit")
+ACPI_MODULE_NAME("nsinit")
/* Local prototypes */
-
static acpi_status
-acpi_ns_init_one_object (
- acpi_handle obj_handle,
- u32 level,
- void *context,
- void **return_value);
+acpi_ns_init_one_object(acpi_handle obj_handle,
+ u32 level, void *context, void **return_value);
static acpi_status
-acpi_ns_init_one_device (
- acpi_handle obj_handle,
- u32 nesting_level,
- void *context,
- void **return_value);
-
+acpi_ns_init_one_device(acpi_handle obj_handle,
+ u32 nesting_level, void *context, void **return_value);
/*******************************************************************************
*
@@ -80,52 +71,48 @@ acpi_ns_init_one_device (
*
******************************************************************************/
-acpi_status
-acpi_ns_initialize_objects (
- void)
+acpi_status acpi_ns_initialize_objects(void)
{
- acpi_status status;
- struct acpi_init_walk_info info;
-
+ acpi_status status;
+ struct acpi_init_walk_info info;
- ACPI_FUNCTION_TRACE ("ns_initialize_objects");
+ ACPI_FUNCTION_TRACE("ns_initialize_objects");
-
- ACPI_DEBUG_PRINT ((ACPI_DB_DISPATCH,
- "**** Starting initialization of namespace objects ****\n"));
- ACPI_DEBUG_PRINT_RAW ((ACPI_DB_INIT,
- "Completing Region/Field/Buffer/Package initialization:"));
+ ACPI_DEBUG_PRINT((ACPI_DB_DISPATCH,
+ "**** Starting initialization of namespace objects ****\n"));
+ ACPI_DEBUG_PRINT_RAW((ACPI_DB_INIT,
+ "Completing Region/Field/Buffer/Package initialization:"));
/* Set all init info to zero */
- ACPI_MEMSET (&info, 0, sizeof (struct acpi_init_walk_info));
+ ACPI_MEMSET(&info, 0, sizeof(struct acpi_init_walk_info));
/* Walk entire namespace from the supplied root */
- status = acpi_walk_namespace (ACPI_TYPE_ANY, ACPI_ROOT_OBJECT,
- ACPI_UINT32_MAX, acpi_ns_init_one_object,
- &info, NULL);
- if (ACPI_FAILURE (status)) {
- ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, "walk_namespace failed! %s\n",
- acpi_format_exception (status)));
+ status = acpi_walk_namespace(ACPI_TYPE_ANY, ACPI_ROOT_OBJECT,
+ ACPI_UINT32_MAX, acpi_ns_init_one_object,
+ &info, NULL);
+ if (ACPI_FAILURE(status)) {
+ ACPI_DEBUG_PRINT((ACPI_DB_ERROR, "walk_namespace failed! %s\n",
+ acpi_format_exception(status)));
}
- ACPI_DEBUG_PRINT_RAW ((ACPI_DB_INIT,
- "\nInitialized %hd/%hd Regions %hd/%hd Fields %hd/%hd Buffers %hd/%hd Packages (%hd nodes)\n",
- info.op_region_init, info.op_region_count,
- info.field_init, info.field_count,
- info.buffer_init, info.buffer_count,
- info.package_init, info.package_count, info.object_count));
+ ACPI_DEBUG_PRINT_RAW((ACPI_DB_INIT,
+ "\nInitialized %hd/%hd Regions %hd/%hd Fields %hd/%hd Buffers %hd/%hd Packages (%hd nodes)\n",
+ info.op_region_init, info.op_region_count,
+ info.field_init, info.field_count,
+ info.buffer_init, info.buffer_count,
+ info.package_init, info.package_count,
+ info.object_count));
- ACPI_DEBUG_PRINT ((ACPI_DB_DISPATCH,
- "%hd Control Methods found\n", info.method_count));
- ACPI_DEBUG_PRINT ((ACPI_DB_DISPATCH,
- "%hd Op Regions found\n", info.op_region_count));
+ ACPI_DEBUG_PRINT((ACPI_DB_DISPATCH,
+ "%hd Control Methods found\n", info.method_count));
+ ACPI_DEBUG_PRINT((ACPI_DB_DISPATCH,
+ "%hd Op Regions found\n", info.op_region_count));
- return_ACPI_STATUS (AE_OK);
+ return_ACPI_STATUS(AE_OK);
}
-
/*******************************************************************************
*
* FUNCTION: acpi_ns_initialize_devices
@@ -142,16 +129,12 @@ acpi_ns_initialize_objects (
*
******************************************************************************/
-acpi_status
-acpi_ns_initialize_devices (
- void)
+acpi_status acpi_ns_initialize_devices(void)
{
- acpi_status status;
- struct acpi_device_walk_info info;
-
-
- ACPI_FUNCTION_TRACE ("ns_initialize_devices");
+ acpi_status status;
+ struct acpi_device_walk_info info;
+ ACPI_FUNCTION_TRACE("ns_initialize_devices");
/* Init counters */
@@ -159,34 +142,34 @@ acpi_ns_initialize_devices (
info.num_STA = 0;
info.num_INI = 0;
- ACPI_DEBUG_PRINT_RAW ((ACPI_DB_INIT,
- "Executing all Device _STA and_INI methods:"));
+ ACPI_DEBUG_PRINT_RAW((ACPI_DB_INIT,
+ "Executing all Device _STA and_INI methods:"));
- status = acpi_ut_acquire_mutex (ACPI_MTX_NAMESPACE);
- if (ACPI_FAILURE (status)) {
- return_ACPI_STATUS (status);
+ status = acpi_ut_acquire_mutex(ACPI_MTX_NAMESPACE);
+ if (ACPI_FAILURE(status)) {
+ return_ACPI_STATUS(status);
}
/* Walk namespace for all objects */
- status = acpi_ns_walk_namespace (ACPI_TYPE_ANY, ACPI_ROOT_OBJECT,
- ACPI_UINT32_MAX, TRUE, acpi_ns_init_one_device, &info, NULL);
+ status = acpi_ns_walk_namespace(ACPI_TYPE_ANY, ACPI_ROOT_OBJECT,
+ ACPI_UINT32_MAX, TRUE,
+ acpi_ns_init_one_device, &info, NULL);
- (void) acpi_ut_release_mutex (ACPI_MTX_NAMESPACE);
+ (void)acpi_ut_release_mutex(ACPI_MTX_NAMESPACE);
- if (ACPI_FAILURE (status)) {
- ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, "walk_namespace failed! %s\n",
- acpi_format_exception (status)));
+ if (ACPI_FAILURE(status)) {
+ ACPI_DEBUG_PRINT((ACPI_DB_ERROR, "walk_namespace failed! %s\n",
+ acpi_format_exception(status)));
}
- ACPI_DEBUG_PRINT_RAW ((ACPI_DB_INIT,
- "\n%hd Devices found containing: %hd _STA, %hd _INI methods\n",
- info.device_count, info.num_STA, info.num_INI));
+ ACPI_DEBUG_PRINT_RAW((ACPI_DB_INIT,
+ "\n%hd Devices found containing: %hd _STA, %hd _INI methods\n",
+ info.device_count, info.num_STA, info.num_INI));
- return_ACPI_STATUS (status);
+ return_ACPI_STATUS(status);
}
-
/*******************************************************************************
*
* FUNCTION: acpi_ns_init_one_object
@@ -208,28 +191,25 @@ acpi_ns_initialize_devices (
******************************************************************************/
static acpi_status
-acpi_ns_init_one_object (
- acpi_handle obj_handle,
- u32 level,
- void *context,
- void **return_value)
+acpi_ns_init_one_object(acpi_handle obj_handle,
+ u32 level, void *context, void **return_value)
{
- acpi_object_type type;
- acpi_status status;
- struct acpi_init_walk_info *info = (struct acpi_init_walk_info *) context;
- struct acpi_namespace_node *node = (struct acpi_namespace_node *) obj_handle;
- union acpi_operand_object *obj_desc;
-
-
- ACPI_FUNCTION_NAME ("ns_init_one_object");
+ acpi_object_type type;
+ acpi_status status;
+ struct acpi_init_walk_info *info =
+ (struct acpi_init_walk_info *)context;
+ struct acpi_namespace_node *node =
+ (struct acpi_namespace_node *)obj_handle;
+ union acpi_operand_object *obj_desc;
+ ACPI_FUNCTION_NAME("ns_init_one_object");
info->object_count++;
/* And even then, we are only interested in a few object types */
- type = acpi_ns_get_type (obj_handle);
- obj_desc = acpi_ns_get_attached_object (node);
+ type = acpi_ns_get_type(obj_handle);
+ obj_desc = acpi_ns_get_attached_object(node);
if (!obj_desc) {
return (AE_OK);
}
@@ -269,8 +249,8 @@ acpi_ns_init_one_object (
/*
* Must lock the interpreter before executing AML code
*/
- status = acpi_ex_enter_interpreter ();
- if (ACPI_FAILURE (status)) {
+ status = acpi_ex_enter_interpreter();
+ if (ACPI_FAILURE(status)) {
return (status);
}
@@ -282,25 +262,25 @@ acpi_ns_init_one_object (
case ACPI_TYPE_REGION:
info->op_region_init++;
- status = acpi_ds_get_region_arguments (obj_desc);
+ status = acpi_ds_get_region_arguments(obj_desc);
break;
case ACPI_TYPE_BUFFER_FIELD:
info->field_init++;
- status = acpi_ds_get_buffer_field_arguments (obj_desc);
+ status = acpi_ds_get_buffer_field_arguments(obj_desc);
break;
case ACPI_TYPE_BUFFER:
info->buffer_init++;
- status = acpi_ds_get_buffer_arguments (obj_desc);
+ status = acpi_ds_get_buffer_arguments(obj_desc);
break;
case ACPI_TYPE_PACKAGE:
info->package_init++;
- status = acpi_ds_get_package_arguments (obj_desc);
+ status = acpi_ds_get_package_arguments(obj_desc);
break;
default:
@@ -308,12 +288,13 @@ acpi_ns_init_one_object (
break;
}
- if (ACPI_FAILURE (status)) {
- ACPI_DEBUG_PRINT_RAW ((ACPI_DB_ERROR, "\n"));
- ACPI_DEBUG_PRINT ((ACPI_DB_ERROR,
- "Could not execute arguments for [%4.4s] (%s), %s\n",
- acpi_ut_get_node_name (node), acpi_ut_get_type_name (type),
- acpi_format_exception (status)));
+ if (ACPI_FAILURE(status)) {
+ ACPI_DEBUG_PRINT_RAW((ACPI_DB_ERROR, "\n"));
+ ACPI_DEBUG_PRINT((ACPI_DB_ERROR,
+ "Could not execute arguments for [%4.4s] (%s), %s\n",
+ acpi_ut_get_node_name(node),
+ acpi_ut_get_type_name(type),
+ acpi_format_exception(status)));
}
/*
@@ -321,18 +302,17 @@ acpi_ns_init_one_object (
* pathname
*/
if (!(acpi_dbg_level & ACPI_LV_INIT_NAMES)) {
- ACPI_DEBUG_PRINT_RAW ((ACPI_DB_INIT, "."));
+ ACPI_DEBUG_PRINT_RAW((ACPI_DB_INIT, "."));
}
/*
* We ignore errors from above, and always return OK, since we don't want
* to abort the walk on any single error.
*/
- acpi_ex_exit_interpreter ();
+ acpi_ex_exit_interpreter();
return (AE_OK);
}
-
/*******************************************************************************
*
* FUNCTION: acpi_ns_init_one_device
@@ -348,41 +328,37 @@ acpi_ns_init_one_object (
******************************************************************************/
static acpi_status
-acpi_ns_init_one_device (
- acpi_handle obj_handle,
- u32 nesting_level,
- void *context,
- void **return_value)
+acpi_ns_init_one_device(acpi_handle obj_handle,
+ u32 nesting_level, void *context, void **return_value)
{
- struct acpi_device_walk_info *info = (struct acpi_device_walk_info *) context;
- struct acpi_parameter_info pinfo;
- u32 flags;
- acpi_status status;
-
-
- ACPI_FUNCTION_TRACE ("ns_init_one_device");
+ struct acpi_device_walk_info *info =
+ (struct acpi_device_walk_info *)context;
+ struct acpi_parameter_info pinfo;
+ u32 flags;
+ acpi_status status;
+ ACPI_FUNCTION_TRACE("ns_init_one_device");
pinfo.parameters = NULL;
pinfo.parameter_type = ACPI_PARAM_ARGS;
- pinfo.node = acpi_ns_map_handle_to_node (obj_handle);
+ pinfo.node = acpi_ns_map_handle_to_node(obj_handle);
if (!pinfo.node) {
- return_ACPI_STATUS (AE_BAD_PARAMETER);
+ return_ACPI_STATUS(AE_BAD_PARAMETER);
}
/*
* We will run _STA/_INI on Devices, Processors and thermal_zones only
*/
- if ((pinfo.node->type != ACPI_TYPE_DEVICE) &&
- (pinfo.node->type != ACPI_TYPE_PROCESSOR) &&
- (pinfo.node->type != ACPI_TYPE_THERMAL)) {
- return_ACPI_STATUS (AE_OK);
+ if ((pinfo.node->type != ACPI_TYPE_DEVICE) &&
+ (pinfo.node->type != ACPI_TYPE_PROCESSOR) &&
+ (pinfo.node->type != ACPI_TYPE_THERMAL)) {
+ return_ACPI_STATUS(AE_OK);
}
if ((acpi_dbg_level <= ACPI_LV_ALL_EXCEPTIONS) &&
- (!(acpi_dbg_level & ACPI_LV_INFO))) {
- ACPI_DEBUG_PRINT_RAW ((ACPI_DB_INIT, "."));
+ (!(acpi_dbg_level & ACPI_LV_INFO))) {
+ ACPI_DEBUG_PRINT_RAW((ACPI_DB_INIT, "."));
}
info->device_count++;
@@ -390,20 +366,20 @@ acpi_ns_init_one_device (
/*
* Run _STA to determine if we can run _INI on the device.
*/
- ACPI_DEBUG_EXEC (acpi_ut_display_init_pathname (ACPI_TYPE_METHOD,
- pinfo.node, METHOD_NAME__STA));
- status = acpi_ut_execute_STA (pinfo.node, &flags);
+ ACPI_DEBUG_EXEC(acpi_ut_display_init_pathname(ACPI_TYPE_METHOD,
+ pinfo.node,
+ METHOD_NAME__STA));
+ status = acpi_ut_execute_STA(pinfo.node, &flags);
- if (ACPI_FAILURE (status)) {
+ if (ACPI_FAILURE(status)) {
if (pinfo.node->type == ACPI_TYPE_DEVICE) {
/* Ignore error and move on to next device */
- return_ACPI_STATUS (AE_OK);
+ return_ACPI_STATUS(AE_OK);
}
/* _STA is not required for Processor or thermal_zone objects */
- }
- else {
+ } else {
info->num_STA++;
if (!(flags & 0x01)) {
@@ -416,32 +392,34 @@ acpi_ns_init_one_device (
/*
* The device is present. Run _INI.
*/
- ACPI_DEBUG_EXEC (acpi_ut_display_init_pathname (ACPI_TYPE_METHOD,
- pinfo.node, METHOD_NAME__INI));
- status = acpi_ns_evaluate_relative (METHOD_NAME__INI, &pinfo);
- if (ACPI_FAILURE (status)) {
+ ACPI_DEBUG_EXEC(acpi_ut_display_init_pathname(ACPI_TYPE_METHOD,
+ pinfo.node,
+ METHOD_NAME__INI));
+ status = acpi_ns_evaluate_relative(METHOD_NAME__INI, &pinfo);
+ if (ACPI_FAILURE(status)) {
/* No _INI (AE_NOT_FOUND) means device requires no initialization */
if (status != AE_NOT_FOUND) {
/* Ignore error and move on to next device */
#ifdef ACPI_DEBUG_OUTPUT
- char *scope_name = acpi_ns_get_external_pathname (pinfo.node);
+ char *scope_name =
+ acpi_ns_get_external_pathname(pinfo.node);
- ACPI_DEBUG_PRINT ((ACPI_DB_WARN, "%s._INI failed: %s\n",
- scope_name, acpi_format_exception (status)));
+ ACPI_DEBUG_PRINT((ACPI_DB_WARN, "%s._INI failed: %s\n",
+ scope_name,
+ acpi_format_exception(status)));
- ACPI_MEM_FREE (scope_name);
+ ACPI_MEM_FREE(scope_name);
#endif
}
status = AE_OK;
- }
- else {
+ } else {
/* Delete any return object (especially if implicit_return is enabled) */
if (pinfo.return_object) {
- acpi_ut_remove_reference (pinfo.return_object);
+ acpi_ut_remove_reference(pinfo.return_object);
}
/* Count of successful INIs */
@@ -452,8 +430,9 @@ acpi_ns_init_one_device (
if (acpi_gbl_init_handler) {
/* External initialization handler is present, call it */
- status = acpi_gbl_init_handler (pinfo.node, ACPI_INIT_DEVICE_INI);
+ status =
+ acpi_gbl_init_handler(pinfo.node, ACPI_INIT_DEVICE_INI);
}
- return_ACPI_STATUS (status);
+ return_ACPI_STATUS(status);
}
diff --git a/drivers/acpi/namespace/nsload.c b/drivers/acpi/namespace/nsload.c
index 34e497016601..c28849de465a 100644
--- a/drivers/acpi/namespace/nsload.c
+++ b/drivers/acpi/namespace/nsload.c
@@ -41,32 +41,22 @@
* POSSIBILITY OF SUCH DAMAGES.
*/
-
#include <acpi/acpi.h>
#include <acpi/acnamesp.h>
#include <acpi/acdispat.h>
-
#define _COMPONENT ACPI_NAMESPACE
- ACPI_MODULE_NAME ("nsload")
+ACPI_MODULE_NAME("nsload")
/* Local prototypes */
-
-static acpi_status
-acpi_ns_load_table_by_type (
- acpi_table_type table_type);
+static acpi_status acpi_ns_load_table_by_type(acpi_table_type table_type);
#ifdef ACPI_FUTURE_IMPLEMENTATION
-acpi_status
-acpi_ns_unload_namespace (
- acpi_handle handle);
+acpi_status acpi_ns_unload_namespace(acpi_handle handle);
-static acpi_status
-acpi_ns_delete_subtree (
- acpi_handle start_handle);
+static acpi_status acpi_ns_delete_subtree(acpi_handle start_handle);
#endif
-
#ifndef ACPI_NO_METHOD_EXECUTION
/*******************************************************************************
*
@@ -82,40 +72,39 @@ acpi_ns_delete_subtree (
******************************************************************************/
acpi_status
-acpi_ns_load_table (
- struct acpi_table_desc *table_desc,
- struct acpi_namespace_node *node)
+acpi_ns_load_table(struct acpi_table_desc *table_desc,
+ struct acpi_namespace_node *node)
{
- acpi_status status;
-
-
- ACPI_FUNCTION_TRACE ("ns_load_table");
+ acpi_status status;
+ ACPI_FUNCTION_TRACE("ns_load_table");
/* Check if table contains valid AML (must be DSDT, PSDT, SSDT, etc.) */
- if (!(acpi_gbl_table_data[table_desc->type].flags & ACPI_TABLE_EXECUTABLE)) {
+ if (!
+ (acpi_gbl_table_data[table_desc->type].
+ flags & ACPI_TABLE_EXECUTABLE)) {
/* Just ignore this table */
- return_ACPI_STATUS (AE_OK);
+ return_ACPI_STATUS(AE_OK);
}
/* Check validity of the AML start and length */
if (!table_desc->aml_start) {
- ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, "Null AML pointer\n"));
- return_ACPI_STATUS (AE_BAD_PARAMETER);
+ ACPI_DEBUG_PRINT((ACPI_DB_ERROR, "Null AML pointer\n"));
+ return_ACPI_STATUS(AE_BAD_PARAMETER);
}
- ACPI_DEBUG_PRINT ((ACPI_DB_INFO, "AML block at %p\n",
- table_desc->aml_start));
+ ACPI_DEBUG_PRINT((ACPI_DB_INFO, "AML block at %p\n",
+ table_desc->aml_start));
/* Ignore table if there is no AML contained within */
if (!table_desc->aml_length) {
- ACPI_REPORT_WARNING (("Zero-length AML block in table [%4.4s]\n",
- table_desc->pointer->signature));
- return_ACPI_STATUS (AE_OK);
+ ACPI_REPORT_WARNING(("Zero-length AML block in table [%4.4s]\n",
+ table_desc->pointer->signature));
+ return_ACPI_STATUS(AE_OK);
}
/*
@@ -127,19 +116,19 @@ acpi_ns_load_table (
* to another control method, we can't continue parsing
* because we don't know how many arguments to parse next!
*/
- ACPI_DEBUG_PRINT ((ACPI_DB_INFO,
- "**** Loading table into namespace ****\n"));
+ ACPI_DEBUG_PRINT((ACPI_DB_INFO,
+ "**** Loading table into namespace ****\n"));
- status = acpi_ut_acquire_mutex (ACPI_MTX_NAMESPACE);
- if (ACPI_FAILURE (status)) {
- return_ACPI_STATUS (status);
+ status = acpi_ut_acquire_mutex(ACPI_MTX_NAMESPACE);
+ if (ACPI_FAILURE(status)) {
+ return_ACPI_STATUS(status);
}
- status = acpi_ns_parse_table (table_desc, node->child);
- (void) acpi_ut_release_mutex (ACPI_MTX_NAMESPACE);
+ status = acpi_ns_parse_table(table_desc, node->child);
+ (void)acpi_ut_release_mutex(ACPI_MTX_NAMESPACE);
- if (ACPI_FAILURE (status)) {
- return_ACPI_STATUS (status);
+ if (ACPI_FAILURE(status)) {
+ return_ACPI_STATUS(status);
}
/*
@@ -148,18 +137,17 @@ acpi_ns_load_table (
* just-in-time parsing, we delete the control method
* parse trees.
*/
- ACPI_DEBUG_PRINT ((ACPI_DB_INFO,
- "**** Begin Table Method Parsing and Object Initialization ****\n"));
+ ACPI_DEBUG_PRINT((ACPI_DB_INFO,
+ "**** Begin Table Method Parsing and Object Initialization ****\n"));
- status = acpi_ds_initialize_objects (table_desc, node);
+ status = acpi_ds_initialize_objects(table_desc, node);
- ACPI_DEBUG_PRINT ((ACPI_DB_INFO,
- "**** Completed Table Method Parsing and Object Initialization ****\n"));
+ ACPI_DEBUG_PRINT((ACPI_DB_INFO,
+ "**** Completed Table Method Parsing and Object Initialization ****\n"));
- return_ACPI_STATUS (status);
+ return_ACPI_STATUS(status);
}
-
/*******************************************************************************
*
* FUNCTION: acpi_ns_load_table_by_type
@@ -174,21 +162,17 @@ acpi_ns_load_table (
*
******************************************************************************/
-static acpi_status
-acpi_ns_load_table_by_type (
- acpi_table_type table_type)
+static acpi_status acpi_ns_load_table_by_type(acpi_table_type table_type)
{
- u32 i;
- acpi_status status;
- struct acpi_table_desc *table_desc;
-
+ u32 i;
+ acpi_status status;
+ struct acpi_table_desc *table_desc;
- ACPI_FUNCTION_TRACE ("ns_load_table_by_type");
+ ACPI_FUNCTION_TRACE("ns_load_table_by_type");
-
- status = acpi_ut_acquire_mutex (ACPI_MTX_TABLES);
- if (ACPI_FAILURE (status)) {
- return_ACPI_STATUS (status);
+ status = acpi_ut_acquire_mutex(ACPI_MTX_TABLES);
+ if (ACPI_FAILURE(status)) {
+ return_ACPI_STATUS(status);
}
/*
@@ -198,7 +182,7 @@ acpi_ns_load_table_by_type (
switch (table_type) {
case ACPI_TABLE_DSDT:
- ACPI_DEBUG_PRINT ((ACPI_DB_INFO, "Loading DSDT\n"));
+ ACPI_DEBUG_PRINT((ACPI_DB_INFO, "Namespace load: DSDT\n"));
table_desc = acpi_gbl_table_lists[ACPI_TABLE_DSDT].next;
@@ -210,57 +194,33 @@ acpi_ns_load_table_by_type (
/* Now load the single DSDT */
- status = acpi_ns_load_table (table_desc, acpi_gbl_root_node);
- if (ACPI_SUCCESS (status)) {
+ status = acpi_ns_load_table(table_desc, acpi_gbl_root_node);
+ if (ACPI_SUCCESS(status)) {
table_desc->loaded_into_namespace = TRUE;
}
break;
-
case ACPI_TABLE_SSDT:
+ case ACPI_TABLE_PSDT:
- ACPI_DEBUG_PRINT ((ACPI_DB_INFO, "Loading %d SSDTs\n",
- acpi_gbl_table_lists[ACPI_TABLE_SSDT].count));
+ ACPI_DEBUG_PRINT((ACPI_DB_INFO,
+ "Namespace load: %d SSDT or PSDTs\n",
+ acpi_gbl_table_lists[table_type].count));
/*
- * Traverse list of SSDT tables
+ * Traverse list of SSDT or PSDT tables
*/
- table_desc = acpi_gbl_table_lists[ACPI_TABLE_SSDT].next;
- for (i = 0; i < acpi_gbl_table_lists[ACPI_TABLE_SSDT].count; i++) {
+ table_desc = acpi_gbl_table_lists[table_type].next;
+ for (i = 0; i < acpi_gbl_table_lists[table_type].count; i++) {
/*
- * Only attempt to load table if it is not
+ * Only attempt to load table into namespace if it is not
* already loaded!
*/
if (!table_desc->loaded_into_namespace) {
- status = acpi_ns_load_table (table_desc, acpi_gbl_root_node);
- if (ACPI_FAILURE (status)) {
- break;
- }
-
- table_desc->loaded_into_namespace = TRUE;
- }
-
- table_desc = table_desc->next;
- }
- break;
-
-
- case ACPI_TABLE_PSDT:
-
- ACPI_DEBUG_PRINT ((ACPI_DB_INFO, "Loading %d PSDTs\n",
- acpi_gbl_table_lists[ACPI_TABLE_PSDT].count));
-
- /*
- * Traverse list of PSDT tables
- */
- table_desc = acpi_gbl_table_lists[ACPI_TABLE_PSDT].next;
-
- for (i = 0; i < acpi_gbl_table_lists[ACPI_TABLE_PSDT].count; i++) {
- /* Only attempt to load table if it is not already loaded! */
-
- if (!table_desc->loaded_into_namespace) {
- status = acpi_ns_load_table (table_desc, acpi_gbl_root_node);
- if (ACPI_FAILURE (status)) {
+ status =
+ acpi_ns_load_table(table_desc,
+ acpi_gbl_root_node);
+ if (ACPI_FAILURE(status)) {
break;
}
@@ -271,19 +231,16 @@ acpi_ns_load_table_by_type (
}
break;
-
default:
status = AE_SUPPORT;
break;
}
-
-unlock_and_exit:
- (void) acpi_ut_release_mutex (ACPI_MTX_TABLES);
- return_ACPI_STATUS (status);
+ unlock_and_exit:
+ (void)acpi_ut_release_mutex(ACPI_MTX_TABLES);
+ return_ACPI_STATUS(status);
}
-
/*******************************************************************************
*
* FUNCTION: acpi_load_namespace
@@ -297,45 +254,40 @@ unlock_and_exit:
*
******************************************************************************/
-acpi_status
-acpi_ns_load_namespace (
- void)
+acpi_status acpi_ns_load_namespace(void)
{
- acpi_status status;
-
-
- ACPI_FUNCTION_TRACE ("acpi_load_name_space");
+ acpi_status status;
+ ACPI_FUNCTION_TRACE("acpi_load_name_space");
/* There must be at least a DSDT installed */
if (acpi_gbl_DSDT == NULL) {
- ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, "DSDT is not in memory\n"));
- return_ACPI_STATUS (AE_NO_ACPI_TABLES);
+ ACPI_DEBUG_PRINT((ACPI_DB_ERROR, "DSDT is not in memory\n"));
+ return_ACPI_STATUS(AE_NO_ACPI_TABLES);
}
/*
* Load the namespace. The DSDT is required,
* but the SSDT and PSDT tables are optional.
*/
- status = acpi_ns_load_table_by_type (ACPI_TABLE_DSDT);
- if (ACPI_FAILURE (status)) {
- return_ACPI_STATUS (status);
+ status = acpi_ns_load_table_by_type(ACPI_TABLE_DSDT);
+ if (ACPI_FAILURE(status)) {
+ return_ACPI_STATUS(status);
}
/* Ignore exceptions from these */
- (void) acpi_ns_load_table_by_type (ACPI_TABLE_SSDT);
- (void) acpi_ns_load_table_by_type (ACPI_TABLE_PSDT);
+ (void)acpi_ns_load_table_by_type(ACPI_TABLE_SSDT);
+ (void)acpi_ns_load_table_by_type(ACPI_TABLE_PSDT);
- ACPI_DEBUG_PRINT_RAW ((ACPI_DB_INIT,
- "ACPI Namespace successfully loaded at root %p\n",
- acpi_gbl_root_node));
+ ACPI_DEBUG_PRINT_RAW((ACPI_DB_INIT,
+ "ACPI Namespace successfully loaded at root %p\n",
+ acpi_gbl_root_node));
- return_ACPI_STATUS (status);
+ return_ACPI_STATUS(status);
}
-
#ifdef ACPI_FUTURE_IMPLEMENTATION
/*******************************************************************************
*
@@ -353,24 +305,20 @@ acpi_ns_load_namespace (
*
******************************************************************************/
-static acpi_status
-acpi_ns_delete_subtree (
- acpi_handle start_handle)
+static acpi_status acpi_ns_delete_subtree(acpi_handle start_handle)
{
- acpi_status status;
- acpi_handle child_handle;
- acpi_handle parent_handle;
- acpi_handle next_child_handle;
- acpi_handle dummy;
- u32 level;
-
-
- ACPI_FUNCTION_TRACE ("ns_delete_subtree");
+ acpi_status status;
+ acpi_handle child_handle;
+ acpi_handle parent_handle;
+ acpi_handle next_child_handle;
+ acpi_handle dummy;
+ u32 level;
+ ACPI_FUNCTION_TRACE("ns_delete_subtree");
parent_handle = start_handle;
child_handle = NULL;
- level = 1;
+ level = 1;
/*
* Traverse the tree of objects until we bubble back up
@@ -379,18 +327,19 @@ acpi_ns_delete_subtree (
while (level > 0) {
/* Attempt to get the next object in this scope */
- status = acpi_get_next_object (ACPI_TYPE_ANY, parent_handle,
- child_handle, &next_child_handle);
+ status = acpi_get_next_object(ACPI_TYPE_ANY, parent_handle,
+ child_handle, &next_child_handle);
child_handle = next_child_handle;
/* Did we get a new object? */
- if (ACPI_SUCCESS (status)) {
+ if (ACPI_SUCCESS(status)) {
/* Check if this object has any children */
- if (ACPI_SUCCESS (acpi_get_next_object (ACPI_TYPE_ANY, child_handle,
- NULL, &dummy))) {
+ if (ACPI_SUCCESS
+ (acpi_get_next_object
+ (ACPI_TYPE_ANY, child_handle, NULL, &dummy))) {
/*
* There is at least one child of this object,
* visit the object
@@ -399,8 +348,7 @@ acpi_ns_delete_subtree (
parent_handle = child_handle;
child_handle = NULL;
}
- }
- else {
+ } else {
/*
* No more children in this object, go back up to
* the object's parent
@@ -409,24 +357,23 @@ acpi_ns_delete_subtree (
/* Delete all children now */
- acpi_ns_delete_children (child_handle);
+ acpi_ns_delete_children(child_handle);
child_handle = parent_handle;
- status = acpi_get_parent (parent_handle, &parent_handle);
- if (ACPI_FAILURE (status)) {
- return_ACPI_STATUS (status);
+ status = acpi_get_parent(parent_handle, &parent_handle);
+ if (ACPI_FAILURE(status)) {
+ return_ACPI_STATUS(status);
}
}
}
/* Now delete the starting object, and we are done */
- acpi_ns_delete_node (child_handle);
+ acpi_ns_delete_node(child_handle);
- return_ACPI_STATUS (AE_OK);
+ return_ACPI_STATUS(AE_OK);
}
-
/*******************************************************************************
*
* FUNCTION: acpi_ns_unload_name_space
@@ -441,32 +388,27 @@ acpi_ns_delete_subtree (
*
******************************************************************************/
-acpi_status
-acpi_ns_unload_namespace (
- acpi_handle handle)
+acpi_status acpi_ns_unload_namespace(acpi_handle handle)
{
- acpi_status status;
-
-
- ACPI_FUNCTION_TRACE ("ns_unload_name_space");
+ acpi_status status;
+ ACPI_FUNCTION_TRACE("ns_unload_name_space");
/* Parameter validation */
if (!acpi_gbl_root_node) {
- return_ACPI_STATUS (AE_NO_NAMESPACE);
+ return_ACPI_STATUS(AE_NO_NAMESPACE);
}
if (!handle) {
- return_ACPI_STATUS (AE_BAD_PARAMETER);
+ return_ACPI_STATUS(AE_BAD_PARAMETER);
}
/* This function does the real work */
- status = acpi_ns_delete_subtree (handle);
+ status = acpi_ns_delete_subtree(handle);
- return_ACPI_STATUS (status);
+ return_ACPI_STATUS(status);
}
#endif
#endif
-
diff --git a/drivers/acpi/namespace/nsnames.c b/drivers/acpi/namespace/nsnames.c
index d8ce7e39795f..d5e8dea61c27 100644
--- a/drivers/acpi/namespace/nsnames.c
+++ b/drivers/acpi/namespace/nsnames.c
@@ -41,23 +41,17 @@
* POSSIBILITY OF SUCH DAMAGES.
*/
-
#include <acpi/acpi.h>
#include <acpi/amlcode.h>
#include <acpi/acnamesp.h>
-
#define _COMPONENT ACPI_NAMESPACE
- ACPI_MODULE_NAME ("nsnames")
+ACPI_MODULE_NAME("nsnames")
/* Local prototypes */
-
static void
-acpi_ns_build_external_path (
- struct acpi_namespace_node *node,
- acpi_size size,
- char *name_buffer);
-
+acpi_ns_build_external_path(struct acpi_namespace_node *node,
+ acpi_size size, char *name_buffer);
/*******************************************************************************
*
@@ -75,17 +69,13 @@ acpi_ns_build_external_path (
******************************************************************************/
static void
-acpi_ns_build_external_path (
- struct acpi_namespace_node *node,
- acpi_size size,
- char *name_buffer)
+acpi_ns_build_external_path(struct acpi_namespace_node *node,
+ acpi_size size, char *name_buffer)
{
- acpi_size index;
- struct acpi_namespace_node *parent_node;
-
-
- ACPI_FUNCTION_NAME ("ns_build_external_path");
+ acpi_size index;
+ struct acpi_namespace_node *parent_node;
+ ACPI_FUNCTION_NAME("ns_build_external_path");
/* Special case for root */
@@ -106,8 +96,8 @@ acpi_ns_build_external_path (
/* Put the name into the buffer */
- ACPI_MOVE_32_TO_32 ((name_buffer + index), &parent_node->name);
- parent_node = acpi_ns_get_parent_node (parent_node);
+ ACPI_MOVE_32_TO_32((name_buffer + index), &parent_node->name);
+ parent_node = acpi_ns_get_parent_node(parent_node);
/* Prefix name with the path separator */
@@ -120,15 +110,14 @@ acpi_ns_build_external_path (
name_buffer[index] = AML_ROOT_PREFIX;
if (index != 0) {
- ACPI_DEBUG_PRINT ((ACPI_DB_ERROR,
- "Could not construct pathname; index=%X, size=%X, Path=%s\n",
- (u32) index, (u32) size, &name_buffer[size]));
+ ACPI_DEBUG_PRINT((ACPI_DB_ERROR,
+ "Could not construct pathname; index=%X, size=%X, Path=%s\n",
+ (u32) index, (u32) size, &name_buffer[size]));
}
return;
}
-
#ifdef ACPI_DEBUG_OUTPUT
/*******************************************************************************
*
@@ -144,37 +133,32 @@ acpi_ns_build_external_path (
*
******************************************************************************/
-char *
-acpi_ns_get_external_pathname (
- struct acpi_namespace_node *node)
+char *acpi_ns_get_external_pathname(struct acpi_namespace_node *node)
{
- char *name_buffer;
- acpi_size size;
-
-
- ACPI_FUNCTION_TRACE_PTR ("ns_get_external_pathname", node);
+ char *name_buffer;
+ acpi_size size;
+ ACPI_FUNCTION_TRACE_PTR("ns_get_external_pathname", node);
/* Calculate required buffer size based on depth below root */
- size = acpi_ns_get_pathname_length (node);
+ size = acpi_ns_get_pathname_length(node);
/* Allocate a buffer to be returned to caller */
- name_buffer = ACPI_MEM_CALLOCATE (size);
+ name_buffer = ACPI_MEM_CALLOCATE(size);
if (!name_buffer) {
- ACPI_REPORT_ERROR (("ns_get_table_pathname: allocation failure\n"));
- return_PTR (NULL);
+ ACPI_REPORT_ERROR(("ns_get_table_pathname: allocation failure\n"));
+ return_PTR(NULL);
}
/* Build the path in the allocated buffer */
- acpi_ns_build_external_path (node, size, name_buffer);
- return_PTR (name_buffer);
+ acpi_ns_build_external_path(node, size, name_buffer);
+ return_PTR(name_buffer);
}
#endif
-
/*******************************************************************************
*
* FUNCTION: acpi_ns_get_pathname_length
@@ -187,16 +171,12 @@ acpi_ns_get_external_pathname (
*
******************************************************************************/
-acpi_size
-acpi_ns_get_pathname_length (
- struct acpi_namespace_node *node)
+acpi_size acpi_ns_get_pathname_length(struct acpi_namespace_node *node)
{
- acpi_size size;
- struct acpi_namespace_node *next_node;
-
-
- ACPI_FUNCTION_ENTRY ();
+ acpi_size size;
+ struct acpi_namespace_node *next_node;
+ ACPI_FUNCTION_ENTRY();
/*
* Compute length of pathname as 5 * number of name segments.
@@ -207,17 +187,16 @@ acpi_ns_get_pathname_length (
while (next_node && (next_node != acpi_gbl_root_node)) {
size += ACPI_PATH_SEGMENT_LENGTH;
- next_node = acpi_ns_get_parent_node (next_node);
+ next_node = acpi_ns_get_parent_node(next_node);
}
if (!size) {
- size = 1; /* Root node case */
+ size = 1; /* Root node case */
}
- return (size + 1); /* +1 for null string terminator */
+ return (size + 1); /* +1 for null string terminator */
}
-
/*******************************************************************************
*
* FUNCTION: acpi_ns_handle_to_pathname
@@ -233,41 +212,36 @@ acpi_ns_get_pathname_length (
******************************************************************************/
acpi_status
-acpi_ns_handle_to_pathname (
- acpi_handle target_handle,
- struct acpi_buffer *buffer)
+acpi_ns_handle_to_pathname(acpi_handle target_handle,
+ struct acpi_buffer * buffer)
{
- acpi_status status;
- struct acpi_namespace_node *node;
- acpi_size required_size;
+ acpi_status status;
+ struct acpi_namespace_node *node;
+ acpi_size required_size;
+ ACPI_FUNCTION_TRACE_PTR("ns_handle_to_pathname", target_handle);
- ACPI_FUNCTION_TRACE_PTR ("ns_handle_to_pathname", target_handle);
-
-
- node = acpi_ns_map_handle_to_node (target_handle);
+ node = acpi_ns_map_handle_to_node(target_handle);
if (!node) {
- return_ACPI_STATUS (AE_BAD_PARAMETER);
+ return_ACPI_STATUS(AE_BAD_PARAMETER);
}
/* Determine size required for the caller buffer */
- required_size = acpi_ns_get_pathname_length (node);
+ required_size = acpi_ns_get_pathname_length(node);
/* Validate/Allocate/Clear caller buffer */
- status = acpi_ut_initialize_buffer (buffer, required_size);
- if (ACPI_FAILURE (status)) {
- return_ACPI_STATUS (status);
+ status = acpi_ut_initialize_buffer(buffer, required_size);
+ if (ACPI_FAILURE(status)) {
+ return_ACPI_STATUS(status);
}
/* Build the path in the caller buffer */
- acpi_ns_build_external_path (node, required_size, buffer->pointer);
+ acpi_ns_build_external_path(node, required_size, buffer->pointer);
- ACPI_DEBUG_PRINT ((ACPI_DB_EXEC, "%s [%X] \n",
- (char *) buffer->pointer, (u32) required_size));
- return_ACPI_STATUS (AE_OK);
+ ACPI_DEBUG_PRINT((ACPI_DB_EXEC, "%s [%X] \n",
+ (char *)buffer->pointer, (u32) required_size));
+ return_ACPI_STATUS(AE_OK);
}
-
-
diff --git a/drivers/acpi/namespace/nsobject.c b/drivers/acpi/namespace/nsobject.c
index 27258c1ca4f1..fc9be946ebed 100644
--- a/drivers/acpi/namespace/nsobject.c
+++ b/drivers/acpi/namespace/nsobject.c
@@ -42,14 +42,11 @@
* POSSIBILITY OF SUCH DAMAGES.
*/
-
#include <acpi/acpi.h>
#include <acpi/acnamesp.h>
-
#define _COMPONENT ACPI_NAMESPACE
- ACPI_MODULE_NAME ("nsobject")
-
+ACPI_MODULE_NAME("nsobject")
/*******************************************************************************
*
@@ -71,20 +68,15 @@
* MUTEX: Assumes namespace is locked
*
******************************************************************************/
-
acpi_status
-acpi_ns_attach_object (
- struct acpi_namespace_node *node,
- union acpi_operand_object *object,
- acpi_object_type type)
+acpi_ns_attach_object(struct acpi_namespace_node *node,
+ union acpi_operand_object *object, acpi_object_type type)
{
- union acpi_operand_object *obj_desc;
- union acpi_operand_object *last_obj_desc;
- acpi_object_type object_type = ACPI_TYPE_ANY;
-
-
- ACPI_FUNCTION_TRACE ("ns_attach_object");
+ union acpi_operand_object *obj_desc;
+ union acpi_operand_object *last_obj_desc;
+ acpi_object_type object_type = ACPI_TYPE_ANY;
+ ACPI_FUNCTION_TRACE("ns_attach_object");
/*
* Parameter validation
@@ -92,40 +84,39 @@ acpi_ns_attach_object (
if (!node) {
/* Invalid handle */
- ACPI_REPORT_ERROR (("ns_attach_object: Null named_obj handle\n"));
- return_ACPI_STATUS (AE_BAD_PARAMETER);
+ ACPI_REPORT_ERROR(("ns_attach_object: Null named_obj handle\n"));
+ return_ACPI_STATUS(AE_BAD_PARAMETER);
}
if (!object && (ACPI_TYPE_ANY != type)) {
/* Null object */
- ACPI_REPORT_ERROR ((
- "ns_attach_object: Null object, but type not ACPI_TYPE_ANY\n"));
- return_ACPI_STATUS (AE_BAD_PARAMETER);
+ ACPI_REPORT_ERROR(("ns_attach_object: Null object, but type not ACPI_TYPE_ANY\n"));
+ return_ACPI_STATUS(AE_BAD_PARAMETER);
}
- if (ACPI_GET_DESCRIPTOR_TYPE (node) != ACPI_DESC_TYPE_NAMED) {
+ if (ACPI_GET_DESCRIPTOR_TYPE(node) != ACPI_DESC_TYPE_NAMED) {
/* Not a name handle */
- ACPI_REPORT_ERROR (("ns_attach_object: Invalid handle %p [%s]\n",
- node, acpi_ut_get_descriptor_name (node)));
- return_ACPI_STATUS (AE_BAD_PARAMETER);
+ ACPI_REPORT_ERROR(("ns_attach_object: Invalid handle %p [%s]\n",
+ node, acpi_ut_get_descriptor_name(node)));
+ return_ACPI_STATUS(AE_BAD_PARAMETER);
}
/* Check if this object is already attached */
if (node->object == object) {
- ACPI_DEBUG_PRINT ((ACPI_DB_EXEC,
- "Obj %p already installed in name_obj %p\n",
- object, node));
+ ACPI_DEBUG_PRINT((ACPI_DB_EXEC,
+ "Obj %p already installed in name_obj %p\n",
+ object, node));
- return_ACPI_STATUS (AE_OK);
+ return_ACPI_STATUS(AE_OK);
}
/* If null object, we will just install it */
if (!object) {
- obj_desc = NULL;
+ obj_desc = NULL;
object_type = ACPI_TYPE_ANY;
}
@@ -133,14 +124,14 @@ acpi_ns_attach_object (
* If the source object is a namespace Node with an attached object,
* we will use that (attached) object
*/
- else if ((ACPI_GET_DESCRIPTOR_TYPE (object) == ACPI_DESC_TYPE_NAMED) &&
- ((struct acpi_namespace_node *) object)->object) {
+ else if ((ACPI_GET_DESCRIPTOR_TYPE(object) == ACPI_DESC_TYPE_NAMED) &&
+ ((struct acpi_namespace_node *)object)->object) {
/*
* Value passed is a name handle and that name has a
* non-null value. Use that name's value and type.
*/
- obj_desc = ((struct acpi_namespace_node *) object)->object;
- object_type = ((struct acpi_namespace_node *) object)->type;
+ obj_desc = ((struct acpi_namespace_node *)object)->object;
+ object_type = ((struct acpi_namespace_node *)object)->type;
}
/*
@@ -148,20 +139,20 @@ acpi_ns_attach_object (
* it first
*/
else {
- obj_desc = (union acpi_operand_object *) object;
+ obj_desc = (union acpi_operand_object *)object;
/* Use the given type */
object_type = type;
}
- ACPI_DEBUG_PRINT ((ACPI_DB_EXEC, "Installing %p into Node %p [%4.4s]\n",
- obj_desc, node, acpi_ut_get_node_name (node)));
+ ACPI_DEBUG_PRINT((ACPI_DB_EXEC, "Installing %p into Node %p [%4.4s]\n",
+ obj_desc, node, acpi_ut_get_node_name(node)));
/* Detach an existing attached object if present */
if (node->object) {
- acpi_ns_detach_object (node);
+ acpi_ns_detach_object(node);
}
if (obj_desc) {
@@ -169,7 +160,7 @@ acpi_ns_attach_object (
* Must increment the new value's reference count
* (if it is an internal object)
*/
- acpi_ut_add_reference (obj_desc);
+ acpi_ut_add_reference(obj_desc);
/*
* Handle objects with multiple descriptors - walk
@@ -185,13 +176,12 @@ acpi_ns_attach_object (
last_obj_desc->common.next_object = node->object;
}
- node->type = (u8) object_type;
- node->object = obj_desc;
+ node->type = (u8) object_type;
+ node->object = obj_desc;
- return_ACPI_STATUS (AE_OK);
+ return_ACPI_STATUS(AE_OK);
}
-
/*******************************************************************************
*
* FUNCTION: acpi_ns_detach_object
@@ -206,30 +196,27 @@ acpi_ns_attach_object (
*
******************************************************************************/
-void
-acpi_ns_detach_object (
- struct acpi_namespace_node *node)
+void acpi_ns_detach_object(struct acpi_namespace_node *node)
{
- union acpi_operand_object *obj_desc;
-
-
- ACPI_FUNCTION_TRACE ("ns_detach_object");
+ union acpi_operand_object *obj_desc;
+ ACPI_FUNCTION_TRACE("ns_detach_object");
obj_desc = node->object;
if (!obj_desc ||
- (ACPI_GET_OBJECT_TYPE (obj_desc) == ACPI_TYPE_LOCAL_DATA)) {
+ (ACPI_GET_OBJECT_TYPE(obj_desc) == ACPI_TYPE_LOCAL_DATA)) {
return_VOID;
}
/* Clear the entry in all cases */
node->object = NULL;
- if (ACPI_GET_DESCRIPTOR_TYPE (obj_desc) == ACPI_DESC_TYPE_OPERAND) {
+ if (ACPI_GET_DESCRIPTOR_TYPE(obj_desc) == ACPI_DESC_TYPE_OPERAND) {
node->object = obj_desc->common.next_object;
if (node->object &&
- (ACPI_GET_OBJECT_TYPE (node->object) != ACPI_TYPE_LOCAL_DATA)) {
+ (ACPI_GET_OBJECT_TYPE(node->object) !=
+ ACPI_TYPE_LOCAL_DATA)) {
node->object = node->object->common.next_object;
}
}
@@ -238,16 +225,15 @@ acpi_ns_detach_object (
node->type = ACPI_TYPE_ANY;
- ACPI_DEBUG_PRINT ((ACPI_DB_NAMES, "Node %p [%4.4s] Object %p\n",
- node, acpi_ut_get_node_name (node), obj_desc));
+ ACPI_DEBUG_PRINT((ACPI_DB_NAMES, "Node %p [%4.4s] Object %p\n",
+ node, acpi_ut_get_node_name(node), obj_desc));
/* Remove one reference on the object (and all subobjects) */
- acpi_ut_remove_reference (obj_desc);
+ acpi_ut_remove_reference(obj_desc);
return_VOID;
}
-
/*******************************************************************************
*
* FUNCTION: acpi_ns_get_attached_object
@@ -261,29 +247,28 @@ acpi_ns_detach_object (
*
******************************************************************************/
-union acpi_operand_object *
-acpi_ns_get_attached_object (
- struct acpi_namespace_node *node)
+union acpi_operand_object *acpi_ns_get_attached_object(struct
+ acpi_namespace_node
+ *node)
{
- ACPI_FUNCTION_TRACE_PTR ("ns_get_attached_object", node);
-
+ ACPI_FUNCTION_TRACE_PTR("ns_get_attached_object", node);
if (!node) {
- ACPI_DEBUG_PRINT ((ACPI_DB_WARN, "Null Node ptr\n"));
- return_PTR (NULL);
+ ACPI_DEBUG_PRINT((ACPI_DB_WARN, "Null Node ptr\n"));
+ return_PTR(NULL);
}
if (!node->object ||
- ((ACPI_GET_DESCRIPTOR_TYPE (node->object) != ACPI_DESC_TYPE_OPERAND) &&
- (ACPI_GET_DESCRIPTOR_TYPE (node->object) != ACPI_DESC_TYPE_NAMED)) ||
- (ACPI_GET_OBJECT_TYPE (node->object) == ACPI_TYPE_LOCAL_DATA)) {
- return_PTR (NULL);
+ ((ACPI_GET_DESCRIPTOR_TYPE(node->object) != ACPI_DESC_TYPE_OPERAND)
+ && (ACPI_GET_DESCRIPTOR_TYPE(node->object) !=
+ ACPI_DESC_TYPE_NAMED))
+ || (ACPI_GET_OBJECT_TYPE(node->object) == ACPI_TYPE_LOCAL_DATA)) {
+ return_PTR(NULL);
}
- return_PTR (node->object);
+ return_PTR(node->object);
}
-
/*******************************************************************************
*
* FUNCTION: acpi_ns_get_secondary_object
@@ -297,24 +282,23 @@ acpi_ns_get_attached_object (
*
******************************************************************************/
-union acpi_operand_object *
-acpi_ns_get_secondary_object (
- union acpi_operand_object *obj_desc)
+union acpi_operand_object *acpi_ns_get_secondary_object(union
+ acpi_operand_object
+ *obj_desc)
{
- ACPI_FUNCTION_TRACE_PTR ("ns_get_secondary_object", obj_desc);
-
-
- if ((!obj_desc) ||
- (ACPI_GET_OBJECT_TYPE (obj_desc) == ACPI_TYPE_LOCAL_DATA) ||
- (!obj_desc->common.next_object) ||
- (ACPI_GET_OBJECT_TYPE (obj_desc->common.next_object) == ACPI_TYPE_LOCAL_DATA)) {
- return_PTR (NULL);
+ ACPI_FUNCTION_TRACE_PTR("ns_get_secondary_object", obj_desc);
+
+ if ((!obj_desc) ||
+ (ACPI_GET_OBJECT_TYPE(obj_desc) == ACPI_TYPE_LOCAL_DATA) ||
+ (!obj_desc->common.next_object) ||
+ (ACPI_GET_OBJECT_TYPE(obj_desc->common.next_object) ==
+ ACPI_TYPE_LOCAL_DATA)) {
+ return_PTR(NULL);
}
- return_PTR (obj_desc->common.next_object);
+ return_PTR(obj_desc->common.next_object);
}
-
/*******************************************************************************
*
* FUNCTION: acpi_ns_attach_data
@@ -330,23 +314,20 @@ acpi_ns_get_secondary_object (
******************************************************************************/
acpi_status
-acpi_ns_attach_data (
- struct acpi_namespace_node *node,
- acpi_object_handler handler,
- void *data)
+acpi_ns_attach_data(struct acpi_namespace_node *node,
+ acpi_object_handler handler, void *data)
{
- union acpi_operand_object *prev_obj_desc;
- union acpi_operand_object *obj_desc;
- union acpi_operand_object *data_desc;
-
+ union acpi_operand_object *prev_obj_desc;
+ union acpi_operand_object *obj_desc;
+ union acpi_operand_object *data_desc;
/* We only allow one attachment per handler */
prev_obj_desc = NULL;
obj_desc = node->object;
while (obj_desc) {
- if ((ACPI_GET_OBJECT_TYPE (obj_desc) == ACPI_TYPE_LOCAL_DATA) &&
- (obj_desc->data.handler == handler)) {
+ if ((ACPI_GET_OBJECT_TYPE(obj_desc) == ACPI_TYPE_LOCAL_DATA) &&
+ (obj_desc->data.handler == handler)) {
return (AE_ALREADY_EXISTS);
}
@@ -356,7 +337,7 @@ acpi_ns_attach_data (
/* Create an internal object for the data */
- data_desc = acpi_ut_create_internal_object (ACPI_TYPE_LOCAL_DATA);
+ data_desc = acpi_ut_create_internal_object(ACPI_TYPE_LOCAL_DATA);
if (!data_desc) {
return (AE_NO_MEMORY);
}
@@ -368,15 +349,13 @@ acpi_ns_attach_data (
if (prev_obj_desc) {
prev_obj_desc->common.next_object = data_desc;
- }
- else {
+ } else {
node->object = data_desc;
}
return (AE_OK);
}
-
/*******************************************************************************
*
* FUNCTION: acpi_ns_detach_data
@@ -392,27 +371,25 @@ acpi_ns_attach_data (
******************************************************************************/
acpi_status
-acpi_ns_detach_data (
- struct acpi_namespace_node *node,
- acpi_object_handler handler)
+acpi_ns_detach_data(struct acpi_namespace_node * node,
+ acpi_object_handler handler)
{
- union acpi_operand_object *obj_desc;
- union acpi_operand_object *prev_obj_desc;
-
+ union acpi_operand_object *obj_desc;
+ union acpi_operand_object *prev_obj_desc;
prev_obj_desc = NULL;
obj_desc = node->object;
while (obj_desc) {
- if ((ACPI_GET_OBJECT_TYPE (obj_desc) == ACPI_TYPE_LOCAL_DATA) &&
- (obj_desc->data.handler == handler)) {
+ if ((ACPI_GET_OBJECT_TYPE(obj_desc) == ACPI_TYPE_LOCAL_DATA) &&
+ (obj_desc->data.handler == handler)) {
if (prev_obj_desc) {
- prev_obj_desc->common.next_object = obj_desc->common.next_object;
- }
- else {
+ prev_obj_desc->common.next_object =
+ obj_desc->common.next_object;
+ } else {
node->object = obj_desc->common.next_object;
}
- acpi_ut_remove_reference (obj_desc);
+ acpi_ut_remove_reference(obj_desc);
return (AE_OK);
}
@@ -423,7 +400,6 @@ acpi_ns_detach_data (
return (AE_NOT_FOUND);
}
-
/*******************************************************************************
*
* FUNCTION: acpi_ns_get_attached_data
@@ -440,18 +416,15 @@ acpi_ns_detach_data (
******************************************************************************/
acpi_status
-acpi_ns_get_attached_data (
- struct acpi_namespace_node *node,
- acpi_object_handler handler,
- void **data)
+acpi_ns_get_attached_data(struct acpi_namespace_node * node,
+ acpi_object_handler handler, void **data)
{
- union acpi_operand_object *obj_desc;
-
+ union acpi_operand_object *obj_desc;
obj_desc = node->object;
while (obj_desc) {
- if ((ACPI_GET_OBJECT_TYPE (obj_desc) == ACPI_TYPE_LOCAL_DATA) &&
- (obj_desc->data.handler == handler)) {
+ if ((ACPI_GET_OBJECT_TYPE(obj_desc) == ACPI_TYPE_LOCAL_DATA) &&
+ (obj_desc->data.handler == handler)) {
*data = obj_desc->data.pointer;
return (AE_OK);
}
@@ -461,5 +434,3 @@ acpi_ns_get_attached_data (
return (AE_NOT_FOUND);
}
-
-
diff --git a/drivers/acpi/namespace/nsparse.c b/drivers/acpi/namespace/nsparse.c
index a0e13e8d3764..433442a9ec74 100644
--- a/drivers/acpi/namespace/nsparse.c
+++ b/drivers/acpi/namespace/nsparse.c
@@ -41,16 +41,13 @@
* POSSIBILITY OF SUCH DAMAGES.
*/
-
#include <acpi/acpi.h>
#include <acpi/acnamesp.h>
#include <acpi/acparser.h>
#include <acpi/acdispat.h>
-
#define _COMPONENT ACPI_NAMESPACE
- ACPI_MODULE_NAME ("nsparse")
-
+ACPI_MODULE_NAME("nsparse")
/*******************************************************************************
*
@@ -64,54 +61,50 @@
* DESCRIPTION: Perform one complete parse of an ACPI/AML table.
*
******************************************************************************/
-
acpi_status
-acpi_ns_one_complete_parse (
- u32 pass_number,
- struct acpi_table_desc *table_desc)
+acpi_ns_one_complete_parse(u8 pass_number, struct acpi_table_desc * table_desc)
{
- union acpi_parse_object *parse_root;
- acpi_status status;
- struct acpi_walk_state *walk_state;
-
-
- ACPI_FUNCTION_TRACE ("ns_one_complete_parse");
+ union acpi_parse_object *parse_root;
+ acpi_status status;
+ struct acpi_walk_state *walk_state;
+ ACPI_FUNCTION_TRACE("ns_one_complete_parse");
/* Create and init a Root Node */
- parse_root = acpi_ps_create_scope_op ();
+ parse_root = acpi_ps_create_scope_op();
if (!parse_root) {
- return_ACPI_STATUS (AE_NO_MEMORY);
+ return_ACPI_STATUS(AE_NO_MEMORY);
}
/* Create and initialize a new walk state */
- walk_state = acpi_ds_create_walk_state (table_desc->table_id,
- NULL, NULL, NULL);
+ walk_state = acpi_ds_create_walk_state(table_desc->owner_id,
+ NULL, NULL, NULL);
if (!walk_state) {
- acpi_ps_free_op (parse_root);
- return_ACPI_STATUS (AE_NO_MEMORY);
+ acpi_ps_free_op(parse_root);
+ return_ACPI_STATUS(AE_NO_MEMORY);
}
- status = acpi_ds_init_aml_walk (walk_state, parse_root, NULL,
- table_desc->aml_start, table_desc->aml_length,
- NULL, pass_number);
- if (ACPI_FAILURE (status)) {
- acpi_ds_delete_walk_state (walk_state);
- return_ACPI_STATUS (status);
+ status = acpi_ds_init_aml_walk(walk_state, parse_root, NULL,
+ table_desc->aml_start,
+ table_desc->aml_length, NULL,
+ pass_number);
+ if (ACPI_FAILURE(status)) {
+ acpi_ds_delete_walk_state(walk_state);
+ return_ACPI_STATUS(status);
}
/* Parse the AML */
- ACPI_DEBUG_PRINT ((ACPI_DB_PARSE, "*PARSE* pass %d parse\n", pass_number));
- status = acpi_ps_parse_aml (walk_state);
+ ACPI_DEBUG_PRINT((ACPI_DB_PARSE, "*PARSE* pass %d parse\n",
+ pass_number));
+ status = acpi_ps_parse_aml(walk_state);
- acpi_ps_delete_parse_tree (parse_root);
- return_ACPI_STATUS (status);
+ acpi_ps_delete_parse_tree(parse_root);
+ return_ACPI_STATUS(status);
}
-
/*******************************************************************************
*
* FUNCTION: acpi_ns_parse_table
@@ -126,15 +119,12 @@ acpi_ns_one_complete_parse (
******************************************************************************/
acpi_status
-acpi_ns_parse_table (
- struct acpi_table_desc *table_desc,
- struct acpi_namespace_node *start_node)
+acpi_ns_parse_table(struct acpi_table_desc *table_desc,
+ struct acpi_namespace_node *start_node)
{
- acpi_status status;
-
-
- ACPI_FUNCTION_TRACE ("ns_parse_table");
+ acpi_status status;
+ ACPI_FUNCTION_TRACE("ns_parse_table");
/*
* AML Parse, pass 1
@@ -146,9 +136,10 @@ acpi_ns_parse_table (
* to service the entire parse. The second pass of the parse then
* performs another complete parse of the AML..
*/
- status = acpi_ns_one_complete_parse (1, table_desc);
- if (ACPI_FAILURE (status)) {
- return_ACPI_STATUS (status);
+ ACPI_DEBUG_PRINT((ACPI_DB_PARSE, "**** Start pass 1\n"));
+ status = acpi_ns_one_complete_parse(1, table_desc);
+ if (ACPI_FAILURE(status)) {
+ return_ACPI_STATUS(status);
}
/*
@@ -160,12 +151,11 @@ acpi_ns_parse_table (
* overhead of this is compensated for by the fact that the
* parse objects are all cached.
*/
- status = acpi_ns_one_complete_parse (2, table_desc);
- if (ACPI_FAILURE (status)) {
- return_ACPI_STATUS (status);
+ ACPI_DEBUG_PRINT((ACPI_DB_PARSE, "**** Start pass 2\n"));
+ status = acpi_ns_one_complete_parse(2, table_desc);
+ if (ACPI_FAILURE(status)) {
+ return_ACPI_STATUS(status);
}
- return_ACPI_STATUS (status);
+ return_ACPI_STATUS(status);
}
-
-
diff --git a/drivers/acpi/namespace/nssearch.c b/drivers/acpi/namespace/nssearch.c
index af8aaa9cc4f3..50a3ca5470ed 100644
--- a/drivers/acpi/namespace/nssearch.c
+++ b/drivers/acpi/namespace/nssearch.c
@@ -41,23 +41,18 @@
* POSSIBILITY OF SUCH DAMAGES.
*/
-
#include <acpi/acpi.h>
#include <acpi/acnamesp.h>
-
#define _COMPONENT ACPI_NAMESPACE
- ACPI_MODULE_NAME ("nssearch")
+ACPI_MODULE_NAME("nssearch")
/* Local prototypes */
-
static acpi_status
-acpi_ns_search_parent_tree (
- u32 target_name,
- struct acpi_namespace_node *node,
- acpi_object_type type,
- struct acpi_namespace_node **return_node);
-
+acpi_ns_search_parent_tree(u32 target_name,
+ struct acpi_namespace_node *node,
+ acpi_object_type type,
+ struct acpi_namespace_node **return_node);
/*******************************************************************************
*
@@ -87,30 +82,28 @@ acpi_ns_search_parent_tree (
******************************************************************************/
acpi_status
-acpi_ns_search_node (
- u32 target_name,
- struct acpi_namespace_node *node,
- acpi_object_type type,
- struct acpi_namespace_node **return_node)
+acpi_ns_search_node(u32 target_name,
+ struct acpi_namespace_node *node,
+ acpi_object_type type,
+ struct acpi_namespace_node **return_node)
{
- struct acpi_namespace_node *next_node;
-
-
- ACPI_FUNCTION_TRACE ("ns_search_node");
+ struct acpi_namespace_node *next_node;
+ ACPI_FUNCTION_TRACE("ns_search_node");
#ifdef ACPI_DEBUG_OUTPUT
if (ACPI_LV_NAMES & acpi_dbg_level) {
- char *scope_name;
+ char *scope_name;
- scope_name = acpi_ns_get_external_pathname (node);
+ scope_name = acpi_ns_get_external_pathname(node);
if (scope_name) {
- ACPI_DEBUG_PRINT ((ACPI_DB_NAMES,
- "Searching %s (%p) For [%4.4s] (%s)\n",
- scope_name, node, (char *) &target_name,
- acpi_ut_get_type_name (type)));
+ ACPI_DEBUG_PRINT((ACPI_DB_NAMES,
+ "Searching %s (%p) For [%4.4s] (%s)\n",
+ scope_name, node,
+ (char *)&target_name,
+ acpi_ut_get_type_name(type)));
- ACPI_MEM_FREE (scope_name);
+ ACPI_MEM_FREE(scope_name);
}
}
#endif
@@ -126,20 +119,26 @@ acpi_ns_search_node (
if (next_node->name.integer == target_name) {
/* Resolve a control method alias if any */
- if (acpi_ns_get_type (next_node) == ACPI_TYPE_LOCAL_METHOD_ALIAS) {
- next_node = ACPI_CAST_PTR (struct acpi_namespace_node, next_node->object);
+ if (acpi_ns_get_type(next_node) ==
+ ACPI_TYPE_LOCAL_METHOD_ALIAS) {
+ next_node =
+ ACPI_CAST_PTR(struct acpi_namespace_node,
+ next_node->object);
}
/*
* Found matching entry.
*/
- ACPI_DEBUG_PRINT ((ACPI_DB_NAMES,
- "Name [%4.4s] (%s) %p found in scope [%4.4s] %p\n",
- (char *) &target_name, acpi_ut_get_type_name (next_node->type),
- next_node, acpi_ut_get_node_name (node), node));
+ ACPI_DEBUG_PRINT((ACPI_DB_NAMES,
+ "Name [%4.4s] (%s) %p found in scope [%4.4s] %p\n",
+ (char *)&target_name,
+ acpi_ut_get_type_name(next_node->
+ type),
+ next_node,
+ acpi_ut_get_node_name(node), node));
*return_node = next_node;
- return_ACPI_STATUS (AE_OK);
+ return_ACPI_STATUS(AE_OK);
}
/*
@@ -159,15 +158,14 @@ acpi_ns_search_node (
/* Searched entire namespace level, not found */
- ACPI_DEBUG_PRINT ((ACPI_DB_NAMES,
- "Name [%4.4s] (%s) not found in search in scope [%4.4s] %p first child %p\n",
- (char *) &target_name, acpi_ut_get_type_name (type),
- acpi_ut_get_node_name (node), node, node->child));
+ ACPI_DEBUG_PRINT((ACPI_DB_NAMES,
+ "Name [%4.4s] (%s) not found in search in scope [%4.4s] %p first child %p\n",
+ (char *)&target_name, acpi_ut_get_type_name(type),
+ acpi_ut_get_node_name(node), node, node->child));
- return_ACPI_STATUS (AE_NOT_FOUND);
+ return_ACPI_STATUS(AE_NOT_FOUND);
}
-
/*******************************************************************************
*
* FUNCTION: acpi_ns_search_parent_tree
@@ -194,43 +192,42 @@ acpi_ns_search_node (
******************************************************************************/
static acpi_status
-acpi_ns_search_parent_tree (
- u32 target_name,
- struct acpi_namespace_node *node,
- acpi_object_type type,
- struct acpi_namespace_node **return_node)
+acpi_ns_search_parent_tree(u32 target_name,
+ struct acpi_namespace_node *node,
+ acpi_object_type type,
+ struct acpi_namespace_node **return_node)
{
- acpi_status status;
- struct acpi_namespace_node *parent_node;
+ acpi_status status;
+ struct acpi_namespace_node *parent_node;
+ ACPI_FUNCTION_TRACE("ns_search_parent_tree");
- ACPI_FUNCTION_TRACE ("ns_search_parent_tree");
-
-
- parent_node = acpi_ns_get_parent_node (node);
+ parent_node = acpi_ns_get_parent_node(node);
/*
* If there is no parent (i.e., we are at the root) or type is "local",
* we won't be searching the parent tree.
*/
if (!parent_node) {
- ACPI_DEBUG_PRINT ((ACPI_DB_NAMES, "[%4.4s] has no parent\n",
- (char *) &target_name));
- return_ACPI_STATUS (AE_NOT_FOUND);
+ ACPI_DEBUG_PRINT((ACPI_DB_NAMES, "[%4.4s] has no parent\n",
+ (char *)&target_name));
+ return_ACPI_STATUS(AE_NOT_FOUND);
}
- if (acpi_ns_local (type)) {
- ACPI_DEBUG_PRINT ((ACPI_DB_NAMES,
- "[%4.4s] type [%s] must be local to this scope (no parent search)\n",
- (char *) &target_name, acpi_ut_get_type_name (type)));
- return_ACPI_STATUS (AE_NOT_FOUND);
+ if (acpi_ns_local(type)) {
+ ACPI_DEBUG_PRINT((ACPI_DB_NAMES,
+ "[%4.4s] type [%s] must be local to this scope (no parent search)\n",
+ (char *)&target_name,
+ acpi_ut_get_type_name(type)));
+ return_ACPI_STATUS(AE_NOT_FOUND);
}
/* Search the parent tree */
- ACPI_DEBUG_PRINT ((ACPI_DB_NAMES,
- "Searching parent [%4.4s] for [%4.4s]\n",
- acpi_ut_get_node_name (parent_node), (char *) &target_name));
+ ACPI_DEBUG_PRINT((ACPI_DB_NAMES,
+ "Searching parent [%4.4s] for [%4.4s]\n",
+ acpi_ut_get_node_name(parent_node),
+ (char *)&target_name));
/*
* Search parents until target is found or we have backed up to the root
@@ -241,25 +238,24 @@ acpi_ns_search_parent_tree (
* object type at this point, we only care about the existence of
* the actual name we are searching for. Typechecking comes later.
*/
- status = acpi_ns_search_node (target_name, parent_node,
- ACPI_TYPE_ANY, return_node);
- if (ACPI_SUCCESS (status)) {
- return_ACPI_STATUS (status);
+ status = acpi_ns_search_node(target_name, parent_node,
+ ACPI_TYPE_ANY, return_node);
+ if (ACPI_SUCCESS(status)) {
+ return_ACPI_STATUS(status);
}
/*
* Not found here, go up another level
* (until we reach the root)
*/
- parent_node = acpi_ns_get_parent_node (parent_node);
+ parent_node = acpi_ns_get_parent_node(parent_node);
}
/* Not found in parent tree */
- return_ACPI_STATUS (AE_NOT_FOUND);
+ return_ACPI_STATUS(AE_NOT_FOUND);
}
-
/*******************************************************************************
*
* FUNCTION: acpi_ns_search_and_enter
@@ -286,52 +282,46 @@ acpi_ns_search_parent_tree (
******************************************************************************/
acpi_status
-acpi_ns_search_and_enter (
- u32 target_name,
- struct acpi_walk_state *walk_state,
- struct acpi_namespace_node *node,
- acpi_interpreter_mode interpreter_mode,
- acpi_object_type type,
- u32 flags,
- struct acpi_namespace_node **return_node)
+acpi_ns_search_and_enter(u32 target_name,
+ struct acpi_walk_state *walk_state,
+ struct acpi_namespace_node *node,
+ acpi_interpreter_mode interpreter_mode,
+ acpi_object_type type,
+ u32 flags, struct acpi_namespace_node **return_node)
{
- acpi_status status;
- struct acpi_namespace_node *new_node;
-
-
- ACPI_FUNCTION_TRACE ("ns_search_and_enter");
+ acpi_status status;
+ struct acpi_namespace_node *new_node;
+ ACPI_FUNCTION_TRACE("ns_search_and_enter");
/* Parameter validation */
if (!node || !target_name || !return_node) {
- ACPI_DEBUG_PRINT ((ACPI_DB_ERROR,
- "Null param: Node %p Name %X return_node %p\n",
- node, target_name, return_node));
+ ACPI_DEBUG_PRINT((ACPI_DB_ERROR,
+ "Null param: Node %p Name %X return_node %p\n",
+ node, target_name, return_node));
- ACPI_REPORT_ERROR (("ns_search_and_enter: Null parameter\n"));
- return_ACPI_STATUS (AE_BAD_PARAMETER);
+ ACPI_REPORT_ERROR(("ns_search_and_enter: Null parameter\n"));
+ return_ACPI_STATUS(AE_BAD_PARAMETER);
}
/* Name must consist of printable characters */
- if (!acpi_ut_valid_acpi_name (target_name)) {
- ACPI_REPORT_ERROR (("ns_search_and_enter: Bad character in ACPI Name: %X\n",
- target_name));
- return_ACPI_STATUS (AE_BAD_CHARACTER);
+ if (!acpi_ut_valid_acpi_name(target_name)) {
+ ACPI_REPORT_ERROR(("ns_search_and_enter: Bad character in ACPI Name: %X\n", target_name));
+ return_ACPI_STATUS(AE_BAD_CHARACTER);
}
/* Try to find the name in the namespace level specified by the caller */
*return_node = ACPI_ENTRY_NOT_FOUND;
- status = acpi_ns_search_node (target_name, node, type, return_node);
+ status = acpi_ns_search_node(target_name, node, type, return_node);
if (status != AE_NOT_FOUND) {
/*
* If we found it AND the request specifies that a find is an error,
* return the error
*/
- if ((status == AE_OK) &&
- (flags & ACPI_NS_ERROR_IF_FOUND)) {
+ if ((status == AE_OK) && (flags & ACPI_NS_ERROR_IF_FOUND)) {
status = AE_ALREADY_EXISTS;
}
@@ -339,7 +329,7 @@ acpi_ns_search_and_enter (
* Either found it or there was an error
* -- finished either way
*/
- return_ACPI_STATUS (status);
+ return_ACPI_STATUS(status);
}
/*
@@ -351,14 +341,16 @@ acpi_ns_search_and_enter (
* and during the execution phase.
*/
if ((interpreter_mode != ACPI_IMODE_LOAD_PASS1) &&
- (flags & ACPI_NS_SEARCH_PARENT)) {
+ (flags & ACPI_NS_SEARCH_PARENT)) {
/*
* Not found at this level - search parent tree according to the
* ACPI specification
*/
- status = acpi_ns_search_parent_tree (target_name, node, type, return_node);
- if (ACPI_SUCCESS (status)) {
- return_ACPI_STATUS (status);
+ status =
+ acpi_ns_search_parent_tree(target_name, node, type,
+ return_node);
+ if (ACPI_SUCCESS(status)) {
+ return_ACPI_STATUS(status);
}
}
@@ -366,25 +358,24 @@ acpi_ns_search_and_enter (
* In execute mode, just search, never add names. Exit now.
*/
if (interpreter_mode == ACPI_IMODE_EXECUTE) {
- ACPI_DEBUG_PRINT ((ACPI_DB_NAMES,
- "%4.4s Not found in %p [Not adding]\n",
- (char *) &target_name, node));
+ ACPI_DEBUG_PRINT((ACPI_DB_NAMES,
+ "%4.4s Not found in %p [Not adding]\n",
+ (char *)&target_name, node));
- return_ACPI_STATUS (AE_NOT_FOUND);
+ return_ACPI_STATUS(AE_NOT_FOUND);
}
/* Create the new named object */
- new_node = acpi_ns_create_node (target_name);
+ new_node = acpi_ns_create_node(target_name);
if (!new_node) {
- return_ACPI_STATUS (AE_NO_MEMORY);
+ return_ACPI_STATUS(AE_NO_MEMORY);
}
/* Install the new object into the parent's list of children */
- acpi_ns_install_node (walk_state, node, new_node, type);
+ acpi_ns_install_node(walk_state, node, new_node, type);
*return_node = new_node;
- return_ACPI_STATUS (AE_OK);
+ return_ACPI_STATUS(AE_OK);
}
-
diff --git a/drivers/acpi/namespace/nsutils.c b/drivers/acpi/namespace/nsutils.c
index c53b82e94ce3..ebec036423c9 100644
--- a/drivers/acpi/namespace/nsutils.c
+++ b/drivers/acpi/namespace/nsutils.c
@@ -42,28 +42,21 @@
* POSSIBILITY OF SUCH DAMAGES.
*/
-
#include <acpi/acpi.h>
#include <acpi/acnamesp.h>
#include <acpi/amlcode.h>
#include <acpi/actables.h>
#define _COMPONENT ACPI_NAMESPACE
- ACPI_MODULE_NAME ("nsutils")
+ACPI_MODULE_NAME("nsutils")
/* Local prototypes */
-
-static u8
-acpi_ns_valid_path_separator (
- char sep);
+static u8 acpi_ns_valid_path_separator(char sep);
#ifdef ACPI_OBSOLETE_FUNCTIONS
-acpi_name
-acpi_ns_find_parent_name (
- struct acpi_namespace_node *node_to_search);
+acpi_name acpi_ns_find_parent_name(struct acpi_namespace_node *node_to_search);
#endif
-
/*******************************************************************************
*
* FUNCTION: acpi_ns_report_error
@@ -81,51 +74,45 @@ acpi_ns_find_parent_name (
******************************************************************************/
void
-acpi_ns_report_error (
- char *module_name,
- u32 line_number,
- u32 component_id,
- char *internal_name,
- acpi_status lookup_status)
+acpi_ns_report_error(char *module_name,
+ u32 line_number,
+ u32 component_id,
+ char *internal_name, acpi_status lookup_status)
{
- acpi_status status;
- char *name = NULL;
-
+ acpi_status status;
+ char *name = NULL;
- acpi_os_printf ("%8s-%04d: *** Error: Looking up ",
- module_name, line_number);
+ acpi_os_printf("%8s-%04d: *** Error: Looking up ",
+ module_name, line_number);
if (lookup_status == AE_BAD_CHARACTER) {
/* There is a non-ascii character in the name */
- acpi_os_printf ("[0x%4.4X] (NON-ASCII)\n",
- *(ACPI_CAST_PTR (u32, internal_name)));
- }
- else {
+ acpi_os_printf("[0x%4.4X] (NON-ASCII)\n",
+ *(ACPI_CAST_PTR(u32, internal_name)));
+ } else {
/* Convert path to external format */
- status = acpi_ns_externalize_name (ACPI_UINT32_MAX,
- internal_name, NULL, &name);
+ status = acpi_ns_externalize_name(ACPI_UINT32_MAX,
+ internal_name, NULL, &name);
/* Print target name */
- if (ACPI_SUCCESS (status)) {
- acpi_os_printf ("[%s]", name);
- }
- else {
- acpi_os_printf ("[COULD NOT EXTERNALIZE NAME]");
+ if (ACPI_SUCCESS(status)) {
+ acpi_os_printf("[%s]", name);
+ } else {
+ acpi_os_printf("[COULD NOT EXTERNALIZE NAME]");
}
if (name) {
- ACPI_MEM_FREE (name);
+ ACPI_MEM_FREE(name);
}
}
- acpi_os_printf (" in namespace, %s\n",
- acpi_format_exception (lookup_status));
+ acpi_os_printf(" in namespace, %s\n",
+ acpi_format_exception(lookup_status));
}
-
/*******************************************************************************
*
* FUNCTION: acpi_ns_report_method_error
@@ -145,34 +132,31 @@ acpi_ns_report_error (
******************************************************************************/
void
-acpi_ns_report_method_error (
- char *module_name,
- u32 line_number,
- u32 component_id,
- char *message,
- struct acpi_namespace_node *prefix_node,
- char *path,
- acpi_status method_status)
+acpi_ns_report_method_error(char *module_name,
+ u32 line_number,
+ u32 component_id,
+ char *message,
+ struct acpi_namespace_node *prefix_node,
+ char *path, acpi_status method_status)
{
- acpi_status status;
- struct acpi_namespace_node *node = prefix_node;
-
+ acpi_status status;
+ struct acpi_namespace_node *node = prefix_node;
if (path) {
- status = acpi_ns_get_node_by_path (path, prefix_node,
- ACPI_NS_NO_UPSEARCH, &node);
- if (ACPI_FAILURE (status)) {
- acpi_os_printf ("report_method_error: Could not get node\n");
+ status = acpi_ns_get_node_by_path(path, prefix_node,
+ ACPI_NS_NO_UPSEARCH, &node);
+ if (ACPI_FAILURE(status)) {
+ acpi_os_printf
+ ("report_method_error: Could not get node\n");
return;
}
}
- acpi_os_printf ("%8s-%04d: *** Error: ", module_name, line_number);
- acpi_ns_print_node_pathname (node, message);
- acpi_os_printf (", %s\n", acpi_format_exception (method_status));
+ acpi_os_printf("%8s-%04d: *** Error: ", module_name, line_number);
+ acpi_ns_print_node_pathname(node, message);
+ acpi_os_printf(", %s\n", acpi_format_exception(method_status));
}
-
/*******************************************************************************
*
* FUNCTION: acpi_ns_print_node_pathname
@@ -186,16 +170,13 @@ acpi_ns_report_method_error (
******************************************************************************/
void
-acpi_ns_print_node_pathname (
- struct acpi_namespace_node *node,
- char *message)
+acpi_ns_print_node_pathname(struct acpi_namespace_node *node, char *message)
{
- struct acpi_buffer buffer;
- acpi_status status;
-
+ struct acpi_buffer buffer;
+ acpi_status status;
if (!node) {
- acpi_os_printf ("[NULL NAME]");
+ acpi_os_printf("[NULL NAME]");
return;
}
@@ -203,18 +184,17 @@ acpi_ns_print_node_pathname (
buffer.length = ACPI_ALLOCATE_LOCAL_BUFFER;
- status = acpi_ns_handle_to_pathname (node, &buffer);
- if (ACPI_SUCCESS (status)) {
+ status = acpi_ns_handle_to_pathname(node, &buffer);
+ if (ACPI_SUCCESS(status)) {
if (message) {
- acpi_os_printf ("%s ", message);
+ acpi_os_printf("%s ", message);
}
- acpi_os_printf ("[%s] (Node %p)", (char *) buffer.pointer, node);
- ACPI_MEM_FREE (buffer.pointer);
+ acpi_os_printf("[%s] (Node %p)", (char *)buffer.pointer, node);
+ ACPI_MEM_FREE(buffer.pointer);
}
}
-
/*******************************************************************************
*
* FUNCTION: acpi_ns_valid_root_prefix
@@ -227,15 +207,12 @@ acpi_ns_print_node_pathname (
*
******************************************************************************/
-u8
-acpi_ns_valid_root_prefix (
- char prefix)
+u8 acpi_ns_valid_root_prefix(char prefix)
{
return ((u8) (prefix == '\\'));
}
-
/*******************************************************************************
*
* FUNCTION: acpi_ns_valid_path_separator
@@ -248,15 +225,12 @@ acpi_ns_valid_root_prefix (
*
******************************************************************************/
-static u8
-acpi_ns_valid_path_separator (
- char sep)
+static u8 acpi_ns_valid_path_separator(char sep)
{
return ((u8) (sep == '.'));
}
-
/*******************************************************************************
*
* FUNCTION: acpi_ns_get_type
@@ -269,22 +243,18 @@ acpi_ns_valid_path_separator (
*
******************************************************************************/
-acpi_object_type
-acpi_ns_get_type (
- struct acpi_namespace_node *node)
+acpi_object_type acpi_ns_get_type(struct acpi_namespace_node * node)
{
- ACPI_FUNCTION_TRACE ("ns_get_type");
-
+ ACPI_FUNCTION_TRACE("ns_get_type");
if (!node) {
- ACPI_REPORT_WARNING (("ns_get_type: Null Node input pointer\n"));
- return_VALUE (ACPI_TYPE_ANY);
+ ACPI_REPORT_WARNING(("ns_get_type: Null Node input pointer\n"));
+ return_VALUE(ACPI_TYPE_ANY);
}
- return_VALUE ((acpi_object_type) node->type);
+ return_VALUE((acpi_object_type) node->type);
}
-
/*******************************************************************************
*
* FUNCTION: acpi_ns_local
@@ -298,24 +268,20 @@ acpi_ns_get_type (
*
******************************************************************************/
-u32
-acpi_ns_local (
- acpi_object_type type)
+u32 acpi_ns_local(acpi_object_type type)
{
- ACPI_FUNCTION_TRACE ("ns_local");
-
+ ACPI_FUNCTION_TRACE("ns_local");
- if (!acpi_ut_valid_object_type (type)) {
+ if (!acpi_ut_valid_object_type(type)) {
/* Type code out of range */
- ACPI_REPORT_WARNING (("ns_local: Invalid Object Type\n"));
- return_VALUE (ACPI_NS_NORMAL);
+ ACPI_REPORT_WARNING(("ns_local: Invalid Object Type\n"));
+ return_VALUE(ACPI_NS_NORMAL);
}
- return_VALUE ((u32) acpi_gbl_ns_properties[type] & ACPI_NS_LOCAL);
+ return_VALUE((u32) acpi_gbl_ns_properties[type] & ACPI_NS_LOCAL);
}
-
/*******************************************************************************
*
* FUNCTION: acpi_ns_get_internal_name_length
@@ -330,16 +296,12 @@ acpi_ns_local (
*
******************************************************************************/
-void
-acpi_ns_get_internal_name_length (
- struct acpi_namestring_info *info)
+void acpi_ns_get_internal_name_length(struct acpi_namestring_info *info)
{
- char *next_external_char;
- u32 i;
-
-
- ACPI_FUNCTION_ENTRY ();
+ char *next_external_char;
+ u32 i;
+ ACPI_FUNCTION_ENTRY();
next_external_char = info->external_name;
info->num_carats = 0;
@@ -353,11 +315,10 @@ acpi_ns_get_internal_name_length (
*
* strlen() + 1 covers the first name_seg, which has no path separator
*/
- if (acpi_ns_valid_root_prefix (next_external_char[0])) {
+ if (acpi_ns_valid_root_prefix(next_external_char[0])) {
info->fully_qualified = TRUE;
next_external_char++;
- }
- else {
+ } else {
/*
* Handle Carat prefixes
*/
@@ -375,19 +336,18 @@ acpi_ns_get_internal_name_length (
if (*next_external_char) {
info->num_segments = 1;
for (i = 0; next_external_char[i]; i++) {
- if (acpi_ns_valid_path_separator (next_external_char[i])) {
+ if (acpi_ns_valid_path_separator(next_external_char[i])) {
info->num_segments++;
}
}
}
info->length = (ACPI_NAME_SIZE * info->num_segments) +
- 4 + info->num_carats;
+ 4 + info->num_carats;
info->next_external_char = next_external_char;
}
-
/*******************************************************************************
*
* FUNCTION: acpi_ns_build_internal_name
@@ -401,19 +361,15 @@ acpi_ns_get_internal_name_length (
*
******************************************************************************/
-acpi_status
-acpi_ns_build_internal_name (
- struct acpi_namestring_info *info)
+acpi_status acpi_ns_build_internal_name(struct acpi_namestring_info *info)
{
- u32 num_segments = info->num_segments;
- char *internal_name = info->internal_name;
- char *external_name = info->next_external_char;
- char *result = NULL;
- acpi_native_uint i;
-
-
- ACPI_FUNCTION_TRACE ("ns_build_internal_name");
+ u32 num_segments = info->num_segments;
+ char *internal_name = info->internal_name;
+ char *external_name = info->next_external_char;
+ char *result = NULL;
+ acpi_native_uint i;
+ ACPI_FUNCTION_TRACE("ns_build_internal_name");
/* Setup the correct prefixes, counts, and pointers */
@@ -422,18 +378,15 @@ acpi_ns_build_internal_name (
if (num_segments <= 1) {
result = &internal_name[1];
- }
- else if (num_segments == 2) {
+ } else if (num_segments == 2) {
internal_name[1] = AML_DUAL_NAME_PREFIX;
result = &internal_name[2];
- }
- else {
+ } else {
internal_name[1] = AML_MULTI_NAME_PREFIX_OP;
- internal_name[2] = (char) num_segments;
+ internal_name[2] = (char)num_segments;
result = &internal_name[3];
}
- }
- else {
+ } else {
/*
* Not fully qualified.
* Handle Carats first, then append the name segments
@@ -447,15 +400,14 @@ acpi_ns_build_internal_name (
if (num_segments <= 1) {
result = &internal_name[i];
- }
- else if (num_segments == 2) {
+ } else if (num_segments == 2) {
internal_name[i] = AML_DUAL_NAME_PREFIX;
- result = &internal_name[(acpi_native_uint) (i+1)];
- }
- else {
+ result = &internal_name[(acpi_native_uint) (i + 1)];
+ } else {
internal_name[i] = AML_MULTI_NAME_PREFIX_OP;
- internal_name[(acpi_native_uint) (i+1)] = (char) num_segments;
- result = &internal_name[(acpi_native_uint) (i+2)];
+ internal_name[(acpi_native_uint) (i + 1)] =
+ (char)num_segments;
+ result = &internal_name[(acpi_native_uint) (i + 2)];
}
}
@@ -463,25 +415,25 @@ acpi_ns_build_internal_name (
for (; num_segments; num_segments--) {
for (i = 0; i < ACPI_NAME_SIZE; i++) {
- if (acpi_ns_valid_path_separator (*external_name) ||
- (*external_name == 0)) {
+ if (acpi_ns_valid_path_separator(*external_name) ||
+ (*external_name == 0)) {
/* Pad the segment with underscore(s) if segment is short */
result[i] = '_';
- }
- else {
+ } else {
/* Convert the character to uppercase and save it */
- result[i] = (char) ACPI_TOUPPER ((int) *external_name);
+ result[i] =
+ (char)ACPI_TOUPPER((int)*external_name);
external_name++;
}
}
/* Now we must have a path separator, or the pathname is bad */
- if (!acpi_ns_valid_path_separator (*external_name) &&
- (*external_name != 0)) {
- return_ACPI_STATUS (AE_BAD_PARAMETER);
+ if (!acpi_ns_valid_path_separator(*external_name) &&
+ (*external_name != 0)) {
+ return_ACPI_STATUS(AE_BAD_PARAMETER);
}
/* Move on the next segment */
@@ -495,18 +447,17 @@ acpi_ns_build_internal_name (
*result = 0;
if (info->fully_qualified) {
- ACPI_DEBUG_PRINT ((ACPI_DB_EXEC, "Returning [%p] (abs) \"\\%s\"\n",
- internal_name, internal_name));
- }
- else {
- ACPI_DEBUG_PRINT ((ACPI_DB_EXEC, "Returning [%p] (rel) \"%s\"\n",
- internal_name, internal_name));
+ ACPI_DEBUG_PRINT((ACPI_DB_EXEC,
+ "Returning [%p] (abs) \"\\%s\"\n",
+ internal_name, internal_name));
+ } else {
+ ACPI_DEBUG_PRINT((ACPI_DB_EXEC, "Returning [%p] (rel) \"%s\"\n",
+ internal_name, internal_name));
}
- return_ACPI_STATUS (AE_OK);
+ return_ACPI_STATUS(AE_OK);
}
-
/*******************************************************************************
*
* FUNCTION: acpi_ns_internalize_name
@@ -522,51 +473,43 @@ acpi_ns_build_internal_name (
*
*******************************************************************************/
-acpi_status
-acpi_ns_internalize_name (
- char *external_name,
- char **converted_name)
+acpi_status acpi_ns_internalize_name(char *external_name, char **converted_name)
{
- char *internal_name;
- struct acpi_namestring_info info;
- acpi_status status;
-
-
- ACPI_FUNCTION_TRACE ("ns_internalize_name");
+ char *internal_name;
+ struct acpi_namestring_info info;
+ acpi_status status;
+ ACPI_FUNCTION_TRACE("ns_internalize_name");
- if ((!external_name) ||
- (*external_name == 0) ||
- (!converted_name)) {
- return_ACPI_STATUS (AE_BAD_PARAMETER);
+ if ((!external_name) || (*external_name == 0) || (!converted_name)) {
+ return_ACPI_STATUS(AE_BAD_PARAMETER);
}
/* Get the length of the new internal name */
info.external_name = external_name;
- acpi_ns_get_internal_name_length (&info);
+ acpi_ns_get_internal_name_length(&info);
/* We need a segment to store the internal name */
- internal_name = ACPI_MEM_CALLOCATE (info.length);
+ internal_name = ACPI_MEM_CALLOCATE(info.length);
if (!internal_name) {
- return_ACPI_STATUS (AE_NO_MEMORY);
+ return_ACPI_STATUS(AE_NO_MEMORY);
}
/* Build the name */
info.internal_name = internal_name;
- status = acpi_ns_build_internal_name (&info);
- if (ACPI_FAILURE (status)) {
- ACPI_MEM_FREE (internal_name);
- return_ACPI_STATUS (status);
+ status = acpi_ns_build_internal_name(&info);
+ if (ACPI_FAILURE(status)) {
+ ACPI_MEM_FREE(internal_name);
+ return_ACPI_STATUS(status);
}
*converted_name = internal_name;
- return_ACPI_STATUS (AE_OK);
+ return_ACPI_STATUS(AE_OK);
}
-
/*******************************************************************************
*
* FUNCTION: acpi_ns_externalize_name
@@ -585,27 +528,21 @@ acpi_ns_internalize_name (
******************************************************************************/
acpi_status
-acpi_ns_externalize_name (
- u32 internal_name_length,
- char *internal_name,
- u32 *converted_name_length,
- char **converted_name)
+acpi_ns_externalize_name(u32 internal_name_length,
+ char *internal_name,
+ u32 * converted_name_length, char **converted_name)
{
- acpi_native_uint names_index = 0;
- acpi_native_uint num_segments = 0;
- acpi_native_uint required_length;
- acpi_native_uint prefix_length = 0;
- acpi_native_uint i = 0;
- acpi_native_uint j = 0;
-
+ acpi_native_uint names_index = 0;
+ acpi_native_uint num_segments = 0;
+ acpi_native_uint required_length;
+ acpi_native_uint prefix_length = 0;
+ acpi_native_uint i = 0;
+ acpi_native_uint j = 0;
- ACPI_FUNCTION_TRACE ("ns_externalize_name");
+ ACPI_FUNCTION_TRACE("ns_externalize_name");
-
- if (!internal_name_length ||
- !internal_name ||
- !converted_name) {
- return_ACPI_STATUS (AE_BAD_PARAMETER);
+ if (!internal_name_length || !internal_name || !converted_name) {
+ return_ACPI_STATUS(AE_BAD_PARAMETER);
}
/*
@@ -620,8 +557,7 @@ acpi_ns_externalize_name (
for (i = 0; i < internal_name_length; i++) {
if (internal_name[i] == '^') {
prefix_length = i + 1;
- }
- else {
+ } else {
break;
}
}
@@ -648,7 +584,8 @@ acpi_ns_externalize_name (
names_index = prefix_length + 2;
num_segments = (acpi_native_uint) (u8)
- internal_name[(acpi_native_uint) (prefix_length + 1)];
+ internal_name[(acpi_native_uint)
+ (prefix_length + 1)];
break;
case AML_DUAL_NAME_PREFIX:
@@ -683,23 +620,23 @@ acpi_ns_externalize_name (
* punctuation ('.') between object names, plus the NULL terminator.
*/
required_length = prefix_length + (4 * num_segments) +
- ((num_segments > 0) ? (num_segments - 1) : 0) + 1;
+ ((num_segments > 0) ? (num_segments - 1) : 0) + 1;
/*
* Check to see if we're still in bounds. If not, there's a problem
* with internal_name (invalid format).
*/
if (required_length > internal_name_length) {
- ACPI_REPORT_ERROR (("ns_externalize_name: Invalid internal name\n"));
- return_ACPI_STATUS (AE_BAD_PATHNAME);
+ ACPI_REPORT_ERROR(("ns_externalize_name: Invalid internal name\n"));
+ return_ACPI_STATUS(AE_BAD_PATHNAME);
}
/*
* Build converted_name
*/
- *converted_name = ACPI_MEM_CALLOCATE (required_length);
+ *converted_name = ACPI_MEM_CALLOCATE(required_length);
if (!(*converted_name)) {
- return_ACPI_STATUS (AE_NO_MEMORY);
+ return_ACPI_STATUS(AE_NO_MEMORY);
}
j = 0;
@@ -725,10 +662,9 @@ acpi_ns_externalize_name (
*converted_name_length = (u32) required_length;
}
- return_ACPI_STATUS (AE_OK);
+ return_ACPI_STATUS(AE_OK);
}
-
/*******************************************************************************
*
* FUNCTION: acpi_ns_map_handle_to_node
@@ -745,13 +681,10 @@ acpi_ns_externalize_name (
*
******************************************************************************/
-struct acpi_namespace_node *
-acpi_ns_map_handle_to_node (
- acpi_handle handle)
+struct acpi_namespace_node *acpi_ns_map_handle_to_node(acpi_handle handle)
{
- ACPI_FUNCTION_ENTRY ();
-
+ ACPI_FUNCTION_ENTRY();
/*
* Simple implementation.
@@ -766,14 +699,13 @@ acpi_ns_map_handle_to_node (
/* We can at least attempt to verify the handle */
- if (ACPI_GET_DESCRIPTOR_TYPE (handle) != ACPI_DESC_TYPE_NAMED) {
+ if (ACPI_GET_DESCRIPTOR_TYPE(handle) != ACPI_DESC_TYPE_NAMED) {
return (NULL);
}
- return ((struct acpi_namespace_node *) handle);
+ return ((struct acpi_namespace_node *)handle);
}
-
/*******************************************************************************
*
* FUNCTION: acpi_ns_convert_entry_to_handle
@@ -786,18 +718,14 @@ acpi_ns_map_handle_to_node (
*
******************************************************************************/
-acpi_handle
-acpi_ns_convert_entry_to_handle (
- struct acpi_namespace_node *node)
+acpi_handle acpi_ns_convert_entry_to_handle(struct acpi_namespace_node *node)
{
-
/*
* Simple implementation for now;
*/
return ((acpi_handle) node);
-
/* Example future implementation ---------------------
if (!Node)
@@ -810,12 +738,10 @@ acpi_ns_convert_entry_to_handle (
return (ACPI_ROOT_OBJECT);
}
-
return ((acpi_handle) Node);
------------------------------------------------------*/
}
-
/*******************************************************************************
*
* FUNCTION: acpi_ns_terminate
@@ -828,42 +754,37 @@ acpi_ns_convert_entry_to_handle (
*
******************************************************************************/
-void
-acpi_ns_terminate (
- void)
+void acpi_ns_terminate(void)
{
- union acpi_operand_object *obj_desc;
-
-
- ACPI_FUNCTION_TRACE ("ns_terminate");
+ union acpi_operand_object *obj_desc;
+ ACPI_FUNCTION_TRACE("ns_terminate");
/*
* 1) Free the entire namespace -- all nodes and objects
*
* Delete all object descriptors attached to namepsace nodes
*/
- acpi_ns_delete_namespace_subtree (acpi_gbl_root_node);
+ acpi_ns_delete_namespace_subtree(acpi_gbl_root_node);
/* Detach any objects attached to the root */
- obj_desc = acpi_ns_get_attached_object (acpi_gbl_root_node);
+ obj_desc = acpi_ns_get_attached_object(acpi_gbl_root_node);
if (obj_desc) {
- acpi_ns_detach_object (acpi_gbl_root_node);
+ acpi_ns_detach_object(acpi_gbl_root_node);
}
- ACPI_DEBUG_PRINT ((ACPI_DB_INFO, "Namespace freed\n"));
+ ACPI_DEBUG_PRINT((ACPI_DB_INFO, "Namespace freed\n"));
/*
* 2) Now we can delete the ACPI tables
*/
- acpi_tb_delete_all_tables ();
- ACPI_DEBUG_PRINT ((ACPI_DB_INFO, "ACPI Tables freed\n"));
+ acpi_tb_delete_all_tables();
+ ACPI_DEBUG_PRINT((ACPI_DB_INFO, "ACPI Tables freed\n"));
return_VOID;
}
-
/*******************************************************************************
*
* FUNCTION: acpi_ns_opens_scope
@@ -875,24 +796,21 @@ acpi_ns_terminate (
*
******************************************************************************/
-u32
-acpi_ns_opens_scope (
- acpi_object_type type)
+u32 acpi_ns_opens_scope(acpi_object_type type)
{
- ACPI_FUNCTION_TRACE_STR ("ns_opens_scope", acpi_ut_get_type_name (type));
-
+ ACPI_FUNCTION_TRACE_STR("ns_opens_scope", acpi_ut_get_type_name(type));
- if (!acpi_ut_valid_object_type (type)) {
+ if (!acpi_ut_valid_object_type(type)) {
/* type code out of range */
- ACPI_REPORT_WARNING (("ns_opens_scope: Invalid Object Type %X\n", type));
- return_VALUE (ACPI_NS_NORMAL);
+ ACPI_REPORT_WARNING(("ns_opens_scope: Invalid Object Type %X\n",
+ type));
+ return_VALUE(ACPI_NS_NORMAL);
}
- return_VALUE (((u32) acpi_gbl_ns_properties[type]) & ACPI_NS_NEWSCOPE);
+ return_VALUE(((u32) acpi_gbl_ns_properties[type]) & ACPI_NS_NEWSCOPE);
}
-
/*******************************************************************************
*
* FUNCTION: acpi_ns_get_node_by_path
@@ -916,33 +834,29 @@ acpi_ns_opens_scope (
******************************************************************************/
acpi_status
-acpi_ns_get_node_by_path (
- char *pathname,
- struct acpi_namespace_node *start_node,
- u32 flags,
- struct acpi_namespace_node **return_node)
+acpi_ns_get_node_by_path(char *pathname,
+ struct acpi_namespace_node *start_node,
+ u32 flags, struct acpi_namespace_node **return_node)
{
- union acpi_generic_state scope_info;
- acpi_status status;
- char *internal_path = NULL;
-
-
- ACPI_FUNCTION_TRACE_PTR ("ns_get_node_by_path", pathname);
+ union acpi_generic_state scope_info;
+ acpi_status status;
+ char *internal_path = NULL;
+ ACPI_FUNCTION_TRACE_PTR("ns_get_node_by_path", pathname);
if (pathname) {
/* Convert path to internal representation */
- status = acpi_ns_internalize_name (pathname, &internal_path);
- if (ACPI_FAILURE (status)) {
- return_ACPI_STATUS (status);
+ status = acpi_ns_internalize_name(pathname, &internal_path);
+ if (ACPI_FAILURE(status)) {
+ return_ACPI_STATUS(status);
}
}
/* Must lock namespace during lookup */
- status = acpi_ut_acquire_mutex (ACPI_MTX_NAMESPACE);
- if (ACPI_FAILURE (status)) {
+ status = acpi_ut_acquire_mutex(ACPI_MTX_NAMESPACE);
+ if (ACPI_FAILURE(status)) {
goto cleanup;
}
@@ -952,25 +866,25 @@ acpi_ns_get_node_by_path (
/* Lookup the name in the namespace */
- status = acpi_ns_lookup (&scope_info, internal_path,
- ACPI_TYPE_ANY, ACPI_IMODE_EXECUTE,
- (flags | ACPI_NS_DONT_OPEN_SCOPE),
- NULL, return_node);
- if (ACPI_FAILURE (status)) {
- ACPI_DEBUG_PRINT ((ACPI_DB_INFO, "%s, %s\n",
- internal_path, acpi_format_exception (status)));
+ status = acpi_ns_lookup(&scope_info, internal_path,
+ ACPI_TYPE_ANY, ACPI_IMODE_EXECUTE,
+ (flags | ACPI_NS_DONT_OPEN_SCOPE),
+ NULL, return_node);
+ if (ACPI_FAILURE(status)) {
+ ACPI_DEBUG_PRINT((ACPI_DB_INFO, "%s, %s\n",
+ internal_path,
+ acpi_format_exception(status)));
}
- (void) acpi_ut_release_mutex (ACPI_MTX_NAMESPACE);
+ (void)acpi_ut_release_mutex(ACPI_MTX_NAMESPACE);
-cleanup:
+ cleanup:
if (internal_path) {
- ACPI_MEM_FREE (internal_path);
+ ACPI_MEM_FREE(internal_path);
}
- return_ACPI_STATUS (status);
+ return_ACPI_STATUS(status);
}
-
/*******************************************************************************
*
* FUNCTION: acpi_ns_get_parent_node
@@ -983,12 +897,10 @@ cleanup:
*
******************************************************************************/
-struct acpi_namespace_node *
-acpi_ns_get_parent_node (
- struct acpi_namespace_node *node)
+struct acpi_namespace_node *acpi_ns_get_parent_node(struct acpi_namespace_node
+ *node)
{
- ACPI_FUNCTION_ENTRY ();
-
+ ACPI_FUNCTION_ENTRY();
if (!node) {
return (NULL);
@@ -1006,7 +918,6 @@ acpi_ns_get_parent_node (
return (node->peer);
}
-
/*******************************************************************************
*
* FUNCTION: acpi_ns_get_next_valid_node
@@ -1021,9 +932,9 @@ acpi_ns_get_parent_node (
*
******************************************************************************/
-struct acpi_namespace_node *
-acpi_ns_get_next_valid_node (
- struct acpi_namespace_node *node)
+struct acpi_namespace_node *acpi_ns_get_next_valid_node(struct
+ acpi_namespace_node
+ *node)
{
/* If we are at the end of this peer list, return NULL */
@@ -1037,7 +948,6 @@ acpi_ns_get_next_valid_node (
return (node->peer);
}
-
#ifdef ACPI_OBSOLETE_FUNCTIONS
/*******************************************************************************
*
@@ -1053,38 +963,36 @@ acpi_ns_get_next_valid_node (
*
******************************************************************************/
-acpi_name
-acpi_ns_find_parent_name (
- struct acpi_namespace_node *child_node)
+acpi_name acpi_ns_find_parent_name(struct acpi_namespace_node * child_node)
{
- struct acpi_namespace_node *parent_node;
-
-
- ACPI_FUNCTION_TRACE ("ns_find_parent_name");
+ struct acpi_namespace_node *parent_node;
+ ACPI_FUNCTION_TRACE("ns_find_parent_name");
if (child_node) {
/* Valid entry. Get the parent Node */
- parent_node = acpi_ns_get_parent_node (child_node);
+ parent_node = acpi_ns_get_parent_node(child_node);
if (parent_node) {
- ACPI_DEBUG_PRINT ((ACPI_DB_EXEC,
- "Parent of %p [%4.4s] is %p [%4.4s]\n",
- child_node, acpi_ut_get_node_name (child_node),
- parent_node, acpi_ut_get_node_name (parent_node)));
+ ACPI_DEBUG_PRINT((ACPI_DB_EXEC,
+ "Parent of %p [%4.4s] is %p [%4.4s]\n",
+ child_node,
+ acpi_ut_get_node_name(child_node),
+ parent_node,
+ acpi_ut_get_node_name(parent_node)));
if (parent_node->name.integer) {
- return_VALUE ((acpi_name) parent_node->name.integer);
+ return_VALUE((acpi_name) parent_node->name.
+ integer);
}
}
- ACPI_DEBUG_PRINT ((ACPI_DB_EXEC,
- "Unable to find parent of %p (%4.4s)\n",
- child_node, acpi_ut_get_node_name (child_node)));
+ ACPI_DEBUG_PRINT((ACPI_DB_EXEC,
+ "Unable to find parent of %p (%4.4s)\n",
+ child_node,
+ acpi_ut_get_node_name(child_node)));
}
- return_VALUE (ACPI_UNKNOWN_NAME);
+ return_VALUE(ACPI_UNKNOWN_NAME);
}
#endif
-
-
diff --git a/drivers/acpi/namespace/nswalk.c b/drivers/acpi/namespace/nswalk.c
index f9a7277dca6e..5f164c0df33b 100644
--- a/drivers/acpi/namespace/nswalk.c
+++ b/drivers/acpi/namespace/nswalk.c
@@ -41,14 +41,11 @@
* POSSIBILITY OF SUCH DAMAGES.
*/
-
#include <acpi/acpi.h>
#include <acpi/acnamesp.h>
-
#define _COMPONENT ACPI_NAMESPACE
- ACPI_MODULE_NAME ("nswalk")
-
+ACPI_MODULE_NAME("nswalk")
/*******************************************************************************
*
@@ -68,18 +65,15 @@
* within Scope is returned.
*
******************************************************************************/
-
-struct acpi_namespace_node *
-acpi_ns_get_next_node (
- acpi_object_type type,
- struct acpi_namespace_node *parent_node,
- struct acpi_namespace_node *child_node)
+struct acpi_namespace_node *acpi_ns_get_next_node(acpi_object_type type,
+ struct acpi_namespace_node
+ *parent_node,
+ struct acpi_namespace_node
+ *child_node)
{
- struct acpi_namespace_node *next_node = NULL;
-
-
- ACPI_FUNCTION_ENTRY ();
+ struct acpi_namespace_node *next_node = NULL;
+ ACPI_FUNCTION_ENTRY();
if (!child_node) {
/* It's really the parent's _scope_ that we want */
@@ -92,7 +86,7 @@ acpi_ns_get_next_node (
else {
/* Start search at the NEXT node */
- next_node = acpi_ns_get_next_valid_node (child_node);
+ next_node = acpi_ns_get_next_valid_node(child_node);
}
/* If any type is OK, we are done */
@@ -114,7 +108,7 @@ acpi_ns_get_next_node (
/* Otherwise, move on to the next node */
- next_node = acpi_ns_get_next_valid_node (next_node);
+ next_node = acpi_ns_get_next_valid_node(next_node);
}
/* Not found */
@@ -122,7 +116,6 @@ acpi_ns_get_next_node (
return (NULL);
}
-
/*******************************************************************************
*
* FUNCTION: acpi_ns_walk_namespace
@@ -154,25 +147,21 @@ acpi_ns_get_next_node (
******************************************************************************/
acpi_status
-acpi_ns_walk_namespace (
- acpi_object_type type,
- acpi_handle start_node,
- u32 max_depth,
- u8 unlock_before_callback,
- acpi_walk_callback user_function,
- void *context,
- void **return_value)
+acpi_ns_walk_namespace(acpi_object_type type,
+ acpi_handle start_node,
+ u32 max_depth,
+ u8 unlock_before_callback,
+ acpi_walk_callback user_function,
+ void *context, void **return_value)
{
- acpi_status status;
- acpi_status mutex_status;
- struct acpi_namespace_node *child_node;
- struct acpi_namespace_node *parent_node;
- acpi_object_type child_type;
- u32 level;
-
-
- ACPI_FUNCTION_TRACE ("ns_walk_namespace");
+ acpi_status status;
+ acpi_status mutex_status;
+ struct acpi_namespace_node *child_node;
+ struct acpi_namespace_node *parent_node;
+ acpi_object_type child_type;
+ u32 level;
+ ACPI_FUNCTION_TRACE("ns_walk_namespace");
/* Special case for the namespace Root Node */
@@ -183,9 +172,9 @@ acpi_ns_walk_namespace (
/* Null child means "get first node" */
parent_node = start_node;
- child_node = NULL;
- child_type = ACPI_TYPE_ANY;
- level = 1;
+ child_node = NULL;
+ child_type = ACPI_TYPE_ANY;
+ level = 1;
/*
* Traverse the tree of nodes until we bubble back up to where we
@@ -196,7 +185,9 @@ acpi_ns_walk_namespace (
/* Get the next node in this scope. Null if not found */
status = AE_OK;
- child_node = acpi_ns_get_next_node (ACPI_TYPE_ANY, parent_node, child_node);
+ child_node =
+ acpi_ns_get_next_node(ACPI_TYPE_ANY, parent_node,
+ child_node);
if (child_node) {
/*
* Found node, Get the type if we are not
@@ -212,19 +203,25 @@ acpi_ns_walk_namespace (
* callback function
*/
if (unlock_before_callback) {
- mutex_status = acpi_ut_release_mutex (ACPI_MTX_NAMESPACE);
- if (ACPI_FAILURE (mutex_status)) {
- return_ACPI_STATUS (mutex_status);
+ mutex_status =
+ acpi_ut_release_mutex
+ (ACPI_MTX_NAMESPACE);
+ if (ACPI_FAILURE(mutex_status)) {
+ return_ACPI_STATUS
+ (mutex_status);
}
}
- status = user_function (child_node, level,
- context, return_value);
+ status = user_function(child_node, level,
+ context, return_value);
if (unlock_before_callback) {
- mutex_status = acpi_ut_acquire_mutex (ACPI_MTX_NAMESPACE);
- if (ACPI_FAILURE (mutex_status)) {
- return_ACPI_STATUS (mutex_status);
+ mutex_status =
+ acpi_ut_acquire_mutex
+ (ACPI_MTX_NAMESPACE);
+ if (ACPI_FAILURE(mutex_status)) {
+ return_ACPI_STATUS
+ (mutex_status);
}
}
@@ -239,13 +236,13 @@ acpi_ns_walk_namespace (
/* Exit now, with OK status */
- return_ACPI_STATUS (AE_OK);
+ return_ACPI_STATUS(AE_OK);
default:
/* All others are valid exceptions */
- return_ACPI_STATUS (status);
+ return_ACPI_STATUS(status);
}
}
@@ -258,7 +255,8 @@ acpi_ns_walk_namespace (
* maximum depth has been reached.
*/
if ((level < max_depth) && (status != AE_CTRL_DEPTH)) {
- if (acpi_ns_get_next_node (ACPI_TYPE_ANY, child_node, NULL)) {
+ if (acpi_ns_get_next_node
+ (ACPI_TYPE_ANY, child_node, NULL)) {
/*
* There is at least one child of this
* node, visit the onde
@@ -268,8 +266,7 @@ acpi_ns_walk_namespace (
child_node = NULL;
}
}
- }
- else {
+ } else {
/*
* No more children of this node (acpi_ns_get_next_node
* failed), go back upwards in the namespace tree to
@@ -277,13 +274,11 @@ acpi_ns_walk_namespace (
*/
level--;
child_node = parent_node;
- parent_node = acpi_ns_get_parent_node (parent_node);
+ parent_node = acpi_ns_get_parent_node(parent_node);
}
}
/* Complete walk, not terminated by user function */
- return_ACPI_STATUS (AE_OK);
+ return_ACPI_STATUS(AE_OK);
}
-
-
diff --git a/drivers/acpi/namespace/nsxfeval.c b/drivers/acpi/namespace/nsxfeval.c
index 12ea202257fa..c07b046659ff 100644
--- a/drivers/acpi/namespace/nsxfeval.c
+++ b/drivers/acpi/namespace/nsxfeval.c
@@ -48,10 +48,8 @@
#include <acpi/acnamesp.h>
#include <acpi/acinterp.h>
-
#define _COMPONENT ACPI_NAMESPACE
- ACPI_MODULE_NAME ("nsxfeval")
-
+ACPI_MODULE_NAME("nsxfeval")
/*******************************************************************************
*
@@ -73,27 +71,23 @@
* be valid (non-null)
*
******************************************************************************/
-
#ifdef ACPI_FUTURE_USAGE
acpi_status
-acpi_evaluate_object_typed (
- acpi_handle handle,
- acpi_string pathname,
- struct acpi_object_list *external_params,
- struct acpi_buffer *return_buffer,
- acpi_object_type return_type)
+acpi_evaluate_object_typed(acpi_handle handle,
+ acpi_string pathname,
+ struct acpi_object_list *external_params,
+ struct acpi_buffer *return_buffer,
+ acpi_object_type return_type)
{
- acpi_status status;
- u8 must_free = FALSE;
-
-
- ACPI_FUNCTION_TRACE ("acpi_evaluate_object_typed");
+ acpi_status status;
+ u8 must_free = FALSE;
+ ACPI_FUNCTION_TRACE("acpi_evaluate_object_typed");
/* Return buffer must be valid */
if (!return_buffer) {
- return_ACPI_STATUS (AE_BAD_PARAMETER);
+ return_ACPI_STATUS(AE_BAD_PARAMETER);
}
if (return_buffer->length == ACPI_ALLOCATE_BUFFER) {
@@ -102,51 +96,52 @@ acpi_evaluate_object_typed (
/* Evaluate the object */
- status = acpi_evaluate_object (handle, pathname, external_params, return_buffer);
- if (ACPI_FAILURE (status)) {
- return_ACPI_STATUS (status);
+ status =
+ acpi_evaluate_object(handle, pathname, external_params,
+ return_buffer);
+ if (ACPI_FAILURE(status)) {
+ return_ACPI_STATUS(status);
}
/* Type ANY means "don't care" */
if (return_type == ACPI_TYPE_ANY) {
- return_ACPI_STATUS (AE_OK);
+ return_ACPI_STATUS(AE_OK);
}
if (return_buffer->length == 0) {
/* Error because caller specifically asked for a return value */
- ACPI_DEBUG_PRINT ((ACPI_DB_ERROR,
- "No return value\n"));
+ ACPI_DEBUG_PRINT((ACPI_DB_ERROR, "No return value\n"));
- return_ACPI_STATUS (AE_NULL_OBJECT);
+ return_ACPI_STATUS(AE_NULL_OBJECT);
}
/* Examine the object type returned from evaluate_object */
- if (((union acpi_object *) return_buffer->pointer)->type == return_type) {
- return_ACPI_STATUS (AE_OK);
+ if (((union acpi_object *)return_buffer->pointer)->type == return_type) {
+ return_ACPI_STATUS(AE_OK);
}
/* Return object type does not match requested type */
- ACPI_DEBUG_PRINT ((ACPI_DB_ERROR,
- "Incorrect return type [%s] requested [%s]\n",
- acpi_ut_get_type_name (((union acpi_object *) return_buffer->pointer)->type),
- acpi_ut_get_type_name (return_type)));
+ ACPI_DEBUG_PRINT((ACPI_DB_ERROR,
+ "Incorrect return type [%s] requested [%s]\n",
+ acpi_ut_get_type_name(((union acpi_object *)
+ return_buffer->pointer)->type),
+ acpi_ut_get_type_name(return_type)));
if (must_free) {
/* Caller used ACPI_ALLOCATE_BUFFER, free the return buffer */
- acpi_os_free (return_buffer->pointer);
+ acpi_os_free(return_buffer->pointer);
return_buffer->pointer = NULL;
}
return_buffer->length = 0;
- return_ACPI_STATUS (AE_TYPE);
+ return_ACPI_STATUS(AE_TYPE);
}
-#endif /* ACPI_FUTURE_USAGE */
-
+#endif /* ACPI_FUTURE_USAGE */
/*******************************************************************************
*
@@ -169,21 +164,18 @@ acpi_evaluate_object_typed (
******************************************************************************/
acpi_status
-acpi_evaluate_object (
- acpi_handle handle,
- acpi_string pathname,
- struct acpi_object_list *external_params,
- struct acpi_buffer *return_buffer)
+acpi_evaluate_object(acpi_handle handle,
+ acpi_string pathname,
+ struct acpi_object_list *external_params,
+ struct acpi_buffer *return_buffer)
{
- acpi_status status;
- acpi_status status2;
- struct acpi_parameter_info info;
- acpi_size buffer_space_needed;
- u32 i;
-
-
- ACPI_FUNCTION_TRACE ("acpi_evaluate_object");
+ acpi_status status;
+ acpi_status status2;
+ struct acpi_parameter_info info;
+ acpi_size buffer_space_needed;
+ u32 i;
+ ACPI_FUNCTION_TRACE("acpi_evaluate_object");
info.node = handle;
info.parameters = NULL;
@@ -200,11 +192,11 @@ acpi_evaluate_object (
* Allocate a new parameter block for the internal objects
* Add 1 to count to allow for null terminated internal list
*/
- info.parameters = ACPI_MEM_CALLOCATE (
- ((acpi_size) external_params->count + 1) *
- sizeof (void *));
+ info.parameters = ACPI_MEM_CALLOCATE(((acpi_size)
+ external_params->count +
+ 1) * sizeof(void *));
if (!info.parameters) {
- return_ACPI_STATUS (AE_NO_MEMORY);
+ return_ACPI_STATUS(AE_NO_MEMORY);
}
/*
@@ -212,48 +204,47 @@ acpi_evaluate_object (
* internal object
*/
for (i = 0; i < external_params->count; i++) {
- status = acpi_ut_copy_eobject_to_iobject (&external_params->pointer[i],
- &info.parameters[i]);
- if (ACPI_FAILURE (status)) {
- acpi_ut_delete_internal_object_list (info.parameters);
- return_ACPI_STATUS (status);
+ status =
+ acpi_ut_copy_eobject_to_iobject(&external_params->
+ pointer[i],
+ &info.
+ parameters[i]);
+ if (ACPI_FAILURE(status)) {
+ acpi_ut_delete_internal_object_list(info.
+ parameters);
+ return_ACPI_STATUS(status);
}
}
info.parameters[external_params->count] = NULL;
}
-
/*
* Three major cases:
* 1) Fully qualified pathname
* 2) No handle, not fully qualified pathname (error)
* 3) Valid handle
*/
- if ((pathname) &&
- (acpi_ns_valid_root_prefix (pathname[0]))) {
+ if ((pathname) && (acpi_ns_valid_root_prefix(pathname[0]))) {
/*
* The path is fully qualified, just evaluate by name
*/
- status = acpi_ns_evaluate_by_name (pathname, &info);
- }
- else if (!handle) {
+ status = acpi_ns_evaluate_by_name(pathname, &info);
+ } else if (!handle) {
/*
* A handle is optional iff a fully qualified pathname
* is specified. Since we've already handled fully
* qualified names above, this is an error
*/
if (!pathname) {
- ACPI_DEBUG_PRINT ((ACPI_DB_ERROR,
- "Both Handle and Pathname are NULL\n"));
- }
- else {
- ACPI_DEBUG_PRINT ((ACPI_DB_ERROR,
- "Handle is NULL and Pathname is relative\n"));
+ ACPI_DEBUG_PRINT((ACPI_DB_ERROR,
+ "Both Handle and Pathname are NULL\n"));
+ } else {
+ ACPI_DEBUG_PRINT((ACPI_DB_ERROR,
+ "Handle is NULL and Pathname is relative\n"));
}
status = AE_BAD_PARAMETER;
- }
- else {
+ } else {
/*
* We get here if we have a handle -- and if we have a
* pathname it is relative. The handle will be validated
@@ -264,17 +255,15 @@ acpi_evaluate_object (
* The null pathname case means the handle is for
* the actual object to be evaluated
*/
- status = acpi_ns_evaluate_by_handle (&info);
- }
- else {
- /*
- * Both a Handle and a relative Pathname
- */
- status = acpi_ns_evaluate_relative (pathname, &info);
+ status = acpi_ns_evaluate_by_handle(&info);
+ } else {
+ /*
+ * Both a Handle and a relative Pathname
+ */
+ status = acpi_ns_evaluate_relative(pathname, &info);
}
}
-
/*
* If we are expecting a return value, and all went well above,
* copy the return value to an external object.
@@ -282,9 +271,9 @@ acpi_evaluate_object (
if (return_buffer) {
if (!info.return_object) {
return_buffer->length = 0;
- }
- else {
- if (ACPI_GET_DESCRIPTOR_TYPE (info.return_object) == ACPI_DESC_TYPE_NAMED) {
+ } else {
+ if (ACPI_GET_DESCRIPTOR_TYPE(info.return_object) ==
+ ACPI_DESC_TYPE_NAMED) {
/*
* If we received a NS Node as a return object, this means that
* the object we are evaluating has nothing interesting to
@@ -294,37 +283,43 @@ acpi_evaluate_object (
* support for various types at a later date if necessary.
*/
status = AE_TYPE;
- info.return_object = NULL; /* No need to delete a NS Node */
+ info.return_object = NULL; /* No need to delete a NS Node */
return_buffer->length = 0;
}
- if (ACPI_SUCCESS (status)) {
+ if (ACPI_SUCCESS(status)) {
/*
* Find out how large a buffer is needed
* to contain the returned object
*/
- status = acpi_ut_get_object_size (info.return_object,
- &buffer_space_needed);
- if (ACPI_SUCCESS (status)) {
+ status =
+ acpi_ut_get_object_size(info.return_object,
+ &buffer_space_needed);
+ if (ACPI_SUCCESS(status)) {
/* Validate/Allocate/Clear caller buffer */
- status = acpi_ut_initialize_buffer (return_buffer,
- buffer_space_needed);
- if (ACPI_FAILURE (status)) {
+ status =
+ acpi_ut_initialize_buffer
+ (return_buffer,
+ buffer_space_needed);
+ if (ACPI_FAILURE(status)) {
/*
* Caller's buffer is too small or a new one can't be allocated
*/
- ACPI_DEBUG_PRINT ((ACPI_DB_INFO,
- "Needed buffer size %X, %s\n",
- (u32) buffer_space_needed,
- acpi_format_exception (status)));
- }
- else {
+ ACPI_DEBUG_PRINT((ACPI_DB_INFO,
+ "Needed buffer size %X, %s\n",
+ (u32)
+ buffer_space_needed,
+ acpi_format_exception
+ (status)));
+ } else {
/*
* We have enough space for the object, build it
*/
- status = acpi_ut_copy_iobject_to_eobject (info.return_object,
- return_buffer);
+ status =
+ acpi_ut_copy_iobject_to_eobject
+ (info.return_object,
+ return_buffer);
}
}
}
@@ -336,14 +331,14 @@ acpi_evaluate_object (
* Delete the internal return object. NOTE: Interpreter
* must be locked to avoid race condition.
*/
- status2 = acpi_ex_enter_interpreter ();
- if (ACPI_SUCCESS (status2)) {
+ status2 = acpi_ex_enter_interpreter();
+ if (ACPI_SUCCESS(status2)) {
/*
* Delete the internal return object. (Or at least
* decrement the reference count by one)
*/
- acpi_ut_remove_reference (info.return_object);
- acpi_ex_exit_interpreter ();
+ acpi_ut_remove_reference(info.return_object);
+ acpi_ex_exit_interpreter();
}
}
@@ -353,13 +348,13 @@ acpi_evaluate_object (
if (info.parameters) {
/* Free the allocated parameter block */
- acpi_ut_delete_internal_object_list (info.parameters);
+ acpi_ut_delete_internal_object_list(info.parameters);
}
- return_ACPI_STATUS (status);
+ return_ACPI_STATUS(status);
}
-EXPORT_SYMBOL(acpi_evaluate_object);
+EXPORT_SYMBOL(acpi_evaluate_object);
/*******************************************************************************
*
@@ -392,26 +387,20 @@ EXPORT_SYMBOL(acpi_evaluate_object);
******************************************************************************/
acpi_status
-acpi_walk_namespace (
- acpi_object_type type,
- acpi_handle start_object,
- u32 max_depth,
- acpi_walk_callback user_function,
- void *context,
- void **return_value)
+acpi_walk_namespace(acpi_object_type type,
+ acpi_handle start_object,
+ u32 max_depth,
+ acpi_walk_callback user_function,
+ void *context, void **return_value)
{
- acpi_status status;
-
-
- ACPI_FUNCTION_TRACE ("acpi_walk_namespace");
+ acpi_status status;
+ ACPI_FUNCTION_TRACE("acpi_walk_namespace");
/* Parameter validation */
- if ((type > ACPI_TYPE_EXTERNAL_MAX) ||
- (!max_depth) ||
- (!user_function)) {
- return_ACPI_STATUS (AE_BAD_PARAMETER);
+ if ((type > ACPI_TYPE_EXTERNAL_MAX) || (!max_depth) || (!user_function)) {
+ return_ACPI_STATUS(AE_BAD_PARAMETER);
}
/*
@@ -420,20 +409,20 @@ acpi_walk_namespace (
* to the user function - since this function
* must be allowed to make Acpi calls itself.
*/
- status = acpi_ut_acquire_mutex (ACPI_MTX_NAMESPACE);
- if (ACPI_FAILURE (status)) {
- return_ACPI_STATUS (status);
+ status = acpi_ut_acquire_mutex(ACPI_MTX_NAMESPACE);
+ if (ACPI_FAILURE(status)) {
+ return_ACPI_STATUS(status);
}
- status = acpi_ns_walk_namespace (type, start_object, max_depth,
- ACPI_NS_WALK_UNLOCK,
- user_function, context, return_value);
+ status = acpi_ns_walk_namespace(type, start_object, max_depth,
+ ACPI_NS_WALK_UNLOCK,
+ user_function, context, return_value);
- (void) acpi_ut_release_mutex (ACPI_MTX_NAMESPACE);
- return_ACPI_STATUS (status);
+ (void)acpi_ut_release_mutex(ACPI_MTX_NAMESPACE);
+ return_ACPI_STATUS(status);
}
-EXPORT_SYMBOL(acpi_walk_namespace);
+EXPORT_SYMBOL(acpi_walk_namespace);
/*******************************************************************************
*
@@ -450,29 +439,26 @@ EXPORT_SYMBOL(acpi_walk_namespace);
******************************************************************************/
static acpi_status
-acpi_ns_get_device_callback (
- acpi_handle obj_handle,
- u32 nesting_level,
- void *context,
- void **return_value)
+acpi_ns_get_device_callback(acpi_handle obj_handle,
+ u32 nesting_level,
+ void *context, void **return_value)
{
- struct acpi_get_devices_info *info = context;
- acpi_status status;
- struct acpi_namespace_node *node;
- u32 flags;
- struct acpi_device_id hid;
+ struct acpi_get_devices_info *info = context;
+ acpi_status status;
+ struct acpi_namespace_node *node;
+ u32 flags;
+ struct acpi_device_id hid;
struct acpi_compatible_id_list *cid;
- acpi_native_uint i;
-
+ acpi_native_uint i;
- status = acpi_ut_acquire_mutex (ACPI_MTX_NAMESPACE);
- if (ACPI_FAILURE (status)) {
+ status = acpi_ut_acquire_mutex(ACPI_MTX_NAMESPACE);
+ if (ACPI_FAILURE(status)) {
return (status);
}
- node = acpi_ns_map_handle_to_node (obj_handle);
- status = acpi_ut_release_mutex (ACPI_MTX_NAMESPACE);
- if (ACPI_FAILURE (status)) {
+ node = acpi_ns_map_handle_to_node(obj_handle);
+ status = acpi_ut_release_mutex(ACPI_MTX_NAMESPACE);
+ if (ACPI_FAILURE(status)) {
return (status);
}
@@ -482,8 +468,8 @@ acpi_ns_get_device_callback (
/* Run _STA to determine if device is present */
- status = acpi_ut_execute_STA (node, &flags);
- if (ACPI_FAILURE (status)) {
+ status = acpi_ut_execute_STA(node, &flags);
+ if (ACPI_FAILURE(status)) {
return (AE_CTRL_DEPTH);
}
@@ -496,44 +482,43 @@ acpi_ns_get_device_callback (
/* Filter based on device HID & CID */
if (info->hid != NULL) {
- status = acpi_ut_execute_HID (node, &hid);
+ status = acpi_ut_execute_HID(node, &hid);
if (status == AE_NOT_FOUND) {
return (AE_OK);
- }
- else if (ACPI_FAILURE (status)) {
+ } else if (ACPI_FAILURE(status)) {
return (AE_CTRL_DEPTH);
}
- if (ACPI_STRNCMP (hid.value, info->hid, sizeof (hid.value)) != 0) {
+ if (ACPI_STRNCMP(hid.value, info->hid, sizeof(hid.value)) != 0) {
/* Get the list of Compatible IDs */
- status = acpi_ut_execute_CID (node, &cid);
+ status = acpi_ut_execute_CID(node, &cid);
if (status == AE_NOT_FOUND) {
return (AE_OK);
- }
- else if (ACPI_FAILURE (status)) {
+ } else if (ACPI_FAILURE(status)) {
return (AE_CTRL_DEPTH);
}
/* Walk the CID list */
for (i = 0; i < cid->count; i++) {
- if (ACPI_STRNCMP (cid->id[i].value, info->hid,
- sizeof (struct acpi_compatible_id)) != 0) {
- ACPI_MEM_FREE (cid);
+ if (ACPI_STRNCMP(cid->id[i].value, info->hid,
+ sizeof(struct
+ acpi_compatible_id)) !=
+ 0) {
+ ACPI_MEM_FREE(cid);
return (AE_OK);
}
}
- ACPI_MEM_FREE (cid);
+ ACPI_MEM_FREE(cid);
}
}
- status = info->user_function (obj_handle, nesting_level, info->context,
- return_value);
+ status = info->user_function(obj_handle, nesting_level, info->context,
+ return_value);
return (status);
}
-
/*******************************************************************************
*
* FUNCTION: acpi_get_devices
@@ -560,32 +545,28 @@ acpi_ns_get_device_callback (
******************************************************************************/
acpi_status
-acpi_get_devices (
- char *HID,
- acpi_walk_callback user_function,
- void *context,
- void **return_value)
+acpi_get_devices(char *HID,
+ acpi_walk_callback user_function,
+ void *context, void **return_value)
{
- acpi_status status;
- struct acpi_get_devices_info info;
-
-
- ACPI_FUNCTION_TRACE ("acpi_get_devices");
+ acpi_status status;
+ struct acpi_get_devices_info info;
+ ACPI_FUNCTION_TRACE("acpi_get_devices");
/* Parameter validation */
if (!user_function) {
- return_ACPI_STATUS (AE_BAD_PARAMETER);
+ return_ACPI_STATUS(AE_BAD_PARAMETER);
}
/*
* We're going to call their callback from OUR callback, so we need
* to know what it is, and their context parameter.
*/
- info.context = context;
+ info.context = context;
info.user_function = user_function;
- info.hid = HID;
+ info.hid = HID;
/*
* Lock the namespace around the walk.
@@ -593,22 +574,22 @@ acpi_get_devices (
* to the user function - since this function
* must be allowed to make Acpi calls itself.
*/
- status = acpi_ut_acquire_mutex (ACPI_MTX_NAMESPACE);
- if (ACPI_FAILURE (status)) {
- return_ACPI_STATUS (status);
+ status = acpi_ut_acquire_mutex(ACPI_MTX_NAMESPACE);
+ if (ACPI_FAILURE(status)) {
+ return_ACPI_STATUS(status);
}
- status = acpi_ns_walk_namespace (ACPI_TYPE_DEVICE,
- ACPI_ROOT_OBJECT, ACPI_UINT32_MAX,
- ACPI_NS_WALK_UNLOCK,
- acpi_ns_get_device_callback, &info,
- return_value);
+ status = acpi_ns_walk_namespace(ACPI_TYPE_DEVICE,
+ ACPI_ROOT_OBJECT, ACPI_UINT32_MAX,
+ ACPI_NS_WALK_UNLOCK,
+ acpi_ns_get_device_callback, &info,
+ return_value);
- (void) acpi_ut_release_mutex (ACPI_MTX_NAMESPACE);
- return_ACPI_STATUS (status);
+ (void)acpi_ut_release_mutex(ACPI_MTX_NAMESPACE);
+ return_ACPI_STATUS(status);
}
-EXPORT_SYMBOL(acpi_get_devices);
+EXPORT_SYMBOL(acpi_get_devices);
/*******************************************************************************
*
@@ -625,44 +606,38 @@ EXPORT_SYMBOL(acpi_get_devices);
******************************************************************************/
acpi_status
-acpi_attach_data (
- acpi_handle obj_handle,
- acpi_object_handler handler,
- void *data)
+acpi_attach_data(acpi_handle obj_handle,
+ acpi_object_handler handler, void *data)
{
- struct acpi_namespace_node *node;
- acpi_status status;
-
+ struct acpi_namespace_node *node;
+ acpi_status status;
/* Parameter validation */
- if (!obj_handle ||
- !handler ||
- !data) {
+ if (!obj_handle || !handler || !data) {
return (AE_BAD_PARAMETER);
}
- status = acpi_ut_acquire_mutex (ACPI_MTX_NAMESPACE);
- if (ACPI_FAILURE (status)) {
+ status = acpi_ut_acquire_mutex(ACPI_MTX_NAMESPACE);
+ if (ACPI_FAILURE(status)) {
return (status);
}
/* Convert and validate the handle */
- node = acpi_ns_map_handle_to_node (obj_handle);
+ node = acpi_ns_map_handle_to_node(obj_handle);
if (!node) {
status = AE_BAD_PARAMETER;
goto unlock_and_exit;
}
- status = acpi_ns_attach_data (node, handler, data);
+ status = acpi_ns_attach_data(node, handler, data);
-unlock_and_exit:
- (void) acpi_ut_release_mutex (ACPI_MTX_NAMESPACE);
+ unlock_and_exit:
+ (void)acpi_ut_release_mutex(ACPI_MTX_NAMESPACE);
return (status);
}
-
/*******************************************************************************
*
* FUNCTION: acpi_detach_data
@@ -677,42 +652,37 @@ unlock_and_exit:
******************************************************************************/
acpi_status
-acpi_detach_data (
- acpi_handle obj_handle,
- acpi_object_handler handler)
+acpi_detach_data(acpi_handle obj_handle, acpi_object_handler handler)
{
- struct acpi_namespace_node *node;
- acpi_status status;
-
+ struct acpi_namespace_node *node;
+ acpi_status status;
/* Parameter validation */
- if (!obj_handle ||
- !handler) {
+ if (!obj_handle || !handler) {
return (AE_BAD_PARAMETER);
}
- status = acpi_ut_acquire_mutex (ACPI_MTX_NAMESPACE);
- if (ACPI_FAILURE (status)) {
+ status = acpi_ut_acquire_mutex(ACPI_MTX_NAMESPACE);
+ if (ACPI_FAILURE(status)) {
return (status);
}
/* Convert and validate the handle */
- node = acpi_ns_map_handle_to_node (obj_handle);
+ node = acpi_ns_map_handle_to_node(obj_handle);
if (!node) {
status = AE_BAD_PARAMETER;
goto unlock_and_exit;
}
- status = acpi_ns_detach_data (node, handler);
+ status = acpi_ns_detach_data(node, handler);
-unlock_and_exit:
- (void) acpi_ut_release_mutex (ACPI_MTX_NAMESPACE);
+ unlock_and_exit:
+ (void)acpi_ut_release_mutex(ACPI_MTX_NAMESPACE);
return (status);
}
-
/*******************************************************************************
*
* FUNCTION: acpi_get_data
@@ -728,41 +698,33 @@ unlock_and_exit:
******************************************************************************/
acpi_status
-acpi_get_data (
- acpi_handle obj_handle,
- acpi_object_handler handler,
- void **data)
+acpi_get_data(acpi_handle obj_handle, acpi_object_handler handler, void **data)
{
- struct acpi_namespace_node *node;
- acpi_status status;
-
+ struct acpi_namespace_node *node;
+ acpi_status status;
/* Parameter validation */
- if (!obj_handle ||
- !handler ||
- !data) {
+ if (!obj_handle || !handler || !data) {
return (AE_BAD_PARAMETER);
}
- status = acpi_ut_acquire_mutex (ACPI_MTX_NAMESPACE);
- if (ACPI_FAILURE (status)) {
+ status = acpi_ut_acquire_mutex(ACPI_MTX_NAMESPACE);
+ if (ACPI_FAILURE(status)) {
return (status);
}
/* Convert and validate the handle */
- node = acpi_ns_map_handle_to_node (obj_handle);
+ node = acpi_ns_map_handle_to_node(obj_handle);
if (!node) {
status = AE_BAD_PARAMETER;
goto unlock_and_exit;
}
- status = acpi_ns_get_attached_data (node, handler, data);
+ status = acpi_ns_get_attached_data(node, handler, data);
-unlock_and_exit:
- (void) acpi_ut_release_mutex (ACPI_MTX_NAMESPACE);
+ unlock_and_exit:
+ (void)acpi_ut_release_mutex(ACPI_MTX_NAMESPACE);
return (status);
}
-
-
diff --git a/drivers/acpi/namespace/nsxfname.c b/drivers/acpi/namespace/nsxfname.c
index 8d097914c49a..6b5f8d4481d1 100644
--- a/drivers/acpi/namespace/nsxfname.c
+++ b/drivers/acpi/namespace/nsxfname.c
@@ -47,10 +47,8 @@
#include <acpi/acpi.h>
#include <acpi/acnamesp.h>
-
#define _COMPONENT ACPI_NAMESPACE
- ACPI_MODULE_NAME ("nsxfname")
-
+ACPI_MODULE_NAME("nsxfname")
/******************************************************************************
*
@@ -69,20 +67,15 @@
* namespace handle.
*
******************************************************************************/
-
acpi_status
-acpi_get_handle (
- acpi_handle parent,
- acpi_string pathname,
- acpi_handle *ret_handle)
+acpi_get_handle(acpi_handle parent,
+ acpi_string pathname, acpi_handle * ret_handle)
{
- acpi_status status;
- struct acpi_namespace_node *node = NULL;
- struct acpi_namespace_node *prefix_node = NULL;
-
-
- ACPI_FUNCTION_ENTRY ();
+ acpi_status status;
+ struct acpi_namespace_node *node = NULL;
+ struct acpi_namespace_node *prefix_node = NULL;
+ ACPI_FUNCTION_ENTRY();
/* Parameter Validation */
@@ -93,45 +86,47 @@ acpi_get_handle (
/* Convert a parent handle to a prefix node */
if (parent) {
- status = acpi_ut_acquire_mutex (ACPI_MTX_NAMESPACE);
- if (ACPI_FAILURE (status)) {
+ status = acpi_ut_acquire_mutex(ACPI_MTX_NAMESPACE);
+ if (ACPI_FAILURE(status)) {
return (status);
}
- prefix_node = acpi_ns_map_handle_to_node (parent);
+ prefix_node = acpi_ns_map_handle_to_node(parent);
if (!prefix_node) {
- (void) acpi_ut_release_mutex (ACPI_MTX_NAMESPACE);
+ (void)acpi_ut_release_mutex(ACPI_MTX_NAMESPACE);
return (AE_BAD_PARAMETER);
}
- status = acpi_ut_release_mutex (ACPI_MTX_NAMESPACE);
- if (ACPI_FAILURE (status)) {
+ status = acpi_ut_release_mutex(ACPI_MTX_NAMESPACE);
+ if (ACPI_FAILURE(status)) {
return (status);
}
}
/* Special case for root, since we can't search for it */
- if (ACPI_STRCMP (pathname, ACPI_NS_ROOT_PATH) == 0) {
- *ret_handle = acpi_ns_convert_entry_to_handle (acpi_gbl_root_node);
+ if (ACPI_STRCMP(pathname, ACPI_NS_ROOT_PATH) == 0) {
+ *ret_handle =
+ acpi_ns_convert_entry_to_handle(acpi_gbl_root_node);
return (AE_OK);
}
/*
* Find the Node and convert to a handle
*/
- status = acpi_ns_get_node_by_path (pathname, prefix_node, ACPI_NS_NO_UPSEARCH,
- &node);
+ status =
+ acpi_ns_get_node_by_path(pathname, prefix_node, ACPI_NS_NO_UPSEARCH,
+ &node);
*ret_handle = NULL;
- if (ACPI_SUCCESS (status)) {
- *ret_handle = acpi_ns_convert_entry_to_handle (node);
+ if (ACPI_SUCCESS(status)) {
+ *ret_handle = acpi_ns_convert_entry_to_handle(node);
}
return (status);
}
-EXPORT_SYMBOL(acpi_get_handle);
+EXPORT_SYMBOL(acpi_get_handle);
/******************************************************************************
*
@@ -150,14 +145,10 @@ EXPORT_SYMBOL(acpi_get_handle);
******************************************************************************/
acpi_status
-acpi_get_name (
- acpi_handle handle,
- u32 name_type,
- struct acpi_buffer *buffer)
+acpi_get_name(acpi_handle handle, u32 name_type, struct acpi_buffer * buffer)
{
- acpi_status status;
- struct acpi_namespace_node *node;
-
+ acpi_status status;
+ struct acpi_namespace_node *node;
/* Parameter validation */
@@ -165,15 +156,15 @@ acpi_get_name (
return (AE_BAD_PARAMETER);
}
- status = acpi_ut_validate_buffer (buffer);
- if (ACPI_FAILURE (status)) {
+ status = acpi_ut_validate_buffer(buffer);
+ if (ACPI_FAILURE(status)) {
return (status);
}
if (name_type == ACPI_FULL_PATHNAME) {
/* Get the full pathname (From the namespace root) */
- status = acpi_ns_handle_to_pathname (handle, buffer);
+ status = acpi_ns_handle_to_pathname(handle, buffer);
return (status);
}
@@ -181,12 +172,12 @@ acpi_get_name (
* Wants the single segment ACPI name.
* Validate handle and convert to a namespace Node
*/
- status = acpi_ut_acquire_mutex (ACPI_MTX_NAMESPACE);
- if (ACPI_FAILURE (status)) {
+ status = acpi_ut_acquire_mutex(ACPI_MTX_NAMESPACE);
+ if (ACPI_FAILURE(status)) {
return (status);
}
- node = acpi_ns_map_handle_to_node (handle);
+ node = acpi_ns_map_handle_to_node(handle);
if (!node) {
status = AE_BAD_PARAMETER;
goto unlock_and_exit;
@@ -194,26 +185,25 @@ acpi_get_name (
/* Validate/Allocate/Clear caller buffer */
- status = acpi_ut_initialize_buffer (buffer, ACPI_PATH_SEGMENT_LENGTH);
- if (ACPI_FAILURE (status)) {
+ status = acpi_ut_initialize_buffer(buffer, ACPI_PATH_SEGMENT_LENGTH);
+ if (ACPI_FAILURE(status)) {
goto unlock_and_exit;
}
/* Just copy the ACPI name from the Node and zero terminate it */
- ACPI_STRNCPY (buffer->pointer, acpi_ut_get_node_name (node),
- ACPI_NAME_SIZE);
- ((char *) buffer->pointer) [ACPI_NAME_SIZE] = 0;
+ ACPI_STRNCPY(buffer->pointer, acpi_ut_get_node_name(node),
+ ACPI_NAME_SIZE);
+ ((char *)buffer->pointer)[ACPI_NAME_SIZE] = 0;
status = AE_OK;
+ unlock_and_exit:
-unlock_and_exit:
-
- (void) acpi_ut_release_mutex (ACPI_MTX_NAMESPACE);
+ (void)acpi_ut_release_mutex(ACPI_MTX_NAMESPACE);
return (status);
}
-EXPORT_SYMBOL(acpi_get_name);
+EXPORT_SYMBOL(acpi_get_name);
/******************************************************************************
*
@@ -231,17 +221,14 @@ EXPORT_SYMBOL(acpi_get_name);
******************************************************************************/
acpi_status
-acpi_get_object_info (
- acpi_handle handle,
- struct acpi_buffer *buffer)
+acpi_get_object_info(acpi_handle handle, struct acpi_buffer * buffer)
{
- acpi_status status;
- struct acpi_namespace_node *node;
- struct acpi_device_info *info;
- struct acpi_device_info *return_info;
+ acpi_status status;
+ struct acpi_namespace_node *node;
+ struct acpi_device_info *info;
+ struct acpi_device_info *return_info;
struct acpi_compatible_id_list *cid_list = NULL;
- acpi_size size;
-
+ acpi_size size;
/* Parameter validation */
@@ -249,37 +236,37 @@ acpi_get_object_info (
return (AE_BAD_PARAMETER);
}
- status = acpi_ut_validate_buffer (buffer);
- if (ACPI_FAILURE (status)) {
+ status = acpi_ut_validate_buffer(buffer);
+ if (ACPI_FAILURE(status)) {
return (status);
}
- info = ACPI_MEM_CALLOCATE (sizeof (struct acpi_device_info));
+ info = ACPI_MEM_CALLOCATE(sizeof(struct acpi_device_info));
if (!info) {
return (AE_NO_MEMORY);
}
- status = acpi_ut_acquire_mutex (ACPI_MTX_NAMESPACE);
- if (ACPI_FAILURE (status)) {
+ status = acpi_ut_acquire_mutex(ACPI_MTX_NAMESPACE);
+ if (ACPI_FAILURE(status)) {
goto cleanup;
}
- node = acpi_ns_map_handle_to_node (handle);
+ node = acpi_ns_map_handle_to_node(handle);
if (!node) {
- (void) acpi_ut_release_mutex (ACPI_MTX_NAMESPACE);
+ (void)acpi_ut_release_mutex(ACPI_MTX_NAMESPACE);
goto cleanup;
}
/* Init return structure */
- size = sizeof (struct acpi_device_info);
+ size = sizeof(struct acpi_device_info);
- info->type = node->type;
- info->name = node->name.integer;
+ info->type = node->type;
+ info->name = node->name.integer;
info->valid = 0;
- status = acpi_ut_release_mutex (ACPI_MTX_NAMESPACE);
- if (ACPI_FAILURE (status)) {
+ status = acpi_ut_release_mutex(ACPI_MTX_NAMESPACE);
+ if (ACPI_FAILURE(status)) {
goto cleanup;
}
@@ -297,73 +284,73 @@ acpi_get_object_info (
/* Execute the Device._HID method */
- status = acpi_ut_execute_HID (node, &info->hardware_id);
- if (ACPI_SUCCESS (status)) {
+ status = acpi_ut_execute_HID(node, &info->hardware_id);
+ if (ACPI_SUCCESS(status)) {
info->valid |= ACPI_VALID_HID;
}
/* Execute the Device._UID method */
- status = acpi_ut_execute_UID (node, &info->unique_id);
- if (ACPI_SUCCESS (status)) {
+ status = acpi_ut_execute_UID(node, &info->unique_id);
+ if (ACPI_SUCCESS(status)) {
info->valid |= ACPI_VALID_UID;
}
/* Execute the Device._CID method */
- status = acpi_ut_execute_CID (node, &cid_list);
- if (ACPI_SUCCESS (status)) {
+ status = acpi_ut_execute_CID(node, &cid_list);
+ if (ACPI_SUCCESS(status)) {
size += ((acpi_size) cid_list->count - 1) *
- sizeof (struct acpi_compatible_id);
+ sizeof(struct acpi_compatible_id);
info->valid |= ACPI_VALID_CID;
}
/* Execute the Device._STA method */
- status = acpi_ut_execute_STA (node, &info->current_status);
- if (ACPI_SUCCESS (status)) {
+ status = acpi_ut_execute_STA(node, &info->current_status);
+ if (ACPI_SUCCESS(status)) {
info->valid |= ACPI_VALID_STA;
}
/* Execute the Device._ADR method */
- status = acpi_ut_evaluate_numeric_object (METHOD_NAME__ADR, node,
- &info->address);
- if (ACPI_SUCCESS (status)) {
+ status = acpi_ut_evaluate_numeric_object(METHOD_NAME__ADR, node,
+ &info->address);
+ if (ACPI_SUCCESS(status)) {
info->valid |= ACPI_VALID_ADR;
}
/* Execute the Device._sx_d methods */
- status = acpi_ut_execute_sxds (node, info->highest_dstates);
- if (ACPI_SUCCESS (status)) {
+ status = acpi_ut_execute_sxds(node, info->highest_dstates);
+ if (ACPI_SUCCESS(status)) {
info->valid |= ACPI_VALID_SXDS;
}
}
/* Validate/Allocate/Clear caller buffer */
- status = acpi_ut_initialize_buffer (buffer, size);
- if (ACPI_FAILURE (status)) {
+ status = acpi_ut_initialize_buffer(buffer, size);
+ if (ACPI_FAILURE(status)) {
goto cleanup;
}
/* Populate the return buffer */
return_info = buffer->pointer;
- ACPI_MEMCPY (return_info, info, sizeof (struct acpi_device_info));
+ ACPI_MEMCPY(return_info, info, sizeof(struct acpi_device_info));
if (cid_list) {
- ACPI_MEMCPY (&return_info->compatibility_id, cid_list, cid_list->size);
+ ACPI_MEMCPY(&return_info->compatibility_id, cid_list,
+ cid_list->size);
}
-
-cleanup:
- ACPI_MEM_FREE (info);
+ cleanup:
+ ACPI_MEM_FREE(info);
if (cid_list) {
- ACPI_MEM_FREE (cid_list);
+ ACPI_MEM_FREE(cid_list);
}
return (status);
}
-EXPORT_SYMBOL(acpi_get_object_info);
+EXPORT_SYMBOL(acpi_get_object_info);
diff --git a/drivers/acpi/namespace/nsxfobj.c b/drivers/acpi/namespace/nsxfobj.c
index 363e1f6cfb18..0856d42e6909 100644
--- a/drivers/acpi/namespace/nsxfobj.c
+++ b/drivers/acpi/namespace/nsxfobj.c
@@ -47,9 +47,8 @@
#include <acpi/acpi.h>
#include <acpi/acnamesp.h>
-
#define _COMPONENT ACPI_NAMESPACE
- ACPI_MODULE_NAME ("nsxfobj")
+ACPI_MODULE_NAME("nsxfobj")
/*******************************************************************************
*
@@ -63,15 +62,10 @@
* DESCRIPTION: This routine returns the type associatd with a particular handle
*
******************************************************************************/
-
-acpi_status
-acpi_get_type (
- acpi_handle handle,
- acpi_object_type *ret_type)
+acpi_status acpi_get_type(acpi_handle handle, acpi_object_type * ret_type)
{
- struct acpi_namespace_node *node;
- acpi_status status;
-
+ struct acpi_namespace_node *node;
+ acpi_status status;
/* Parameter Validation */
@@ -88,27 +82,26 @@ acpi_get_type (
return (AE_OK);
}
- status = acpi_ut_acquire_mutex (ACPI_MTX_NAMESPACE);
- if (ACPI_FAILURE (status)) {
+ status = acpi_ut_acquire_mutex(ACPI_MTX_NAMESPACE);
+ if (ACPI_FAILURE(status)) {
return (status);
}
/* Convert and validate the handle */
- node = acpi_ns_map_handle_to_node (handle);
+ node = acpi_ns_map_handle_to_node(handle);
if (!node) {
- (void) acpi_ut_release_mutex (ACPI_MTX_NAMESPACE);
+ (void)acpi_ut_release_mutex(ACPI_MTX_NAMESPACE);
return (AE_BAD_PARAMETER);
}
*ret_type = node->type;
-
- status = acpi_ut_release_mutex (ACPI_MTX_NAMESPACE);
+ status = acpi_ut_release_mutex(ACPI_MTX_NAMESPACE);
return (status);
}
-EXPORT_SYMBOL(acpi_get_type);
+EXPORT_SYMBOL(acpi_get_type);
/*******************************************************************************
*
@@ -124,14 +117,10 @@ EXPORT_SYMBOL(acpi_get_type);
*
******************************************************************************/
-acpi_status
-acpi_get_parent (
- acpi_handle handle,
- acpi_handle *ret_handle)
+acpi_status acpi_get_parent(acpi_handle handle, acpi_handle * ret_handle)
{
- struct acpi_namespace_node *node;
- acpi_status status;
-
+ struct acpi_namespace_node *node;
+ acpi_status status;
if (!ret_handle) {
return (AE_BAD_PARAMETER);
@@ -143,14 +132,14 @@ acpi_get_parent (
return (AE_NULL_ENTRY);
}
- status = acpi_ut_acquire_mutex (ACPI_MTX_NAMESPACE);
- if (ACPI_FAILURE (status)) {
+ status = acpi_ut_acquire_mutex(ACPI_MTX_NAMESPACE);
+ if (ACPI_FAILURE(status)) {
return (status);
}
/* Convert and validate the handle */
- node = acpi_ns_map_handle_to_node (handle);
+ node = acpi_ns_map_handle_to_node(handle);
if (!node) {
status = AE_BAD_PARAMETER;
goto unlock_and_exit;
@@ -159,22 +148,21 @@ acpi_get_parent (
/* Get the parent entry */
*ret_handle =
- acpi_ns_convert_entry_to_handle (acpi_ns_get_parent_node (node));
+ acpi_ns_convert_entry_to_handle(acpi_ns_get_parent_node(node));
/* Return exception if parent is null */
- if (!acpi_ns_get_parent_node (node)) {
+ if (!acpi_ns_get_parent_node(node)) {
status = AE_NULL_ENTRY;
}
+ unlock_and_exit:
-unlock_and_exit:
-
- (void) acpi_ut_release_mutex (ACPI_MTX_NAMESPACE);
+ (void)acpi_ut_release_mutex(ACPI_MTX_NAMESPACE);
return (status);
}
-EXPORT_SYMBOL(acpi_get_parent);
+EXPORT_SYMBOL(acpi_get_parent);
/*******************************************************************************
*
@@ -195,17 +183,14 @@ EXPORT_SYMBOL(acpi_get_parent);
******************************************************************************/
acpi_status
-acpi_get_next_object (
- acpi_object_type type,
- acpi_handle parent,
- acpi_handle child,
- acpi_handle *ret_handle)
+acpi_get_next_object(acpi_object_type type,
+ acpi_handle parent,
+ acpi_handle child, acpi_handle * ret_handle)
{
- acpi_status status;
- struct acpi_namespace_node *node;
- struct acpi_namespace_node *parent_node = NULL;
- struct acpi_namespace_node *child_node = NULL;
-
+ acpi_status status;
+ struct acpi_namespace_node *node;
+ struct acpi_namespace_node *parent_node = NULL;
+ struct acpi_namespace_node *child_node = NULL;
/* Parameter validation */
@@ -213,8 +198,8 @@ acpi_get_next_object (
return (AE_BAD_PARAMETER);
}
- status = acpi_ut_acquire_mutex (ACPI_MTX_NAMESPACE);
- if (ACPI_FAILURE (status)) {
+ status = acpi_ut_acquire_mutex(ACPI_MTX_NAMESPACE);
+ if (ACPI_FAILURE(status)) {
return (status);
}
@@ -223,17 +208,16 @@ acpi_get_next_object (
if (!child) {
/* Start search at the beginning of the specified scope */
- parent_node = acpi_ns_map_handle_to_node (parent);
+ parent_node = acpi_ns_map_handle_to_node(parent);
if (!parent_node) {
status = AE_BAD_PARAMETER;
goto unlock_and_exit;
}
- }
- else {
+ } else {
/* Non-null handle, ignore the parent */
/* Convert and validate the handle */
- child_node = acpi_ns_map_handle_to_node (child);
+ child_node = acpi_ns_map_handle_to_node(child);
if (!child_node) {
status = AE_BAD_PARAMETER;
goto unlock_and_exit;
@@ -242,20 +226,19 @@ acpi_get_next_object (
/* Internal function does the real work */
- node = acpi_ns_get_next_node (type, parent_node, child_node);
+ node = acpi_ns_get_next_node(type, parent_node, child_node);
if (!node) {
status = AE_NOT_FOUND;
goto unlock_and_exit;
}
if (ret_handle) {
- *ret_handle = acpi_ns_convert_entry_to_handle (node);
+ *ret_handle = acpi_ns_convert_entry_to_handle(node);
}
+ unlock_and_exit:
-unlock_and_exit:
-
- (void) acpi_ut_release_mutex (ACPI_MTX_NAMESPACE);
+ (void)acpi_ut_release_mutex(ACPI_MTX_NAMESPACE);
return (status);
}