aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/acpi/events/evregion.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/acpi/events/evregion.c')
-rw-r--r--drivers/acpi/events/evregion.c65
1 files changed, 39 insertions, 26 deletions
diff --git a/drivers/acpi/events/evregion.c b/drivers/acpi/events/evregion.c
index edf9d2e1dff9..094a17e4c86d 100644
--- a/drivers/acpi/events/evregion.c
+++ b/drivers/acpi/events/evregion.c
@@ -193,8 +193,8 @@ acpi_status acpi_ev_initialize_op_regions(void)
193acpi_status 193acpi_status
194acpi_ev_execute_reg_method(union acpi_operand_object *region_obj, u32 function) 194acpi_ev_execute_reg_method(union acpi_operand_object *region_obj, u32 function)
195{ 195{
196 struct acpi_parameter_info info; 196 struct acpi_evaluate_info *info;
197 union acpi_operand_object *params[3]; 197 union acpi_operand_object *args[3];
198 union acpi_operand_object *region_obj2; 198 union acpi_operand_object *region_obj2;
199 acpi_status status; 199 acpi_status status;
200 200
@@ -209,47 +209,60 @@ acpi_ev_execute_reg_method(union acpi_operand_object *region_obj, u32 function)
209 return_ACPI_STATUS(AE_OK); 209 return_ACPI_STATUS(AE_OK);
210 } 210 }
211 211
212 /* Allocate and initialize the evaluation information block */
213
214 info = ACPI_ALLOCATE_ZEROED(sizeof(struct acpi_evaluate_info));
215 if (!info) {
216 return_ACPI_STATUS(AE_NO_MEMORY);
217 }
218
219 info->prefix_node = region_obj2->extra.method_REG;
220 info->pathname = NULL;
221 info->parameters = args;
222 info->parameter_type = ACPI_PARAM_ARGS;
223 info->flags = ACPI_IGNORE_RETURN_VALUE;
224
212 /* 225 /*
213 * The _REG method has two arguments: 226 * The _REG method has two arguments:
214 * 227 *
215 * Arg0, Integer: Operation region space ID 228 * Arg0 - Integer:
216 * Same value as region_obj->Region.space_id 229 * Operation region space ID Same value as region_obj->Region.space_id
217 * Arg1, Integer: connection status 230 *
218 * 1 for connecting the handler, 231 * Arg1 - Integer:
219 * 0 for disconnecting the handler 232 * connection status 1 for connecting the handler, 0 for disconnecting
220 * Passed as a parameter 233 * the handler (Passed as a parameter)
221 */ 234 */
222 params[0] = acpi_ut_create_internal_object(ACPI_TYPE_INTEGER); 235 args[0] = acpi_ut_create_internal_object(ACPI_TYPE_INTEGER);
223 if (!params[0]) { 236 if (!args[0]) {
224 return_ACPI_STATUS(AE_NO_MEMORY); 237 status = AE_NO_MEMORY;
238 goto cleanup1;
225 } 239 }
226 240
227 params[1] = acpi_ut_create_internal_object(ACPI_TYPE_INTEGER); 241 args[1] = acpi_ut_create_internal_object(ACPI_TYPE_INTEGER);
228 if (!params[1]) { 242 if (!args[1]) {
229 status = AE_NO_MEMORY; 243 status = AE_NO_MEMORY;
230 goto cleanup; 244 goto cleanup2;
231 } 245 }
232 246
233 /* Setup the parameter objects */ 247 /* Setup the parameter objects */
234 248
235 params[0]->integer.value = region_obj->region.space_id; 249 args[0]->integer.value = region_obj->region.space_id;
236 params[1]->integer.value = function; 250 args[1]->integer.value = function;
237 params[2] = NULL; 251 args[2] = NULL;
238
239 info.node = region_obj2->extra.method_REG;
240 info.parameters = params;
241 info.parameter_type = ACPI_PARAM_ARGS;
242 252
243 /* Execute the method, no return value */ 253 /* Execute the method, no return value */
244 254
245 ACPI_DEBUG_EXEC(acpi_ut_display_init_pathname 255 ACPI_DEBUG_EXEC(acpi_ut_display_init_pathname
246 (ACPI_TYPE_METHOD, info.node, NULL)); 256 (ACPI_TYPE_METHOD, info->prefix_node, NULL));
247 status = acpi_ns_evaluate_by_handle(&info); 257
258 status = acpi_ns_evaluate(info);
259 acpi_ut_remove_reference(args[1]);
248 260
249 acpi_ut_remove_reference(params[1]); 261 cleanup2:
262 acpi_ut_remove_reference(args[0]);
250 263
251 cleanup: 264 cleanup1:
252 acpi_ut_remove_reference(params[0]); 265 ACPI_FREE(info);
253 return_ACPI_STATUS(status); 266 return_ACPI_STATUS(status);
254} 267}
255 268