aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/acpi/acpica
diff options
context:
space:
mode:
authorBob Moore <robert.moore@intel.com>2009-12-11 01:57:00 -0500
committerLen Brown <len.brown@intel.com>2009-12-15 17:29:35 -0500
commitf24b664dc44a4ab4df61db2258cea298eeb43a8e (patch)
treeb31ad7e9dd77da75e0358e4359b0cee164426595 /drivers/acpi/acpica
parent34c39c755347c1ca3d06284bad2273c6a9c3108a (diff)
ACPICA: Update internal namespace node/handle interfaces
This change deletes the unnecessary acpi_ns_convert_entry_to_handle interface and renames the acpi_ns_map_handle_to_node interface to acpi_ns_validate_handle. ACPICA BZ 798. http://www.acpica.org/bugzilla/show_bug.cgi?id=798 Signed-off-by: Bob Moore <robert.moore@intel.com> Signed-off-by: Lin Ming <ming.m.lin@intel.com> Signed-off-by: Len Brown <len.brown@intel.com>
Diffstat (limited to 'drivers/acpi/acpica')
-rw-r--r--drivers/acpi/acpica/acnamesp.h4
-rw-r--r--drivers/acpi/acpica/evregion.c4
-rw-r--r--drivers/acpi/acpica/evxface.c4
-rw-r--r--drivers/acpi/acpica/evxfevnt.c4
-rw-r--r--drivers/acpi/acpica/evxfregn.c4
-rw-r--r--drivers/acpi/acpica/nsdump.c2
-rw-r--r--drivers/acpi/acpica/nsnames.c2
-rw-r--r--drivers/acpi/acpica/nsutils.c57
-rw-r--r--drivers/acpi/acpica/nsxfeval.c10
-rw-r--r--drivers/acpi/acpica/nsxfname.c10
-rw-r--r--drivers/acpi/acpica/nsxfobj.c14
-rw-r--r--drivers/acpi/acpica/rsxface.c2
12 files changed, 40 insertions, 77 deletions
diff --git a/drivers/acpi/acpica/acnamesp.h b/drivers/acpi/acpica/acnamesp.h
index ab83919dda61..14cef45bd6c4 100644
--- a/drivers/acpi/acpica/acnamesp.h
+++ b/drivers/acpi/acpica/acnamesp.h
@@ -354,9 +354,7 @@ acpi_ns_externalize_name(u32 internal_name_length,
354 const char *internal_name, 354 const char *internal_name,
355 u32 * converted_name_length, char **converted_name); 355 u32 * converted_name_length, char **converted_name);
356 356
357struct acpi_namespace_node *acpi_ns_map_handle_to_node(acpi_handle handle); 357struct acpi_namespace_node *acpi_ns_validate_handle(acpi_handle handle);
358
359acpi_handle acpi_ns_convert_entry_to_handle(struct acpi_namespace_node *node);
360 358
361void acpi_ns_terminate(void); 359void acpi_ns_terminate(void);
362 360
diff --git a/drivers/acpi/acpica/evregion.c b/drivers/acpi/acpica/evregion.c
index 0bc807c33a56..5336d911fbf0 100644
--- a/drivers/acpi/acpica/evregion.c
+++ b/drivers/acpi/acpica/evregion.c
@@ -718,7 +718,7 @@ acpi_ev_install_handler(acpi_handle obj_handle,
718 718
719 /* Convert and validate the device handle */ 719 /* Convert and validate the device handle */
720 720
721 node = acpi_ns_map_handle_to_node(obj_handle); 721 node = acpi_ns_validate_handle(obj_handle);
722 if (!node) { 722 if (!node) {
723 return (AE_BAD_PARAMETER); 723 return (AE_BAD_PARAMETER);
724 } 724 }
@@ -1087,7 +1087,7 @@ acpi_ev_reg_run(acpi_handle obj_handle,
1087 1087
1088 /* Convert and validate the device handle */ 1088 /* Convert and validate the device handle */
1089 1089
1090 node = acpi_ns_map_handle_to_node(obj_handle); 1090 node = acpi_ns_validate_handle(obj_handle);
1091 if (!node) { 1091 if (!node) {
1092 return (AE_BAD_PARAMETER); 1092 return (AE_BAD_PARAMETER);
1093 } 1093 }
diff --git a/drivers/acpi/acpica/evxface.c b/drivers/acpi/acpica/evxface.c
index 10b8543dd466..2fe0809d4eb2 100644
--- a/drivers/acpi/acpica/evxface.c
+++ b/drivers/acpi/acpica/evxface.c
@@ -259,7 +259,7 @@ acpi_install_notify_handler(acpi_handle device,
259 259
260 /* Convert and validate the device handle */ 260 /* Convert and validate the device handle */
261 261
262 node = acpi_ns_map_handle_to_node(device); 262 node = acpi_ns_validate_handle(device);
263 if (!node) { 263 if (!node) {
264 status = AE_BAD_PARAMETER; 264 status = AE_BAD_PARAMETER;
265 goto unlock_and_exit; 265 goto unlock_and_exit;
@@ -425,7 +425,7 @@ acpi_remove_notify_handler(acpi_handle device,
425 425
426 /* Convert and validate the device handle */ 426 /* Convert and validate the device handle */
427 427
428 node = acpi_ns_map_handle_to_node(device); 428 node = acpi_ns_validate_handle(device);
429 if (!node) { 429 if (!node) {
430 status = AE_BAD_PARAMETER; 430 status = AE_BAD_PARAMETER;
431 goto unlock_and_exit; 431 goto unlock_and_exit;
diff --git a/drivers/acpi/acpica/evxfevnt.c b/drivers/acpi/acpica/evxfevnt.c
index 4721f58fe42c..eed7a38d25f2 100644
--- a/drivers/acpi/acpica/evxfevnt.c
+++ b/drivers/acpi/acpica/evxfevnt.c
@@ -610,7 +610,7 @@ acpi_install_gpe_block(acpi_handle gpe_device,
610 return (status); 610 return (status);
611 } 611 }
612 612
613 node = acpi_ns_map_handle_to_node(gpe_device); 613 node = acpi_ns_validate_handle(gpe_device);
614 if (!node) { 614 if (!node) {
615 status = AE_BAD_PARAMETER; 615 status = AE_BAD_PARAMETER;
616 goto unlock_and_exit; 616 goto unlock_and_exit;
@@ -698,7 +698,7 @@ acpi_status acpi_remove_gpe_block(acpi_handle gpe_device)
698 return (status); 698 return (status);
699 } 699 }
700 700
701 node = acpi_ns_map_handle_to_node(gpe_device); 701 node = acpi_ns_validate_handle(gpe_device);
702 if (!node) { 702 if (!node) {
703 status = AE_BAD_PARAMETER; 703 status = AE_BAD_PARAMETER;
704 goto unlock_and_exit; 704 goto unlock_and_exit;
diff --git a/drivers/acpi/acpica/evxfregn.c b/drivers/acpi/acpica/evxfregn.c
index 7c3d2d356ffb..c98aa7c2d67c 100644
--- a/drivers/acpi/acpica/evxfregn.c
+++ b/drivers/acpi/acpica/evxfregn.c
@@ -89,7 +89,7 @@ acpi_install_address_space_handler(acpi_handle device,
89 89
90 /* Convert and validate the device handle */ 90 /* Convert and validate the device handle */
91 91
92 node = acpi_ns_map_handle_to_node(device); 92 node = acpi_ns_validate_handle(device);
93 if (!node) { 93 if (!node) {
94 status = AE_BAD_PARAMETER; 94 status = AE_BAD_PARAMETER;
95 goto unlock_and_exit; 95 goto unlock_and_exit;
@@ -155,7 +155,7 @@ acpi_remove_address_space_handler(acpi_handle device,
155 155
156 /* Convert and validate the device handle */ 156 /* Convert and validate the device handle */
157 157
158 node = acpi_ns_map_handle_to_node(device); 158 node = acpi_ns_validate_handle(device);
159 if (!node || 159 if (!node ||
160 ((node->type != ACPI_TYPE_DEVICE) && 160 ((node->type != ACPI_TYPE_DEVICE) &&
161 (node->type != ACPI_TYPE_PROCESSOR) && 161 (node->type != ACPI_TYPE_PROCESSOR) &&
diff --git a/drivers/acpi/acpica/nsdump.c b/drivers/acpi/acpica/nsdump.c
index 2deb986861ca..e37836e27e29 100644
--- a/drivers/acpi/acpica/nsdump.c
+++ b/drivers/acpi/acpica/nsdump.c
@@ -180,7 +180,7 @@ acpi_ns_dump_one_object(acpi_handle obj_handle,
180 return (AE_OK); 180 return (AE_OK);
181 } 181 }
182 182
183 this_node = acpi_ns_map_handle_to_node(obj_handle); 183 this_node = acpi_ns_validate_handle(obj_handle);
184 if (!this_node) { 184 if (!this_node) {
185 ACPI_DEBUG_PRINT((ACPI_DB_INFO, "Invalid object handle %p\n", 185 ACPI_DEBUG_PRINT((ACPI_DB_INFO, "Invalid object handle %p\n",
186 obj_handle)); 186 obj_handle));
diff --git a/drivers/acpi/acpica/nsnames.c b/drivers/acpi/acpica/nsnames.c
index af8e6bcee07e..8f9a4875ce26 100644
--- a/drivers/acpi/acpica/nsnames.c
+++ b/drivers/acpi/acpica/nsnames.c
@@ -232,7 +232,7 @@ acpi_ns_handle_to_pathname(acpi_handle target_handle,
232 232
233 ACPI_FUNCTION_TRACE_PTR(ns_handle_to_pathname, target_handle); 233 ACPI_FUNCTION_TRACE_PTR(ns_handle_to_pathname, target_handle);
234 234
235 node = acpi_ns_map_handle_to_node(target_handle); 235 node = acpi_ns_validate_handle(target_handle);
236 if (!node) { 236 if (!node) {
237 return_ACPI_STATUS(AE_BAD_PARAMETER); 237 return_ACPI_STATUS(AE_BAD_PARAMETER);
238 } 238 }
diff --git a/drivers/acpi/acpica/nsutils.c b/drivers/acpi/acpica/nsutils.c
index ea55ab4f9849..47d91e668a1b 100644
--- a/drivers/acpi/acpica/nsutils.c
+++ b/drivers/acpi/acpica/nsutils.c
@@ -671,24 +671,25 @@ acpi_ns_externalize_name(u32 internal_name_length,
671 671
672/******************************************************************************* 672/*******************************************************************************
673 * 673 *
674 * FUNCTION: acpi_ns_map_handle_to_node 674 * FUNCTION: acpi_ns_validate_handle
675 * 675 *
676 * PARAMETERS: Handle - Handle to be converted to an Node 676 * PARAMETERS: Handle - Handle to be validated and typecast to a
677 * namespace node.
677 * 678 *
678 * RETURN: A Name table entry pointer 679 * RETURN: A pointer to a namespace node
679 * 680 *
680 * DESCRIPTION: Convert a namespace handle to a real Node 681 * DESCRIPTION: Convert a namespace handle to a namespace node. Handles special
682 * cases for the root node.
681 * 683 *
682 * Note: Real integer handles would allow for more verification 684 * NOTE: Real integer handles would allow for more verification
683 * and keep all pointers within this subsystem - however this introduces 685 * and keep all pointers within this subsystem - however this introduces
684 * more (and perhaps unnecessary) overhead. 686 * more overhead and has not been necessary to this point. Drivers
685 * 687 * holding handles are typically notified before a node becomes invalid
686 * The current implemenation is basically a placeholder until such time comes 688 * due to a table unload.
687 * that it is needed.
688 * 689 *
689 ******************************************************************************/ 690 ******************************************************************************/
690 691
691struct acpi_namespace_node *acpi_ns_map_handle_to_node(acpi_handle handle) 692struct acpi_namespace_node *acpi_ns_validate_handle(acpi_handle handle)
692{ 693{
693 694
694 ACPI_FUNCTION_ENTRY(); 695 ACPI_FUNCTION_ENTRY();
@@ -710,42 +711,6 @@ struct acpi_namespace_node *acpi_ns_map_handle_to_node(acpi_handle handle)
710 711
711/******************************************************************************* 712/*******************************************************************************
712 * 713 *
713 * FUNCTION: acpi_ns_convert_entry_to_handle
714 *
715 * PARAMETERS: Node - Node to be converted to a Handle
716 *
717 * RETURN: A user handle
718 *
719 * DESCRIPTION: Convert a real Node to a namespace handle
720 *
721 ******************************************************************************/
722
723acpi_handle acpi_ns_convert_entry_to_handle(struct acpi_namespace_node *node)
724{
725
726 /*
727 * Simple implementation for now;
728 */
729 return ((acpi_handle) node);
730
731/* Example future implementation ---------------------
732
733 if (!Node)
734 {
735 return (NULL);
736 }
737
738 if (Node == acpi_gbl_root_node)
739 {
740 return (ACPI_ROOT_OBJECT);
741 }
742
743 return ((acpi_handle) Node);
744------------------------------------------------------*/
745}
746
747/*******************************************************************************
748 *
749 * FUNCTION: acpi_ns_terminate 714 * FUNCTION: acpi_ns_terminate
750 * 715 *
751 * PARAMETERS: none 716 * PARAMETERS: none
diff --git a/drivers/acpi/acpica/nsxfeval.c b/drivers/acpi/acpica/nsxfeval.c
index f2bd1da77001..f0c0892bc7e5 100644
--- a/drivers/acpi/acpica/nsxfeval.c
+++ b/drivers/acpi/acpica/nsxfeval.c
@@ -190,7 +190,7 @@ acpi_evaluate_object(acpi_handle handle,
190 190
191 /* Convert and validate the device handle */ 191 /* Convert and validate the device handle */
192 192
193 info->prefix_node = acpi_ns_map_handle_to_node(handle); 193 info->prefix_node = acpi_ns_validate_handle(handle);
194 if (!info->prefix_node) { 194 if (!info->prefix_node) {
195 status = AE_BAD_PARAMETER; 195 status = AE_BAD_PARAMETER;
196 goto cleanup; 196 goto cleanup;
@@ -552,7 +552,7 @@ acpi_ns_get_device_callback(acpi_handle obj_handle,
552 return (status); 552 return (status);
553 } 553 }
554 554
555 node = acpi_ns_map_handle_to_node(obj_handle); 555 node = acpi_ns_validate_handle(obj_handle);
556 status = acpi_ut_release_mutex(ACPI_MTX_NAMESPACE); 556 status = acpi_ut_release_mutex(ACPI_MTX_NAMESPACE);
557 if (ACPI_FAILURE(status)) { 557 if (ACPI_FAILURE(status)) {
558 return (status); 558 return (status);
@@ -729,7 +729,7 @@ acpi_attach_data(acpi_handle obj_handle,
729 729
730 /* Convert and validate the handle */ 730 /* Convert and validate the handle */
731 731
732 node = acpi_ns_map_handle_to_node(obj_handle); 732 node = acpi_ns_validate_handle(obj_handle);
733 if (!node) { 733 if (!node) {
734 status = AE_BAD_PARAMETER; 734 status = AE_BAD_PARAMETER;
735 goto unlock_and_exit; 735 goto unlock_and_exit;
@@ -775,7 +775,7 @@ acpi_detach_data(acpi_handle obj_handle, acpi_object_handler handler)
775 775
776 /* Convert and validate the handle */ 776 /* Convert and validate the handle */
777 777
778 node = acpi_ns_map_handle_to_node(obj_handle); 778 node = acpi_ns_validate_handle(obj_handle);
779 if (!node) { 779 if (!node) {
780 status = AE_BAD_PARAMETER; 780 status = AE_BAD_PARAMETER;
781 goto unlock_and_exit; 781 goto unlock_and_exit;
@@ -822,7 +822,7 @@ acpi_get_data(acpi_handle obj_handle, acpi_object_handler handler, void **data)
822 822
823 /* Convert and validate the handle */ 823 /* Convert and validate the handle */
824 824
825 node = acpi_ns_map_handle_to_node(obj_handle); 825 node = acpi_ns_validate_handle(obj_handle);
826 if (!node) { 826 if (!node) {
827 status = AE_BAD_PARAMETER; 827 status = AE_BAD_PARAMETER;
828 goto unlock_and_exit; 828 goto unlock_and_exit;
diff --git a/drivers/acpi/acpica/nsxfname.c b/drivers/acpi/acpica/nsxfname.c
index ddc84af6336e..e611dd961b20 100644
--- a/drivers/acpi/acpica/nsxfname.c
+++ b/drivers/acpi/acpica/nsxfname.c
@@ -93,7 +93,7 @@ acpi_get_handle(acpi_handle parent,
93 /* Convert a parent handle to a prefix node */ 93 /* Convert a parent handle to a prefix node */
94 94
95 if (parent) { 95 if (parent) {
96 prefix_node = acpi_ns_map_handle_to_node(parent); 96 prefix_node = acpi_ns_validate_handle(parent);
97 if (!prefix_node) { 97 if (!prefix_node) {
98 return (AE_BAD_PARAMETER); 98 return (AE_BAD_PARAMETER);
99 } 99 }
@@ -114,7 +114,7 @@ acpi_get_handle(acpi_handle parent,
114 114
115 if (!ACPI_STRCMP(pathname, ACPI_NS_ROOT_PATH)) { 115 if (!ACPI_STRCMP(pathname, ACPI_NS_ROOT_PATH)) {
116 *ret_handle = 116 *ret_handle =
117 acpi_ns_convert_entry_to_handle(acpi_gbl_root_node); 117 ACPI_CAST_PTR(acpi_handle, acpi_gbl_root_node);
118 return (AE_OK); 118 return (AE_OK);
119 } 119 }
120 } else if (!prefix_node) { 120 } else if (!prefix_node) {
@@ -129,7 +129,7 @@ acpi_get_handle(acpi_handle parent,
129 status = 129 status =
130 acpi_ns_get_node(prefix_node, pathname, ACPI_NS_NO_UPSEARCH, &node); 130 acpi_ns_get_node(prefix_node, pathname, ACPI_NS_NO_UPSEARCH, &node);
131 if (ACPI_SUCCESS(status)) { 131 if (ACPI_SUCCESS(status)) {
132 *ret_handle = acpi_ns_convert_entry_to_handle(node); 132 *ret_handle = ACPI_CAST_PTR(acpi_handle, node);
133 } 133 }
134 134
135 return (status); 135 return (status);
@@ -186,7 +186,7 @@ acpi_get_name(acpi_handle handle, u32 name_type, struct acpi_buffer * buffer)
186 return (status); 186 return (status);
187 } 187 }
188 188
189 node = acpi_ns_map_handle_to_node(handle); 189 node = acpi_ns_validate_handle(handle);
190 if (!node) { 190 if (!node) {
191 status = AE_BAD_PARAMETER; 191 status = AE_BAD_PARAMETER;
192 goto unlock_and_exit; 192 goto unlock_and_exit;
@@ -291,7 +291,7 @@ acpi_get_object_info(acpi_handle handle,
291 goto cleanup; 291 goto cleanup;
292 } 292 }
293 293
294 node = acpi_ns_map_handle_to_node(handle); 294 node = acpi_ns_validate_handle(handle);
295 if (!node) { 295 if (!node) {
296 (void)acpi_ut_release_mutex(ACPI_MTX_NAMESPACE); 296 (void)acpi_ut_release_mutex(ACPI_MTX_NAMESPACE);
297 return (AE_BAD_PARAMETER); 297 return (AE_BAD_PARAMETER);
diff --git a/drivers/acpi/acpica/nsxfobj.c b/drivers/acpi/acpica/nsxfobj.c
index 4071bad4458e..0cc6ba01a495 100644
--- a/drivers/acpi/acpica/nsxfobj.c
+++ b/drivers/acpi/acpica/nsxfobj.c
@@ -79,7 +79,7 @@ acpi_status acpi_get_id(acpi_handle handle, acpi_owner_id * ret_id)
79 79
80 /* Convert and validate the handle */ 80 /* Convert and validate the handle */
81 81
82 node = acpi_ns_map_handle_to_node(handle); 82 node = acpi_ns_validate_handle(handle);
83 if (!node) { 83 if (!node) {
84 (void)acpi_ut_release_mutex(ACPI_MTX_NAMESPACE); 84 (void)acpi_ut_release_mutex(ACPI_MTX_NAMESPACE);
85 return (AE_BAD_PARAMETER); 85 return (AE_BAD_PARAMETER);
@@ -132,7 +132,7 @@ acpi_status acpi_get_type(acpi_handle handle, acpi_object_type * ret_type)
132 132
133 /* Convert and validate the handle */ 133 /* Convert and validate the handle */
134 134
135 node = acpi_ns_map_handle_to_node(handle); 135 node = acpi_ns_validate_handle(handle);
136 if (!node) { 136 if (!node) {
137 (void)acpi_ut_release_mutex(ACPI_MTX_NAMESPACE); 137 (void)acpi_ut_release_mutex(ACPI_MTX_NAMESPACE);
138 return (AE_BAD_PARAMETER); 138 return (AE_BAD_PARAMETER);
@@ -182,7 +182,7 @@ acpi_status acpi_get_parent(acpi_handle handle, acpi_handle * ret_handle)
182 182
183 /* Convert and validate the handle */ 183 /* Convert and validate the handle */
184 184
185 node = acpi_ns_map_handle_to_node(handle); 185 node = acpi_ns_validate_handle(handle);
186 if (!node) { 186 if (!node) {
187 status = AE_BAD_PARAMETER; 187 status = AE_BAD_PARAMETER;
188 goto unlock_and_exit; 188 goto unlock_and_exit;
@@ -191,7 +191,7 @@ acpi_status acpi_get_parent(acpi_handle handle, acpi_handle * ret_handle)
191 /* Get the parent entry */ 191 /* Get the parent entry */
192 192
193 parent_node = acpi_ns_get_parent_node(node); 193 parent_node = acpi_ns_get_parent_node(node);
194 *ret_handle = acpi_ns_convert_entry_to_handle(parent_node); 194 *ret_handle = ACPI_CAST_PTR(acpi_handle, parent_node);
195 195
196 /* Return exception if parent is null */ 196 /* Return exception if parent is null */
197 197
@@ -251,7 +251,7 @@ acpi_get_next_object(acpi_object_type type,
251 251
252 /* Start search at the beginning of the specified scope */ 252 /* Start search at the beginning of the specified scope */
253 253
254 parent_node = acpi_ns_map_handle_to_node(parent); 254 parent_node = acpi_ns_validate_handle(parent);
255 if (!parent_node) { 255 if (!parent_node) {
256 status = AE_BAD_PARAMETER; 256 status = AE_BAD_PARAMETER;
257 goto unlock_and_exit; 257 goto unlock_and_exit;
@@ -260,7 +260,7 @@ acpi_get_next_object(acpi_object_type type,
260 /* Non-null handle, ignore the parent */ 260 /* Non-null handle, ignore the parent */
261 /* Convert and validate the handle */ 261 /* Convert and validate the handle */
262 262
263 child_node = acpi_ns_map_handle_to_node(child); 263 child_node = acpi_ns_validate_handle(child);
264 if (!child_node) { 264 if (!child_node) {
265 status = AE_BAD_PARAMETER; 265 status = AE_BAD_PARAMETER;
266 goto unlock_and_exit; 266 goto unlock_and_exit;
@@ -276,7 +276,7 @@ acpi_get_next_object(acpi_object_type type,
276 } 276 }
277 277
278 if (ret_handle) { 278 if (ret_handle) {
279 *ret_handle = acpi_ns_convert_entry_to_handle(node); 279 *ret_handle = ACPI_CAST_PTR(acpi_handle, node);
280 } 280 }
281 281
282 unlock_and_exit: 282 unlock_and_exit:
diff --git a/drivers/acpi/acpica/rsxface.c b/drivers/acpi/acpica/rsxface.c
index 395212bcd19b..f27feb4772f6 100644
--- a/drivers/acpi/acpica/rsxface.c
+++ b/drivers/acpi/acpica/rsxface.c
@@ -104,7 +104,7 @@ acpi_rs_validate_parameters(acpi_handle device_handle,
104 return_ACPI_STATUS(AE_BAD_PARAMETER); 104 return_ACPI_STATUS(AE_BAD_PARAMETER);
105 } 105 }
106 106
107 node = acpi_ns_map_handle_to_node(device_handle); 107 node = acpi_ns_validate_handle(device_handle);
108 if (!node) { 108 if (!node) {
109 return_ACPI_STATUS(AE_BAD_PARAMETER); 109 return_ACPI_STATUS(AE_BAD_PARAMETER);
110 } 110 }