aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/acpi/namespace/nsxfname.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/acpi/namespace/nsxfname.c')
-rw-r--r--drivers/acpi/namespace/nsxfname.c173
1 files changed, 80 insertions, 93 deletions
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 @@
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 ("nsxfname") 51ACPI_MODULE_NAME("nsxfname")
53
54 52
55/****************************************************************************** 53/******************************************************************************
56 * 54 *
@@ -69,20 +67,15 @@
69 * namespace handle. 67 * namespace handle.
70 * 68 *
71 ******************************************************************************/ 69 ******************************************************************************/
72
73acpi_status 70acpi_status
74acpi_get_handle ( 71acpi_get_handle(acpi_handle parent,
75 acpi_handle parent, 72 acpi_string pathname, acpi_handle * ret_handle)
76 acpi_string pathname,
77 acpi_handle *ret_handle)
78{ 73{
79 acpi_status status; 74 acpi_status status;
80 struct acpi_namespace_node *node = NULL; 75 struct acpi_namespace_node *node = NULL;
81 struct acpi_namespace_node *prefix_node = NULL; 76 struct acpi_namespace_node *prefix_node = NULL;
82
83
84 ACPI_FUNCTION_ENTRY ();
85 77
78 ACPI_FUNCTION_ENTRY();
86 79
87 /* Parameter Validation */ 80 /* Parameter Validation */
88 81
@@ -93,45 +86,47 @@ acpi_get_handle (
93 /* Convert a parent handle to a prefix node */ 86 /* Convert a parent handle to a prefix node */
94 87
95 if (parent) { 88 if (parent) {
96 status = acpi_ut_acquire_mutex (ACPI_MTX_NAMESPACE); 89 status = acpi_ut_acquire_mutex(ACPI_MTX_NAMESPACE);
97 if (ACPI_FAILURE (status)) { 90 if (ACPI_FAILURE(status)) {
98 return (status); 91 return (status);
99 } 92 }
100 93
101 prefix_node = acpi_ns_map_handle_to_node (parent); 94 prefix_node = acpi_ns_map_handle_to_node(parent);
102 if (!prefix_node) { 95 if (!prefix_node) {
103 (void) acpi_ut_release_mutex (ACPI_MTX_NAMESPACE); 96 (void)acpi_ut_release_mutex(ACPI_MTX_NAMESPACE);
104 return (AE_BAD_PARAMETER); 97 return (AE_BAD_PARAMETER);
105 } 98 }
106 99
107 status = acpi_ut_release_mutex (ACPI_MTX_NAMESPACE); 100 status = acpi_ut_release_mutex(ACPI_MTX_NAMESPACE);
108 if (ACPI_FAILURE (status)) { 101 if (ACPI_FAILURE(status)) {
109 return (status); 102 return (status);
110 } 103 }
111 } 104 }
112 105
113 /* Special case for root, since we can't search for it */ 106 /* Special case for root, since we can't search for it */
114 107
115 if (ACPI_STRCMP (pathname, ACPI_NS_ROOT_PATH) == 0) { 108 if (ACPI_STRCMP(pathname, ACPI_NS_ROOT_PATH) == 0) {
116 *ret_handle = acpi_ns_convert_entry_to_handle (acpi_gbl_root_node); 109 *ret_handle =
110 acpi_ns_convert_entry_to_handle(acpi_gbl_root_node);
117 return (AE_OK); 111 return (AE_OK);
118 } 112 }
119 113
120 /* 114 /*
121 * Find the Node and convert to a handle 115 * Find the Node and convert to a handle
122 */ 116 */
123 status = acpi_ns_get_node_by_path (pathname, prefix_node, ACPI_NS_NO_UPSEARCH, 117 status =
124 &node); 118 acpi_ns_get_node_by_path(pathname, prefix_node, ACPI_NS_NO_UPSEARCH,
119 &node);
125 120
126 *ret_handle = NULL; 121 *ret_handle = NULL;
127 if (ACPI_SUCCESS (status)) { 122 if (ACPI_SUCCESS(status)) {
128 *ret_handle = acpi_ns_convert_entry_to_handle (node); 123 *ret_handle = acpi_ns_convert_entry_to_handle(node);
129 } 124 }
130 125
131 return (status); 126 return (status);
132} 127}
133EXPORT_SYMBOL(acpi_get_handle);
134 128
129EXPORT_SYMBOL(acpi_get_handle);
135 130
136/****************************************************************************** 131/******************************************************************************
137 * 132 *
@@ -150,14 +145,10 @@ EXPORT_SYMBOL(acpi_get_handle);
150 ******************************************************************************/ 145 ******************************************************************************/
151 146
152acpi_status 147acpi_status
153acpi_get_name ( 148acpi_get_name(acpi_handle handle, u32 name_type, struct acpi_buffer * buffer)
154 acpi_handle handle,
155 u32 name_type,
156 struct acpi_buffer *buffer)
157{ 149{
158 acpi_status status; 150 acpi_status status;
159 struct acpi_namespace_node *node; 151 struct acpi_namespace_node *node;
160
161 152
162 /* Parameter validation */ 153 /* Parameter validation */
163 154
@@ -165,15 +156,15 @@ acpi_get_name (
165 return (AE_BAD_PARAMETER); 156 return (AE_BAD_PARAMETER);
166 } 157 }
167 158
168 status = acpi_ut_validate_buffer (buffer); 159 status = acpi_ut_validate_buffer(buffer);
169 if (ACPI_FAILURE (status)) { 160 if (ACPI_FAILURE(status)) {
170 return (status); 161 return (status);
171 } 162 }
172 163
173 if (name_type == ACPI_FULL_PATHNAME) { 164 if (name_type == ACPI_FULL_PATHNAME) {
174 /* Get the full pathname (From the namespace root) */ 165 /* Get the full pathname (From the namespace root) */
175 166
176 status = acpi_ns_handle_to_pathname (handle, buffer); 167 status = acpi_ns_handle_to_pathname(handle, buffer);
177 return (status); 168 return (status);
178 } 169 }
179 170
@@ -181,12 +172,12 @@ acpi_get_name (
181 * Wants the single segment ACPI name. 172 * Wants the single segment ACPI name.
182 * Validate handle and convert to a namespace Node 173 * Validate handle and convert to a namespace Node
183 */ 174 */
184 status = acpi_ut_acquire_mutex (ACPI_MTX_NAMESPACE); 175 status = acpi_ut_acquire_mutex(ACPI_MTX_NAMESPACE);
185 if (ACPI_FAILURE (status)) { 176 if (ACPI_FAILURE(status)) {
186 return (status); 177 return (status);
187 } 178 }
188 179
189 node = acpi_ns_map_handle_to_node (handle); 180 node = acpi_ns_map_handle_to_node(handle);
190 if (!node) { 181 if (!node) {
191 status = AE_BAD_PARAMETER; 182 status = AE_BAD_PARAMETER;
192 goto unlock_and_exit; 183 goto unlock_and_exit;
@@ -194,26 +185,25 @@ acpi_get_name (
194 185
195 /* Validate/Allocate/Clear caller buffer */ 186 /* Validate/Allocate/Clear caller buffer */
196 187
197 status = acpi_ut_initialize_buffer (buffer, ACPI_PATH_SEGMENT_LENGTH); 188 status = acpi_ut_initialize_buffer(buffer, ACPI_PATH_SEGMENT_LENGTH);
198 if (ACPI_FAILURE (status)) { 189 if (ACPI_FAILURE(status)) {
199 goto unlock_and_exit; 190 goto unlock_and_exit;
200 } 191 }
201 192
202 /* Just copy the ACPI name from the Node and zero terminate it */ 193 /* Just copy the ACPI name from the Node and zero terminate it */
203 194
204 ACPI_STRNCPY (buffer->pointer, acpi_ut_get_node_name (node), 195 ACPI_STRNCPY(buffer->pointer, acpi_ut_get_node_name(node),
205 ACPI_NAME_SIZE); 196 ACPI_NAME_SIZE);
206 ((char *) buffer->pointer) [ACPI_NAME_SIZE] = 0; 197 ((char *)buffer->pointer)[ACPI_NAME_SIZE] = 0;
207 status = AE_OK; 198 status = AE_OK;
208 199
200 unlock_and_exit:
209 201
210unlock_and_exit: 202 (void)acpi_ut_release_mutex(ACPI_MTX_NAMESPACE);
211
212 (void) acpi_ut_release_mutex (ACPI_MTX_NAMESPACE);
213 return (status); 203 return (status);
214} 204}
215EXPORT_SYMBOL(acpi_get_name);
216 205
206EXPORT_SYMBOL(acpi_get_name);
217 207
218/****************************************************************************** 208/******************************************************************************
219 * 209 *
@@ -231,17 +221,14 @@ EXPORT_SYMBOL(acpi_get_name);
231 ******************************************************************************/ 221 ******************************************************************************/
232 222
233acpi_status 223acpi_status
234acpi_get_object_info ( 224acpi_get_object_info(acpi_handle handle, struct acpi_buffer * buffer)
235 acpi_handle handle,
236 struct acpi_buffer *buffer)
237{ 225{
238 acpi_status status; 226 acpi_status status;
239 struct acpi_namespace_node *node; 227 struct acpi_namespace_node *node;
240 struct acpi_device_info *info; 228 struct acpi_device_info *info;
241 struct acpi_device_info *return_info; 229 struct acpi_device_info *return_info;
242 struct acpi_compatible_id_list *cid_list = NULL; 230 struct acpi_compatible_id_list *cid_list = NULL;
243 acpi_size size; 231 acpi_size size;
244
245 232
246 /* Parameter validation */ 233 /* Parameter validation */
247 234
@@ -249,37 +236,37 @@ acpi_get_object_info (
249 return (AE_BAD_PARAMETER); 236 return (AE_BAD_PARAMETER);
250 } 237 }
251 238
252 status = acpi_ut_validate_buffer (buffer); 239 status = acpi_ut_validate_buffer(buffer);
253 if (ACPI_FAILURE (status)) { 240 if (ACPI_FAILURE(status)) {
254 return (status); 241 return (status);
255 } 242 }
256 243
257 info = ACPI_MEM_CALLOCATE (sizeof (struct acpi_device_info)); 244 info = ACPI_MEM_CALLOCATE(sizeof(struct acpi_device_info));
258 if (!info) { 245 if (!info) {
259 return (AE_NO_MEMORY); 246 return (AE_NO_MEMORY);
260 } 247 }
261 248
262 status = acpi_ut_acquire_mutex (ACPI_MTX_NAMESPACE); 249 status = acpi_ut_acquire_mutex(ACPI_MTX_NAMESPACE);
263 if (ACPI_FAILURE (status)) { 250 if (ACPI_FAILURE(status)) {
264 goto cleanup; 251 goto cleanup;
265 } 252 }
266 253
267 node = acpi_ns_map_handle_to_node (handle); 254 node = acpi_ns_map_handle_to_node(handle);
268 if (!node) { 255 if (!node) {
269 (void) acpi_ut_release_mutex (ACPI_MTX_NAMESPACE); 256 (void)acpi_ut_release_mutex(ACPI_MTX_NAMESPACE);
270 goto cleanup; 257 goto cleanup;
271 } 258 }
272 259
273 /* Init return structure */ 260 /* Init return structure */
274 261
275 size = sizeof (struct acpi_device_info); 262 size = sizeof(struct acpi_device_info);
276 263
277 info->type = node->type; 264 info->type = node->type;
278 info->name = node->name.integer; 265 info->name = node->name.integer;
279 info->valid = 0; 266 info->valid = 0;
280 267
281 status = acpi_ut_release_mutex (ACPI_MTX_NAMESPACE); 268 status = acpi_ut_release_mutex(ACPI_MTX_NAMESPACE);
282 if (ACPI_FAILURE (status)) { 269 if (ACPI_FAILURE(status)) {
283 goto cleanup; 270 goto cleanup;
284 } 271 }
285 272
@@ -297,73 +284,73 @@ acpi_get_object_info (
297 284
298 /* Execute the Device._HID method */ 285 /* Execute the Device._HID method */
299 286
300 status = acpi_ut_execute_HID (node, &info->hardware_id); 287 status = acpi_ut_execute_HID(node, &info->hardware_id);
301 if (ACPI_SUCCESS (status)) { 288 if (ACPI_SUCCESS(status)) {
302 info->valid |= ACPI_VALID_HID; 289 info->valid |= ACPI_VALID_HID;
303 } 290 }
304 291
305 /* Execute the Device._UID method */ 292 /* Execute the Device._UID method */
306 293
307 status = acpi_ut_execute_UID (node, &info->unique_id); 294 status = acpi_ut_execute_UID(node, &info->unique_id);
308 if (ACPI_SUCCESS (status)) { 295 if (ACPI_SUCCESS(status)) {
309 info->valid |= ACPI_VALID_UID; 296 info->valid |= ACPI_VALID_UID;
310 } 297 }
311 298
312 /* Execute the Device._CID method */ 299 /* Execute the Device._CID method */
313 300
314 status = acpi_ut_execute_CID (node, &cid_list); 301 status = acpi_ut_execute_CID(node, &cid_list);
315 if (ACPI_SUCCESS (status)) { 302 if (ACPI_SUCCESS(status)) {
316 size += ((acpi_size) cid_list->count - 1) * 303 size += ((acpi_size) cid_list->count - 1) *
317 sizeof (struct acpi_compatible_id); 304 sizeof(struct acpi_compatible_id);
318 info->valid |= ACPI_VALID_CID; 305 info->valid |= ACPI_VALID_CID;
319 } 306 }
320 307
321 /* Execute the Device._STA method */ 308 /* Execute the Device._STA method */
322 309
323 status = acpi_ut_execute_STA (node, &info->current_status); 310 status = acpi_ut_execute_STA(node, &info->current_status);
324 if (ACPI_SUCCESS (status)) { 311 if (ACPI_SUCCESS(status)) {
325 info->valid |= ACPI_VALID_STA; 312 info->valid |= ACPI_VALID_STA;
326 } 313 }
327 314
328 /* Execute the Device._ADR method */ 315 /* Execute the Device._ADR method */
329 316
330 status = acpi_ut_evaluate_numeric_object (METHOD_NAME__ADR, node, 317 status = acpi_ut_evaluate_numeric_object(METHOD_NAME__ADR, node,
331 &info->address); 318 &info->address);
332 if (ACPI_SUCCESS (status)) { 319 if (ACPI_SUCCESS(status)) {
333 info->valid |= ACPI_VALID_ADR; 320 info->valid |= ACPI_VALID_ADR;
334 } 321 }
335 322
336 /* Execute the Device._sx_d methods */ 323 /* Execute the Device._sx_d methods */
337 324
338 status = acpi_ut_execute_sxds (node, info->highest_dstates); 325 status = acpi_ut_execute_sxds(node, info->highest_dstates);
339 if (ACPI_SUCCESS (status)) { 326 if (ACPI_SUCCESS(status)) {
340 info->valid |= ACPI_VALID_SXDS; 327 info->valid |= ACPI_VALID_SXDS;
341 } 328 }
342 } 329 }
343 330
344 /* Validate/Allocate/Clear caller buffer */ 331 /* Validate/Allocate/Clear caller buffer */
345 332
346 status = acpi_ut_initialize_buffer (buffer, size); 333 status = acpi_ut_initialize_buffer(buffer, size);
347 if (ACPI_FAILURE (status)) { 334 if (ACPI_FAILURE(status)) {
348 goto cleanup; 335 goto cleanup;
349 } 336 }
350 337
351 /* Populate the return buffer */ 338 /* Populate the return buffer */
352 339
353 return_info = buffer->pointer; 340 return_info = buffer->pointer;
354 ACPI_MEMCPY (return_info, info, sizeof (struct acpi_device_info)); 341 ACPI_MEMCPY(return_info, info, sizeof(struct acpi_device_info));
355 342
356 if (cid_list) { 343 if (cid_list) {
357 ACPI_MEMCPY (&return_info->compatibility_id, cid_list, cid_list->size); 344 ACPI_MEMCPY(&return_info->compatibility_id, cid_list,
345 cid_list->size);
358 } 346 }
359 347
360 348 cleanup:
361cleanup: 349 ACPI_MEM_FREE(info);
362 ACPI_MEM_FREE (info);
363 if (cid_list) { 350 if (cid_list) {
364 ACPI_MEM_FREE (cid_list); 351 ACPI_MEM_FREE(cid_list);
365 } 352 }
366 return (status); 353 return (status);
367} 354}
368EXPORT_SYMBOL(acpi_get_object_info);
369 355
356EXPORT_SYMBOL(acpi_get_object_info);