X-Git-Url: https://git.openpandora.org/cgi-bin/gitweb.cgi?a=blobdiff_plain;f=drivers%2Facpi%2Fnamespace%2Fnsxfname.c;h=b489781b22a85e616e7bdb3c6a1b64d43e041037;hb=58a3bb59973e33a428d72fa530a3d1d81feb0e8f;hp=8cd8675a47c0403c765c640f7b021b43fa89327a;hpb=01d206a7c1167639f6ca6dac22140fbdca017558;p=pandora-kernel.git diff --git a/drivers/acpi/namespace/nsxfname.c b/drivers/acpi/namespace/nsxfname.c index 8cd8675a47c0..b489781b22a8 100644 --- a/drivers/acpi/namespace/nsxfname.c +++ b/drivers/acpi/namespace/nsxfname.c @@ -6,7 +6,7 @@ *****************************************************************************/ /* - * Copyright (C) 2000 - 2006, R. Byron Moore + * Copyright (C) 2000 - 2007, R. Byron Moore * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -42,8 +42,6 @@ * POSSIBILITY OF SUCH DAMAGES. */ -#include - #include #include @@ -86,39 +84,41 @@ acpi_get_handle(acpi_handle parent, /* Convert a parent handle to a prefix node */ if (parent) { - status = acpi_ut_acquire_mutex(ACPI_MTX_NAMESPACE); - if (ACPI_FAILURE(status)) { - return (status); - } - prefix_node = acpi_ns_map_handle_to_node(parent); if (!prefix_node) { - (void)acpi_ut_release_mutex(ACPI_MTX_NAMESPACE); return (AE_BAD_PARAMETER); } + } + + /* + * Valid cases are: + * 1) Fully qualified pathname + * 2) Parent + Relative pathname + * + * Error for + */ + if (acpi_ns_valid_root_prefix(pathname[0])) { + + /* Pathname is fully qualified (starts with '\') */ + + /* Special case for root-only, since we can't search for it */ - status = acpi_ut_release_mutex(ACPI_MTX_NAMESPACE); - if (ACPI_FAILURE(status)) { - return (status); + if (!ACPI_STRCMP(pathname, ACPI_NS_ROOT_PATH)) { + *ret_handle = + acpi_ns_convert_entry_to_handle(acpi_gbl_root_node); + return (AE_OK); } - } + } else if (!prefix_node) { - /* Special case for root, since we can't search for it */ + /* Relative path with null prefix is disallowed */ - if (ACPI_STRCMP(pathname, ACPI_NS_ROOT_PATH) == 0) { - *ret_handle = - acpi_ns_convert_entry_to_handle(acpi_gbl_root_node); - return (AE_OK); + return (AE_BAD_PARAMETER); } - /* - * Find the Node and convert to a handle - */ - status = - acpi_ns_get_node_by_path(pathname, prefix_node, ACPI_NS_NO_UPSEARCH, - &node); + /* Find the Node and convert to a handle */ - *ret_handle = NULL; + status = + acpi_ns_get_node(prefix_node, pathname, ACPI_NS_NO_UPSEARCH, &node); if (ACPI_SUCCESS(status)) { *ret_handle = acpi_ns_convert_entry_to_handle(node); } @@ -126,7 +126,7 @@ acpi_get_handle(acpi_handle parent, return (status); } -EXPORT_SYMBOL(acpi_get_handle); +ACPI_EXPORT_SYMBOL(acpi_get_handle) /****************************************************************************** * @@ -143,7 +143,6 @@ EXPORT_SYMBOL(acpi_get_handle); * complementary functions. * ******************************************************************************/ - acpi_status acpi_get_name(acpi_handle handle, u32 name_type, struct acpi_buffer * buffer) { @@ -162,6 +161,7 @@ acpi_get_name(acpi_handle handle, u32 name_type, struct acpi_buffer * buffer) } if (name_type == ACPI_FULL_PATHNAME) { + /* Get the full pathname (From the namespace root) */ status = acpi_ns_handle_to_pathname(handle, buffer); @@ -203,7 +203,7 @@ acpi_get_name(acpi_handle handle, u32 name_type, struct acpi_buffer * buffer) return (status); } -EXPORT_SYMBOL(acpi_get_name); +ACPI_EXPORT_SYMBOL(acpi_get_name) /****************************************************************************** * @@ -219,7 +219,6 @@ EXPORT_SYMBOL(acpi_get_name); * control methods (Such as in the case of a device.) * ******************************************************************************/ - acpi_status acpi_get_object_info(acpi_handle handle, struct acpi_buffer * buffer) { @@ -241,7 +240,7 @@ acpi_get_object_info(acpi_handle handle, struct acpi_buffer * buffer) return (status); } - info = ACPI_MEM_CALLOCATE(sizeof(struct acpi_device_info)); + info = ACPI_ALLOCATE_ZEROED(sizeof(struct acpi_device_info)); if (!info) { return (AE_NO_MEMORY); } @@ -345,11 +344,11 @@ acpi_get_object_info(acpi_handle handle, struct acpi_buffer * buffer) } cleanup: - ACPI_MEM_FREE(info); + ACPI_FREE(info); if (cid_list) { - ACPI_MEM_FREE(cid_list); + ACPI_FREE(cid_list); } return (status); } -EXPORT_SYMBOL(acpi_get_object_info); +ACPI_EXPORT_SYMBOL(acpi_get_object_info)