aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/acpi/namespace/nsxfobj.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/acpi/namespace/nsxfobj.c')
-rw-r--r--drivers/acpi/namespace/nsxfobj.c91
1 files changed, 37 insertions, 54 deletions
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 @@
47#include <acpi/acpi.h> 47#include <acpi/acpi.h>
48#include <acpi/acnamesp.h> 48#include <acpi/acnamesp.h>
49 49
50
51#define _COMPONENT ACPI_NAMESPACE 50#define _COMPONENT ACPI_NAMESPACE
52 ACPI_MODULE_NAME ("nsxfobj") 51ACPI_MODULE_NAME("nsxfobj")
53 52
54/******************************************************************************* 53/*******************************************************************************
55 * 54 *
@@ -63,15 +62,10 @@
63 * DESCRIPTION: This routine returns the type associatd with a particular handle 62 * DESCRIPTION: This routine returns the type associatd with a particular handle
64 * 63 *
65 ******************************************************************************/ 64 ******************************************************************************/
66 65acpi_status acpi_get_type(acpi_handle handle, acpi_object_type * ret_type)
67acpi_status
68acpi_get_type (
69 acpi_handle handle,
70 acpi_object_type *ret_type)
71{ 66{
72 struct acpi_namespace_node *node; 67 struct acpi_namespace_node *node;
73 acpi_status status; 68 acpi_status status;
74
75 69
76 /* Parameter Validation */ 70 /* Parameter Validation */
77 71
@@ -88,27 +82,26 @@ acpi_get_type (
88 return (AE_OK); 82 return (AE_OK);
89 } 83 }
90 84
91 status = acpi_ut_acquire_mutex (ACPI_MTX_NAMESPACE); 85 status = acpi_ut_acquire_mutex(ACPI_MTX_NAMESPACE);
92 if (ACPI_FAILURE (status)) { 86 if (ACPI_FAILURE(status)) {
93 return (status); 87 return (status);
94 } 88 }
95 89
96 /* Convert and validate the handle */ 90 /* Convert and validate the handle */
97 91
98 node = acpi_ns_map_handle_to_node (handle); 92 node = acpi_ns_map_handle_to_node(handle);
99 if (!node) { 93 if (!node) {
100 (void) acpi_ut_release_mutex (ACPI_MTX_NAMESPACE); 94 (void)acpi_ut_release_mutex(ACPI_MTX_NAMESPACE);
101 return (AE_BAD_PARAMETER); 95 return (AE_BAD_PARAMETER);
102 } 96 }
103 97
104 *ret_type = node->type; 98 *ret_type = node->type;
105 99
106 100 status = acpi_ut_release_mutex(ACPI_MTX_NAMESPACE);
107 status = acpi_ut_release_mutex (ACPI_MTX_NAMESPACE);
108 return (status); 101 return (status);
109} 102}
110EXPORT_SYMBOL(acpi_get_type);
111 103
104EXPORT_SYMBOL(acpi_get_type);
112 105
113/******************************************************************************* 106/*******************************************************************************
114 * 107 *
@@ -124,14 +117,10 @@ EXPORT_SYMBOL(acpi_get_type);
124 * 117 *
125 ******************************************************************************/ 118 ******************************************************************************/
126 119
127acpi_status 120acpi_status acpi_get_parent(acpi_handle handle, acpi_handle * ret_handle)
128acpi_get_parent (
129 acpi_handle handle,
130 acpi_handle *ret_handle)
131{ 121{
132 struct acpi_namespace_node *node; 122 struct acpi_namespace_node *node;
133 acpi_status status; 123 acpi_status status;
134
135 124
136 if (!ret_handle) { 125 if (!ret_handle) {
137 return (AE_BAD_PARAMETER); 126 return (AE_BAD_PARAMETER);
@@ -143,14 +132,14 @@ acpi_get_parent (
143 return (AE_NULL_ENTRY); 132 return (AE_NULL_ENTRY);
144 } 133 }
145 134
146 status = acpi_ut_acquire_mutex (ACPI_MTX_NAMESPACE); 135 status = acpi_ut_acquire_mutex(ACPI_MTX_NAMESPACE);
147 if (ACPI_FAILURE (status)) { 136 if (ACPI_FAILURE(status)) {
148 return (status); 137 return (status);
149 } 138 }
150 139
151 /* Convert and validate the handle */ 140 /* Convert and validate the handle */
152 141
153 node = acpi_ns_map_handle_to_node (handle); 142 node = acpi_ns_map_handle_to_node(handle);
154 if (!node) { 143 if (!node) {
155 status = AE_BAD_PARAMETER; 144 status = AE_BAD_PARAMETER;
156 goto unlock_and_exit; 145 goto unlock_and_exit;
@@ -159,22 +148,21 @@ acpi_get_parent (
159 /* Get the parent entry */ 148 /* Get the parent entry */
160 149
161 *ret_handle = 150 *ret_handle =
162 acpi_ns_convert_entry_to_handle (acpi_ns_get_parent_node (node)); 151 acpi_ns_convert_entry_to_handle(acpi_ns_get_parent_node(node));
163 152
164 /* Return exception if parent is null */ 153 /* Return exception if parent is null */
165 154
166 if (!acpi_ns_get_parent_node (node)) { 155 if (!acpi_ns_get_parent_node(node)) {
167 status = AE_NULL_ENTRY; 156 status = AE_NULL_ENTRY;
168 } 157 }
169 158
159 unlock_and_exit:
170 160
171unlock_and_exit: 161 (void)acpi_ut_release_mutex(ACPI_MTX_NAMESPACE);
172
173 (void) acpi_ut_release_mutex (ACPI_MTX_NAMESPACE);
174 return (status); 162 return (status);
175} 163}
176EXPORT_SYMBOL(acpi_get_parent);
177 164
165EXPORT_SYMBOL(acpi_get_parent);
178 166
179/******************************************************************************* 167/*******************************************************************************
180 * 168 *
@@ -195,17 +183,14 @@ EXPORT_SYMBOL(acpi_get_parent);
195 ******************************************************************************/ 183 ******************************************************************************/
196 184
197acpi_status 185acpi_status
198acpi_get_next_object ( 186acpi_get_next_object(acpi_object_type type,
199 acpi_object_type type, 187 acpi_handle parent,
200 acpi_handle parent, 188 acpi_handle child, acpi_handle * ret_handle)
201 acpi_handle child,
202 acpi_handle *ret_handle)
203{ 189{
204 acpi_status status; 190 acpi_status status;
205 struct acpi_namespace_node *node; 191 struct acpi_namespace_node *node;
206 struct acpi_namespace_node *parent_node = NULL; 192 struct acpi_namespace_node *parent_node = NULL;
207 struct acpi_namespace_node *child_node = NULL; 193 struct acpi_namespace_node *child_node = NULL;
208
209 194
210 /* Parameter validation */ 195 /* Parameter validation */
211 196
@@ -213,8 +198,8 @@ acpi_get_next_object (
213 return (AE_BAD_PARAMETER); 198 return (AE_BAD_PARAMETER);
214 } 199 }
215 200
216 status = acpi_ut_acquire_mutex (ACPI_MTX_NAMESPACE); 201 status = acpi_ut_acquire_mutex(ACPI_MTX_NAMESPACE);
217 if (ACPI_FAILURE (status)) { 202 if (ACPI_FAILURE(status)) {
218 return (status); 203 return (status);
219 } 204 }
220 205
@@ -223,17 +208,16 @@ acpi_get_next_object (
223 if (!child) { 208 if (!child) {
224 /* Start search at the beginning of the specified scope */ 209 /* Start search at the beginning of the specified scope */
225 210
226 parent_node = acpi_ns_map_handle_to_node (parent); 211 parent_node = acpi_ns_map_handle_to_node(parent);
227 if (!parent_node) { 212 if (!parent_node) {
228 status = AE_BAD_PARAMETER; 213 status = AE_BAD_PARAMETER;
229 goto unlock_and_exit; 214 goto unlock_and_exit;
230 } 215 }
231 } 216 } else {
232 else {
233 /* Non-null handle, ignore the parent */ 217 /* Non-null handle, ignore the parent */
234 /* Convert and validate the handle */ 218 /* Convert and validate the handle */
235 219
236 child_node = acpi_ns_map_handle_to_node (child); 220 child_node = acpi_ns_map_handle_to_node(child);
237 if (!child_node) { 221 if (!child_node) {
238 status = AE_BAD_PARAMETER; 222 status = AE_BAD_PARAMETER;
239 goto unlock_and_exit; 223 goto unlock_and_exit;
@@ -242,20 +226,19 @@ acpi_get_next_object (
242 226
243 /* Internal function does the real work */ 227 /* Internal function does the real work */
244 228
245 node = acpi_ns_get_next_node (type, parent_node, child_node); 229 node = acpi_ns_get_next_node(type, parent_node, child_node);
246 if (!node) { 230 if (!node) {
247 status = AE_NOT_FOUND; 231 status = AE_NOT_FOUND;
248 goto unlock_and_exit; 232 goto unlock_and_exit;
249 } 233 }
250 234
251 if (ret_handle) { 235 if (ret_handle) {
252 *ret_handle = acpi_ns_convert_entry_to_handle (node); 236 *ret_handle = acpi_ns_convert_entry_to_handle(node);
253 } 237 }
254 238
239 unlock_and_exit:
255 240
256unlock_and_exit: 241 (void)acpi_ut_release_mutex(ACPI_MTX_NAMESPACE);
257
258 (void) acpi_ut_release_mutex (ACPI_MTX_NAMESPACE);
259 return (status); 242 return (status);
260} 243}
261 244