diff options
Diffstat (limited to 'drivers/acpi/utilities/uteval.c')
-rw-r--r-- | drivers/acpi/utilities/uteval.c | 45 |
1 files changed, 28 insertions, 17 deletions
diff --git a/drivers/acpi/utilities/uteval.c b/drivers/acpi/utilities/uteval.c index 444d3a502c46..d6d7121583c0 100644 --- a/drivers/acpi/utilities/uteval.c +++ b/drivers/acpi/utilities/uteval.c | |||
@@ -181,19 +181,26 @@ acpi_ut_evaluate_object(struct acpi_namespace_node *prefix_node, | |||
181 | u32 expected_return_btypes, | 181 | u32 expected_return_btypes, |
182 | union acpi_operand_object **return_desc) | 182 | union acpi_operand_object **return_desc) |
183 | { | 183 | { |
184 | struct acpi_parameter_info info; | 184 | struct acpi_evaluate_info *info; |
185 | acpi_status status; | 185 | acpi_status status; |
186 | u32 return_btype; | 186 | u32 return_btype; |
187 | 187 | ||
188 | ACPI_FUNCTION_TRACE(ut_evaluate_object); | 188 | ACPI_FUNCTION_TRACE(ut_evaluate_object); |
189 | 189 | ||
190 | info.node = prefix_node; | 190 | /* Allocate the evaluation information block */ |
191 | info.parameters = NULL; | 191 | |
192 | info.parameter_type = ACPI_PARAM_ARGS; | 192 | info = ACPI_ALLOCATE_ZEROED(sizeof(struct acpi_evaluate_info)); |
193 | if (!info) { | ||
194 | return_ACPI_STATUS(AE_NO_MEMORY); | ||
195 | } | ||
196 | |||
197 | info->prefix_node = prefix_node; | ||
198 | info->pathname = path; | ||
199 | info->parameter_type = ACPI_PARAM_ARGS; | ||
193 | 200 | ||
194 | /* Evaluate the object/method */ | 201 | /* Evaluate the object/method */ |
195 | 202 | ||
196 | status = acpi_ns_evaluate_relative(path, &info); | 203 | status = acpi_ns_evaluate(info); |
197 | if (ACPI_FAILURE(status)) { | 204 | if (ACPI_FAILURE(status)) { |
198 | if (status == AE_NOT_FOUND) { | 205 | if (status == AE_NOT_FOUND) { |
199 | ACPI_DEBUG_PRINT((ACPI_DB_EXEC, | 206 | ACPI_DEBUG_PRINT((ACPI_DB_EXEC, |
@@ -205,25 +212,25 @@ acpi_ut_evaluate_object(struct acpi_namespace_node *prefix_node, | |||
205 | prefix_node, path, status); | 212 | prefix_node, path, status); |
206 | } | 213 | } |
207 | 214 | ||
208 | return_ACPI_STATUS(status); | 215 | goto cleanup; |
209 | } | 216 | } |
210 | 217 | ||
211 | /* Did we get a return object? */ | 218 | /* Did we get a return object? */ |
212 | 219 | ||
213 | if (!info.return_object) { | 220 | if (!info->return_object) { |
214 | if (expected_return_btypes) { | 221 | if (expected_return_btypes) { |
215 | ACPI_ERROR_METHOD("No object was returned from", | 222 | ACPI_ERROR_METHOD("No object was returned from", |
216 | prefix_node, path, AE_NOT_EXIST); | 223 | prefix_node, path, AE_NOT_EXIST); |
217 | 224 | ||
218 | return_ACPI_STATUS(AE_NOT_EXIST); | 225 | status = AE_NOT_EXIST; |
219 | } | 226 | } |
220 | 227 | ||
221 | return_ACPI_STATUS(AE_OK); | 228 | goto cleanup; |
222 | } | 229 | } |
223 | 230 | ||
224 | /* Map the return object type to the bitmapped type */ | 231 | /* Map the return object type to the bitmapped type */ |
225 | 232 | ||
226 | switch (ACPI_GET_OBJECT_TYPE(info.return_object)) { | 233 | switch (ACPI_GET_OBJECT_TYPE(info->return_object)) { |
227 | case ACPI_TYPE_INTEGER: | 234 | case ACPI_TYPE_INTEGER: |
228 | return_btype = ACPI_BTYPE_INTEGER; | 235 | return_btype = ACPI_BTYPE_INTEGER; |
229 | break; | 236 | break; |
@@ -251,8 +258,8 @@ acpi_ut_evaluate_object(struct acpi_namespace_node *prefix_node, | |||
251 | * happen frequently if the "implicit return" feature is enabled. | 258 | * happen frequently if the "implicit return" feature is enabled. |
252 | * Just delete the return object and return AE_OK. | 259 | * Just delete the return object and return AE_OK. |
253 | */ | 260 | */ |
254 | acpi_ut_remove_reference(info.return_object); | 261 | acpi_ut_remove_reference(info->return_object); |
255 | return_ACPI_STATUS(AE_OK); | 262 | goto cleanup; |
256 | } | 263 | } |
257 | 264 | ||
258 | /* Is the return object one of the expected types? */ | 265 | /* Is the return object one of the expected types? */ |
@@ -264,19 +271,23 @@ acpi_ut_evaluate_object(struct acpi_namespace_node *prefix_node, | |||
264 | ACPI_ERROR((AE_INFO, | 271 | ACPI_ERROR((AE_INFO, |
265 | "Type returned from %s was incorrect: %s, expected Btypes: %X", | 272 | "Type returned from %s was incorrect: %s, expected Btypes: %X", |
266 | path, | 273 | path, |
267 | acpi_ut_get_object_type_name(info.return_object), | 274 | acpi_ut_get_object_type_name(info->return_object), |
268 | expected_return_btypes)); | 275 | expected_return_btypes)); |
269 | 276 | ||
270 | /* On error exit, we must delete the return object */ | 277 | /* On error exit, we must delete the return object */ |
271 | 278 | ||
272 | acpi_ut_remove_reference(info.return_object); | 279 | acpi_ut_remove_reference(info->return_object); |
273 | return_ACPI_STATUS(AE_TYPE); | 280 | status = AE_TYPE; |
281 | goto cleanup; | ||
274 | } | 282 | } |
275 | 283 | ||
276 | /* Object type is OK, return it */ | 284 | /* Object type is OK, return it */ |
277 | 285 | ||
278 | *return_desc = info.return_object; | 286 | *return_desc = info->return_object; |
279 | return_ACPI_STATUS(AE_OK); | 287 | |
288 | cleanup: | ||
289 | ACPI_FREE(info); | ||
290 | return_ACPI_STATUS(status); | ||
280 | } | 291 | } |
281 | 292 | ||
282 | /******************************************************************************* | 293 | /******************************************************************************* |