diff options
Diffstat (limited to 'drivers/acpi/namespace/nswalk.c')
| -rw-r--r-- | drivers/acpi/namespace/nswalk.c | 105 |
1 files changed, 50 insertions, 55 deletions
diff --git a/drivers/acpi/namespace/nswalk.c b/drivers/acpi/namespace/nswalk.c index f9a7277dca6e..5f164c0df33b 100644 --- a/drivers/acpi/namespace/nswalk.c +++ b/drivers/acpi/namespace/nswalk.c | |||
| @@ -41,14 +41,11 @@ | |||
| 41 | * POSSIBILITY OF SUCH DAMAGES. | 41 | * POSSIBILITY OF SUCH DAMAGES. |
| 42 | */ | 42 | */ |
| 43 | 43 | ||
| 44 | |||
| 45 | #include <acpi/acpi.h> | 44 | #include <acpi/acpi.h> |
| 46 | #include <acpi/acnamesp.h> | 45 | #include <acpi/acnamesp.h> |
| 47 | 46 | ||
| 48 | |||
| 49 | #define _COMPONENT ACPI_NAMESPACE | 47 | #define _COMPONENT ACPI_NAMESPACE |
| 50 | ACPI_MODULE_NAME ("nswalk") | 48 | ACPI_MODULE_NAME("nswalk") |
| 51 | |||
| 52 | 49 | ||
| 53 | /******************************************************************************* | 50 | /******************************************************************************* |
| 54 | * | 51 | * |
| @@ -68,18 +65,15 @@ | |||
| 68 | * within Scope is returned. | 65 | * within Scope is returned. |
| 69 | * | 66 | * |
| 70 | ******************************************************************************/ | 67 | ******************************************************************************/ |
| 71 | 68 | struct acpi_namespace_node *acpi_ns_get_next_node(acpi_object_type type, | |
| 72 | struct acpi_namespace_node * | 69 | struct acpi_namespace_node |
| 73 | acpi_ns_get_next_node ( | 70 | *parent_node, |
| 74 | acpi_object_type type, | 71 | struct acpi_namespace_node |
| 75 | struct acpi_namespace_node *parent_node, | 72 | *child_node) |
| 76 | struct acpi_namespace_node *child_node) | ||
| 77 | { | 73 | { |
| 78 | struct acpi_namespace_node *next_node = NULL; | 74 | struct acpi_namespace_node *next_node = NULL; |
| 79 | |||
| 80 | |||
| 81 | ACPI_FUNCTION_ENTRY (); | ||
| 82 | 75 | ||
| 76 | ACPI_FUNCTION_ENTRY(); | ||
| 83 | 77 | ||
| 84 | if (!child_node) { | 78 | if (!child_node) { |
| 85 | /* It's really the parent's _scope_ that we want */ | 79 | /* It's really the parent's _scope_ that we want */ |
| @@ -92,7 +86,7 @@ acpi_ns_get_next_node ( | |||
| 92 | else { | 86 | else { |
| 93 | /* Start search at the NEXT node */ | 87 | /* Start search at the NEXT node */ |
| 94 | 88 | ||
| 95 | next_node = acpi_ns_get_next_valid_node (child_node); | 89 | next_node = acpi_ns_get_next_valid_node(child_node); |
| 96 | } | 90 | } |
| 97 | 91 | ||
| 98 | /* If any type is OK, we are done */ | 92 | /* If any type is OK, we are done */ |
| @@ -114,7 +108,7 @@ acpi_ns_get_next_node ( | |||
| 114 | 108 | ||
| 115 | /* Otherwise, move on to the next node */ | 109 | /* Otherwise, move on to the next node */ |
| 116 | 110 | ||
| 117 | next_node = acpi_ns_get_next_valid_node (next_node); | 111 | next_node = acpi_ns_get_next_valid_node(next_node); |
| 118 | } | 112 | } |
| 119 | 113 | ||
| 120 | /* Not found */ | 114 | /* Not found */ |
| @@ -122,7 +116,6 @@ acpi_ns_get_next_node ( | |||
| 122 | return (NULL); | 116 | return (NULL); |
| 123 | } | 117 | } |
| 124 | 118 | ||
| 125 | |||
| 126 | /******************************************************************************* | 119 | /******************************************************************************* |
| 127 | * | 120 | * |
| 128 | * FUNCTION: acpi_ns_walk_namespace | 121 | * FUNCTION: acpi_ns_walk_namespace |
| @@ -154,25 +147,21 @@ acpi_ns_get_next_node ( | |||
| 154 | ******************************************************************************/ | 147 | ******************************************************************************/ |
| 155 | 148 | ||
| 156 | acpi_status | 149 | acpi_status |
| 157 | acpi_ns_walk_namespace ( | 150 | acpi_ns_walk_namespace(acpi_object_type type, |
| 158 | acpi_object_type type, | 151 | acpi_handle start_node, |
| 159 | acpi_handle start_node, | 152 | u32 max_depth, |
| 160 | u32 max_depth, | 153 | u8 unlock_before_callback, |
| 161 | u8 unlock_before_callback, | 154 | acpi_walk_callback user_function, |
| 162 | acpi_walk_callback user_function, | 155 | void *context, void **return_value) |
| 163 | void *context, | ||
| 164 | void **return_value) | ||
| 165 | { | 156 | { |
| 166 | acpi_status status; | 157 | acpi_status status; |
| 167 | acpi_status mutex_status; | 158 | acpi_status mutex_status; |
| 168 | struct acpi_namespace_node *child_node; | 159 | struct acpi_namespace_node *child_node; |
| 169 | struct acpi_namespace_node *parent_node; | 160 | struct acpi_namespace_node *parent_node; |
| 170 | acpi_object_type child_type; | 161 | acpi_object_type child_type; |
| 171 | u32 level; | 162 | u32 level; |
| 172 | |||
| 173 | |||
| 174 | ACPI_FUNCTION_TRACE ("ns_walk_namespace"); | ||
| 175 | 163 | ||
| 164 | ACPI_FUNCTION_TRACE("ns_walk_namespace"); | ||
| 176 | 165 | ||
| 177 | /* Special case for the namespace Root Node */ | 166 | /* Special case for the namespace Root Node */ |
| 178 | 167 | ||
| @@ -183,9 +172,9 @@ acpi_ns_walk_namespace ( | |||
| 183 | /* Null child means "get first node" */ | 172 | /* Null child means "get first node" */ |
| 184 | 173 | ||
| 185 | parent_node = start_node; | 174 | parent_node = start_node; |
| 186 | child_node = NULL; | 175 | child_node = NULL; |
| 187 | child_type = ACPI_TYPE_ANY; | 176 | child_type = ACPI_TYPE_ANY; |
| 188 | level = 1; | 177 | level = 1; |
| 189 | 178 | ||
| 190 | /* | 179 | /* |
| 191 | * Traverse the tree of nodes until we bubble back up to where we | 180 | * Traverse the tree of nodes until we bubble back up to where we |
| @@ -196,7 +185,9 @@ acpi_ns_walk_namespace ( | |||
| 196 | /* Get the next node in this scope. Null if not found */ | 185 | /* Get the next node in this scope. Null if not found */ |
| 197 | 186 | ||
| 198 | status = AE_OK; | 187 | status = AE_OK; |
| 199 | child_node = acpi_ns_get_next_node (ACPI_TYPE_ANY, parent_node, child_node); | 188 | child_node = |
| 189 | acpi_ns_get_next_node(ACPI_TYPE_ANY, parent_node, | ||
| 190 | child_node); | ||
| 200 | if (child_node) { | 191 | if (child_node) { |
| 201 | /* | 192 | /* |
| 202 | * Found node, Get the type if we are not | 193 | * Found node, Get the type if we are not |
| @@ -212,19 +203,25 @@ acpi_ns_walk_namespace ( | |||
| 212 | * callback function | 203 | * callback function |
| 213 | */ | 204 | */ |
| 214 | if (unlock_before_callback) { | 205 | if (unlock_before_callback) { |
| 215 | mutex_status = acpi_ut_release_mutex (ACPI_MTX_NAMESPACE); | 206 | mutex_status = |
| 216 | if (ACPI_FAILURE (mutex_status)) { | 207 | acpi_ut_release_mutex |
| 217 | return_ACPI_STATUS (mutex_status); | 208 | (ACPI_MTX_NAMESPACE); |
| 209 | if (ACPI_FAILURE(mutex_status)) { | ||
| 210 | return_ACPI_STATUS | ||
| 211 | (mutex_status); | ||
| 218 | } | 212 | } |
| 219 | } | 213 | } |
| 220 | 214 | ||
| 221 | status = user_function (child_node, level, | 215 | status = user_function(child_node, level, |
| 222 | context, return_value); | 216 | context, return_value); |
| 223 | 217 | ||
| 224 | if (unlock_before_callback) { | 218 | if (unlock_before_callback) { |
| 225 | mutex_status = acpi_ut_acquire_mutex (ACPI_MTX_NAMESPACE); | 219 | mutex_status = |
| 226 | if (ACPI_FAILURE (mutex_status)) { | 220 | acpi_ut_acquire_mutex |
| 227 | return_ACPI_STATUS (mutex_status); | 221 | (ACPI_MTX_NAMESPACE); |
| 222 | if (ACPI_FAILURE(mutex_status)) { | ||
| 223 | return_ACPI_STATUS | ||
| 224 | (mutex_status); | ||
| 228 | } | 225 | } |
| 229 | } | 226 | } |
| 230 | 227 | ||
| @@ -239,13 +236,13 @@ acpi_ns_walk_namespace ( | |||
| 239 | 236 | ||
| 240 | /* Exit now, with OK status */ | 237 | /* Exit now, with OK status */ |
| 241 | 238 | ||
| 242 | return_ACPI_STATUS (AE_OK); | 239 | return_ACPI_STATUS(AE_OK); |
| 243 | 240 | ||
| 244 | default: | 241 | default: |
| 245 | 242 | ||
| 246 | /* All others are valid exceptions */ | 243 | /* All others are valid exceptions */ |
| 247 | 244 | ||
| 248 | return_ACPI_STATUS (status); | 245 | return_ACPI_STATUS(status); |
| 249 | } | 246 | } |
| 250 | } | 247 | } |
| 251 | 248 | ||
| @@ -258,7 +255,8 @@ acpi_ns_walk_namespace ( | |||
| 258 | * maximum depth has been reached. | 255 | * maximum depth has been reached. |
| 259 | */ | 256 | */ |
| 260 | if ((level < max_depth) && (status != AE_CTRL_DEPTH)) { | 257 | if ((level < max_depth) && (status != AE_CTRL_DEPTH)) { |
| 261 | if (acpi_ns_get_next_node (ACPI_TYPE_ANY, child_node, NULL)) { | 258 | if (acpi_ns_get_next_node |
| 259 | (ACPI_TYPE_ANY, child_node, NULL)) { | ||
| 262 | /* | 260 | /* |
| 263 | * There is at least one child of this | 261 | * There is at least one child of this |
| 264 | * node, visit the onde | 262 | * node, visit the onde |
| @@ -268,8 +266,7 @@ acpi_ns_walk_namespace ( | |||
| 268 | child_node = NULL; | 266 | child_node = NULL; |
| 269 | } | 267 | } |
| 270 | } | 268 | } |
| 271 | } | 269 | } else { |
| 272 | else { | ||
| 273 | /* | 270 | /* |
| 274 | * No more children of this node (acpi_ns_get_next_node | 271 | * No more children of this node (acpi_ns_get_next_node |
| 275 | * failed), go back upwards in the namespace tree to | 272 | * failed), go back upwards in the namespace tree to |
| @@ -277,13 +274,11 @@ acpi_ns_walk_namespace ( | |||
| 277 | */ | 274 | */ |
| 278 | level--; | 275 | level--; |
| 279 | child_node = parent_node; | 276 | child_node = parent_node; |
| 280 | parent_node = acpi_ns_get_parent_node (parent_node); | 277 | parent_node = acpi_ns_get_parent_node(parent_node); |
| 281 | } | 278 | } |
| 282 | } | 279 | } |
| 283 | 280 | ||
| 284 | /* Complete walk, not terminated by user function */ | 281 | /* Complete walk, not terminated by user function */ |
| 285 | 282 | ||
| 286 | return_ACPI_STATUS (AE_OK); | 283 | return_ACPI_STATUS(AE_OK); |
| 287 | } | 284 | } |
| 288 | |||
| 289 | |||
