X-Git-Url: http://git.onelab.eu/?a=blobdiff_plain;f=drivers%2Facpi%2Fnamespace%2Fnsxfobj.c;h=a18b1c223129820da9513a78be11d1cbb1eb73e2;hb=97bf2856c6014879bd04983a3e9dfcdac1e7fe85;hp=19acf32674b94e13872a6e0016f7c485ad2e9bda;hpb=6a77f38946aaee1cd85eeec6cf4229b204c15071;p=linux-2.6.git diff --git a/drivers/acpi/namespace/nsxfobj.c b/drivers/acpi/namespace/nsxfobj.c index 19acf3267..a18b1c223 100644 --- a/drivers/acpi/namespace/nsxfobj.c +++ b/drivers/acpi/namespace/nsxfobj.c @@ -6,7 +6,7 @@ ******************************************************************************/ /* - * Copyright (C) 2000 - 2005, R. Byron Moore + * Copyright (C) 2000 - 2006, R. Byron Moore * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -42,36 +42,72 @@ * POSSIBILITY OF SUCH DAMAGES. */ -#include - #include #include - #define _COMPONENT ACPI_NAMESPACE - ACPI_MODULE_NAME ("nsxfobj") +ACPI_MODULE_NAME("nsxfobj") + +/******************************************************************************* + * + * FUNCTION: acpi_get_id + * + * PARAMETERS: Handle - Handle of object whose id is desired + * ret_id - Where the id will be placed + * + * RETURN: Status + * + * DESCRIPTION: This routine returns the owner id associated with a handle + * + ******************************************************************************/ +acpi_status acpi_get_id(acpi_handle handle, acpi_owner_id * ret_id) +{ + struct acpi_namespace_node *node; + acpi_status status; + + /* Parameter Validation */ + + if (!ret_id) { + return (AE_BAD_PARAMETER); + } + + 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); + if (!node) { + (void)acpi_ut_release_mutex(ACPI_MTX_NAMESPACE); + return (AE_BAD_PARAMETER); + } + + *ret_id = node->owner_id; + + status = acpi_ut_release_mutex(ACPI_MTX_NAMESPACE); + return (status); +} + +ACPI_EXPORT_SYMBOL(acpi_get_id) /******************************************************************************* * * FUNCTION: acpi_get_type * * PARAMETERS: Handle - Handle of object whose type is desired - * *ret_type - Where the type will be placed + * ret_type - Where the type will be placed * * RETURN: Status * * 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 +124,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); +ACPI_EXPORT_SYMBOL(acpi_get_type) /******************************************************************************* * @@ -123,15 +158,10 @@ EXPORT_SYMBOL(acpi_get_type); * Handle. * ******************************************************************************/ - -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 +173,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 +189,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); +ACPI_EXPORT_SYMBOL(acpi_get_parent) /******************************************************************************* * @@ -193,19 +222,15 @@ EXPORT_SYMBOL(acpi_get_parent); * Scope is returned. * ******************************************************************************/ - 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,27 +238,27 @@ 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); } /* If null handle, use the parent */ 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,21 +267,20 @@ 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); } -EXPORT_SYMBOL(acpi_get_next_object); +ACPI_EXPORT_SYMBOL(acpi_get_next_object)