aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/acpi/events
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/acpi/events')
-rw-r--r--drivers/acpi/events/evevent.c10
-rw-r--r--drivers/acpi/events/evgpe.c85
-rw-r--r--drivers/acpi/events/evgpeblk.c96
-rw-r--r--drivers/acpi/events/evmisc.c41
-rw-r--r--drivers/acpi/events/evregion.c115
-rw-r--r--drivers/acpi/events/evrgnini.c48
-rw-r--r--drivers/acpi/events/evsci.c8
-rw-r--r--drivers/acpi/events/evxface.c49
-rw-r--r--drivers/acpi/events/evxfevnt.c67
-rw-r--r--drivers/acpi/events/evxfregn.c15
10 files changed, 309 insertions, 225 deletions
diff --git a/drivers/acpi/events/evevent.c b/drivers/acpi/events/evevent.c
index c9ac05c4685f..919037d6acff 100644
--- a/drivers/acpi/events/evevent.c
+++ b/drivers/acpi/events/evevent.c
@@ -68,7 +68,7 @@ acpi_status acpi_ev_initialize_events(void)
68{ 68{
69 acpi_status status; 69 acpi_status status;
70 70
71 ACPI_FUNCTION_TRACE("ev_initialize_events"); 71 ACPI_FUNCTION_TRACE(ev_initialize_events);
72 72
73 /* Make sure we have ACPI tables */ 73 /* Make sure we have ACPI tables */
74 74
@@ -118,7 +118,7 @@ acpi_status acpi_ev_install_fadt_gpes(void)
118{ 118{
119 acpi_status status; 119 acpi_status status;
120 120
121 ACPI_FUNCTION_TRACE("ev_install_fadt_gpes"); 121 ACPI_FUNCTION_TRACE(ev_install_fadt_gpes);
122 122
123 /* Namespace must be locked */ 123 /* Namespace must be locked */
124 124
@@ -157,7 +157,7 @@ acpi_status acpi_ev_install_xrupt_handlers(void)
157{ 157{
158 acpi_status status; 158 acpi_status status;
159 159
160 ACPI_FUNCTION_TRACE("ev_install_xrupt_handlers"); 160 ACPI_FUNCTION_TRACE(ev_install_xrupt_handlers);
161 161
162 /* Install the SCI handler */ 162 /* Install the SCI handler */
163 163
@@ -241,7 +241,7 @@ u32 acpi_ev_fixed_event_detect(void)
241 u32 fixed_enable; 241 u32 fixed_enable;
242 acpi_native_uint i; 242 acpi_native_uint i;
243 243
244 ACPI_FUNCTION_NAME("ev_fixed_event_detect"); 244 ACPI_FUNCTION_NAME(ev_fixed_event_detect);
245 245
246 /* 246 /*
247 * Read the fixed feature status and enable registers, as all the cases 247 * Read the fixed feature status and enable registers, as all the cases
@@ -260,12 +260,14 @@ u32 acpi_ev_fixed_event_detect(void)
260 * Check for all possible Fixed Events and dispatch those that are active 260 * Check for all possible Fixed Events and dispatch those that are active
261 */ 261 */
262 for (i = 0; i < ACPI_NUM_FIXED_EVENTS; i++) { 262 for (i = 0; i < ACPI_NUM_FIXED_EVENTS; i++) {
263
263 /* Both the status and enable bits must be on for this event */ 264 /* Both the status and enable bits must be on for this event */
264 265
265 if ((fixed_status & acpi_gbl_fixed_event_info[i]. 266 if ((fixed_status & acpi_gbl_fixed_event_info[i].
266 status_bit_mask) 267 status_bit_mask)
267 && (fixed_enable & acpi_gbl_fixed_event_info[i]. 268 && (fixed_enable & acpi_gbl_fixed_event_info[i].
268 enable_bit_mask)) { 269 enable_bit_mask)) {
270
269 /* Found an active (signalled) event */ 271 /* Found an active (signalled) event */
270 272
271 int_status |= acpi_ev_fixed_event_dispatch((u32) i); 273 int_status |= acpi_ev_fixed_event_dispatch((u32) i);
diff --git a/drivers/acpi/events/evgpe.c b/drivers/acpi/events/evgpe.c
index f64f977dd3d5..f01d339407f8 100644
--- a/drivers/acpi/events/evgpe.c
+++ b/drivers/acpi/events/evgpe.c
@@ -69,7 +69,7 @@ acpi_ev_set_gpe_type(struct acpi_gpe_event_info *gpe_event_info, u8 type)
69{ 69{
70 acpi_status status; 70 acpi_status status;
71 71
72 ACPI_FUNCTION_TRACE("ev_set_gpe_type"); 72 ACPI_FUNCTION_TRACE(ev_set_gpe_type);
73 73
74 /* Validate type and update register enable masks */ 74 /* Validate type and update register enable masks */
75 75
@@ -115,7 +115,7 @@ acpi_ev_update_gpe_enable_masks(struct acpi_gpe_event_info *gpe_event_info,
115 struct acpi_gpe_register_info *gpe_register_info; 115 struct acpi_gpe_register_info *gpe_register_info;
116 u8 register_bit; 116 u8 register_bit;
117 117
118 ACPI_FUNCTION_TRACE("ev_update_gpe_enable_masks"); 118 ACPI_FUNCTION_TRACE(ev_update_gpe_enable_masks);
119 119
120 gpe_register_info = gpe_event_info->register_info; 120 gpe_register_info = gpe_event_info->register_info;
121 if (!gpe_register_info) { 121 if (!gpe_register_info) {
@@ -178,7 +178,7 @@ acpi_ev_enable_gpe(struct acpi_gpe_event_info *gpe_event_info,
178{ 178{
179 acpi_status status; 179 acpi_status status;
180 180
181 ACPI_FUNCTION_TRACE("ev_enable_gpe"); 181 ACPI_FUNCTION_TRACE(ev_enable_gpe);
182 182
183 /* Make sure HW enable masks are updated */ 183 /* Make sure HW enable masks are updated */
184 184
@@ -207,6 +207,7 @@ acpi_ev_enable_gpe(struct acpi_gpe_event_info *gpe_event_info,
207 ACPI_SET_BIT(gpe_event_info->flags, ACPI_GPE_RUN_ENABLED); 207 ACPI_SET_BIT(gpe_event_info->flags, ACPI_GPE_RUN_ENABLED);
208 208
209 if (write_to_hardware) { 209 if (write_to_hardware) {
210
210 /* Clear the GPE (of stale events), then enable it */ 211 /* Clear the GPE (of stale events), then enable it */
211 212
212 status = acpi_hw_clear_gpe(gpe_event_info); 213 status = acpi_hw_clear_gpe(gpe_event_info);
@@ -243,7 +244,7 @@ acpi_status acpi_ev_disable_gpe(struct acpi_gpe_event_info *gpe_event_info)
243{ 244{
244 acpi_status status; 245 acpi_status status;
245 246
246 ACPI_FUNCTION_TRACE("ev_disable_gpe"); 247 ACPI_FUNCTION_TRACE(ev_disable_gpe);
247 248
248 if (!(gpe_event_info->flags & ACPI_GPE_ENABLE_MASK)) { 249 if (!(gpe_event_info->flags & ACPI_GPE_ENABLE_MASK)) {
249 return_ACPI_STATUS(AE_OK); 250 return_ACPI_STATUS(AE_OK);
@@ -313,6 +314,7 @@ struct acpi_gpe_event_info *acpi_ev_get_gpe_event_info(acpi_handle gpe_device,
313 /* A NULL gpe_block means use the FADT-defined GPE block(s) */ 314 /* A NULL gpe_block means use the FADT-defined GPE block(s) */
314 315
315 if (!gpe_device) { 316 if (!gpe_device) {
317
316 /* Examine GPE Block 0 and 1 (These blocks are permanent) */ 318 /* Examine GPE Block 0 and 1 (These blocks are permanent) */
317 319
318 for (i = 0; i < ACPI_MAX_GPE_BLOCKS; i++) { 320 for (i = 0; i < ACPI_MAX_GPE_BLOCKS; i++) {
@@ -380,10 +382,11 @@ u32 acpi_ev_gpe_detect(struct acpi_gpe_xrupt_info * gpe_xrupt_list)
380 u32 status_reg; 382 u32 status_reg;
381 u32 enable_reg; 383 u32 enable_reg;
382 acpi_cpu_flags flags; 384 acpi_cpu_flags flags;
385 acpi_cpu_flags hw_flags;
383 acpi_native_uint i; 386 acpi_native_uint i;
384 acpi_native_uint j; 387 acpi_native_uint j;
385 388
386 ACPI_FUNCTION_NAME("ev_gpe_detect"); 389 ACPI_FUNCTION_NAME(ev_gpe_detect);
387 390
388 /* Check for the case where there are no GPEs */ 391 /* Check for the case where there are no GPEs */
389 392
@@ -391,9 +394,12 @@ u32 acpi_ev_gpe_detect(struct acpi_gpe_xrupt_info * gpe_xrupt_list)
391 return (int_status); 394 return (int_status);
392 } 395 }
393 396
394 /* Examine all GPE blocks attached to this interrupt level */ 397 /* We need to hold the GPE lock now, hardware lock in the loop */
395 398
396 flags = acpi_os_acquire_lock(acpi_gbl_gpe_lock); 399 flags = acpi_os_acquire_lock(acpi_gbl_gpe_lock);
400
401 /* Examine all GPE blocks attached to this interrupt level */
402
397 gpe_block = gpe_xrupt_list->gpe_block_list_head; 403 gpe_block = gpe_xrupt_list->gpe_block_list_head;
398 while (gpe_block) { 404 while (gpe_block) {
399 /* 405 /*
@@ -402,10 +408,13 @@ u32 acpi_ev_gpe_detect(struct acpi_gpe_xrupt_info * gpe_xrupt_list)
402 * Find all currently active GP events. 408 * Find all currently active GP events.
403 */ 409 */
404 for (i = 0; i < gpe_block->register_count; i++) { 410 for (i = 0; i < gpe_block->register_count; i++) {
411
405 /* Get the next status/enable pair */ 412 /* Get the next status/enable pair */
406 413
407 gpe_register_info = &gpe_block->register_info[i]; 414 gpe_register_info = &gpe_block->register_info[i];
408 415
416 hw_flags = acpi_os_acquire_lock(acpi_gbl_hardware_lock);
417
409 /* Read the Status Register */ 418 /* Read the Status Register */
410 419
411 status = 420 status =
@@ -414,6 +423,8 @@ u32 acpi_ev_gpe_detect(struct acpi_gpe_xrupt_info * gpe_xrupt_list)
414 &gpe_register_info-> 423 &gpe_register_info->
415 status_address); 424 status_address);
416 if (ACPI_FAILURE(status)) { 425 if (ACPI_FAILURE(status)) {
426 acpi_os_release_lock(acpi_gbl_hardware_lock,
427 hw_flags);
417 goto unlock_and_exit; 428 goto unlock_and_exit;
418 } 429 }
419 430
@@ -424,6 +435,8 @@ u32 acpi_ev_gpe_detect(struct acpi_gpe_xrupt_info * gpe_xrupt_list)
424 &enable_reg, 435 &enable_reg,
425 &gpe_register_info-> 436 &gpe_register_info->
426 enable_address); 437 enable_address);
438 acpi_os_release_lock(acpi_gbl_hardware_lock, hw_flags);
439
427 if (ACPI_FAILURE(status)) { 440 if (ACPI_FAILURE(status)) {
428 goto unlock_and_exit; 441 goto unlock_and_exit;
429 } 442 }
@@ -437,6 +450,7 @@ u32 acpi_ev_gpe_detect(struct acpi_gpe_xrupt_info * gpe_xrupt_list)
437 450
438 enabled_status_byte = (u8) (status_reg & enable_reg); 451 enabled_status_byte = (u8) (status_reg & enable_reg);
439 if (!enabled_status_byte) { 452 if (!enabled_status_byte) {
453
440 /* No active GPEs in this register, move on */ 454 /* No active GPEs in this register, move on */
441 455
442 continue; 456 continue;
@@ -445,6 +459,7 @@ u32 acpi_ev_gpe_detect(struct acpi_gpe_xrupt_info * gpe_xrupt_list)
445 /* Now look at the individual GPEs in this byte register */ 459 /* Now look at the individual GPEs in this byte register */
446 460
447 for (j = 0; j < ACPI_GPE_REGISTER_WIDTH; j++) { 461 for (j = 0; j < ACPI_GPE_REGISTER_WIDTH; j++) {
462
448 /* Examine one GPE bit */ 463 /* Examine one GPE bit */
449 464
450 if (enabled_status_byte & 465 if (enabled_status_byte &
@@ -483,9 +498,9 @@ u32 acpi_ev_gpe_detect(struct acpi_gpe_xrupt_info * gpe_xrupt_list)
483 * 498 *
484 * RETURN: None 499 * RETURN: None
485 * 500 *
486 * DESCRIPTION: Perform the actual execution of a GPE control method. This 501 * DESCRIPTION: Perform the actual execution of a GPE control method. This
487 * function is called from an invocation of acpi_os_queue_for_execution 502 * function is called from an invocation of acpi_os_execute and
488 * (and therefore does NOT execute at interrupt level) so that 503 * therefore does NOT execute at interrupt level - so that
489 * the control method itself is not executed in the context of 504 * the control method itself is not executed in the context of
490 * an interrupt handler. 505 * an interrupt handler.
491 * 506 *
@@ -494,12 +509,11 @@ u32 acpi_ev_gpe_detect(struct acpi_gpe_xrupt_info * gpe_xrupt_list)
494static void ACPI_SYSTEM_XFACE acpi_ev_asynch_execute_gpe_method(void *context) 509static void ACPI_SYSTEM_XFACE acpi_ev_asynch_execute_gpe_method(void *context)
495{ 510{
496 struct acpi_gpe_event_info *gpe_event_info = (void *)context; 511 struct acpi_gpe_event_info *gpe_event_info = (void *)context;
497 u32 gpe_number = 0;
498 acpi_status status; 512 acpi_status status;
499 struct acpi_gpe_event_info local_gpe_event_info; 513 struct acpi_gpe_event_info local_gpe_event_info;
500 struct acpi_parameter_info info; 514 struct acpi_evaluate_info *info;
501 515
502 ACPI_FUNCTION_TRACE("ev_asynch_execute_gpe_method"); 516 ACPI_FUNCTION_TRACE(ev_asynch_execute_gpe_method);
503 517
504 status = acpi_ut_acquire_mutex(ACPI_MTX_EVENTS); 518 status = acpi_ut_acquire_mutex(ACPI_MTX_EVENTS);
505 if (ACPI_FAILURE(status)) { 519 if (ACPI_FAILURE(status)) {
@@ -535,22 +549,35 @@ static void ACPI_SYSTEM_XFACE acpi_ev_asynch_execute_gpe_method(void *context)
535 */ 549 */
536 if ((local_gpe_event_info.flags & ACPI_GPE_DISPATCH_MASK) == 550 if ((local_gpe_event_info.flags & ACPI_GPE_DISPATCH_MASK) ==
537 ACPI_GPE_DISPATCH_METHOD) { 551 ACPI_GPE_DISPATCH_METHOD) {
538 /*
539 * Invoke the GPE Method (_Lxx, _Exx) i.e., evaluate the _Lxx/_Exx
540 * control method that corresponds to this GPE
541 */
542 info.node = local_gpe_event_info.dispatch.method_node;
543 info.parameters =
544 ACPI_CAST_PTR(union acpi_operand_object *, gpe_event_info);
545 info.parameter_type = ACPI_PARAM_GPE;
546 552
547 status = acpi_ns_evaluate_by_handle(&info); 553 /* Allocate the evaluation information block */
554
555 info = ACPI_ALLOCATE_ZEROED(sizeof(struct acpi_evaluate_info));
556 if (!info) {
557 status = AE_NO_MEMORY;
558 } else {
559 /*
560 * Invoke the GPE Method (_Lxx, _Exx) i.e., evaluate the _Lxx/_Exx
561 * control method that corresponds to this GPE
562 */
563 info->prefix_node =
564 local_gpe_event_info.dispatch.method_node;
565 info->parameters =
566 ACPI_CAST_PTR(union acpi_operand_object *,
567 gpe_event_info);
568 info->parameter_type = ACPI_PARAM_GPE;
569 info->flags = ACPI_IGNORE_RETURN_VALUE;
570
571 status = acpi_ns_evaluate(info);
572 ACPI_FREE(info);
573 }
574
548 if (ACPI_FAILURE(status)) { 575 if (ACPI_FAILURE(status)) {
549 ACPI_EXCEPTION((AE_INFO, status, 576 ACPI_EXCEPTION((AE_INFO, status,
550 "While evaluating method [%4.4s] for GPE[%2X]", 577 "While evaluating GPE method [%4.4s]",
551 acpi_ut_get_node_name 578 acpi_ut_get_node_name
552 (local_gpe_event_info.dispatch. 579 (local_gpe_event_info.dispatch.
553 method_node), gpe_number)); 580 method_node)));
554 } 581 }
555 } 582 }
556 583
@@ -593,7 +620,7 @@ acpi_ev_gpe_dispatch(struct acpi_gpe_event_info *gpe_event_info, u32 gpe_number)
593{ 620{
594 acpi_status status; 621 acpi_status status;
595 622
596 ACPI_FUNCTION_TRACE("ev_gpe_dispatch"); 623 ACPI_FUNCTION_TRACE(ev_gpe_dispatch);
597 624
598 /* 625 /*
599 * If edge-triggered, clear the GPE status bit now. Note that 626 * If edge-triggered, clear the GPE status bit now. Note that
@@ -669,9 +696,9 @@ acpi_ev_gpe_dispatch(struct acpi_gpe_event_info *gpe_event_info, u32 gpe_number)
669 * Execute the method associated with the GPE 696 * Execute the method associated with the GPE
670 * NOTE: Level-triggered GPEs are cleared after the method completes. 697 * NOTE: Level-triggered GPEs are cleared after the method completes.
671 */ 698 */
672 status = acpi_os_queue_for_execution(OSD_PRIORITY_GPE, 699 status = acpi_os_execute(OSL_GPE_HANDLER,
673 acpi_ev_asynch_execute_gpe_method, 700 acpi_ev_asynch_execute_gpe_method,
674 gpe_event_info); 701 gpe_event_info);
675 if (ACPI_FAILURE(status)) { 702 if (ACPI_FAILURE(status)) {
676 ACPI_EXCEPTION((AE_INFO, status, 703 ACPI_EXCEPTION((AE_INFO, status,
677 "Unable to queue handler for GPE[%2X] - event disabled", 704 "Unable to queue handler for GPE[%2X] - event disabled",
@@ -716,7 +743,7 @@ acpi_ev_gpe_dispatch(struct acpi_gpe_event_info *gpe_event_info, u32 gpe_number)
716 * 743 *
717 * DESCRIPTION: Determine if a a GPE is "wake-only". 744 * DESCRIPTION: Determine if a a GPE is "wake-only".
718 * 745 *
719 * Called from Notify() code in interpreter when a "device_wake" 746 * Called from Notify() code in interpreter when a "DeviceWake"
720 * Notify comes in. 747 * Notify comes in.
721 * 748 *
722 ******************************************************************************/ 749 ******************************************************************************/
@@ -726,7 +753,7 @@ acpi_ev_check_for_wake_only_gpe(struct acpi_gpe_event_info *gpe_event_info)
726{ 753{
727 acpi_status status; 754 acpi_status status;
728 755
729 ACPI_FUNCTION_TRACE("ev_check_for_wake_only_gpe"); 756 ACPI_FUNCTION_TRACE(ev_check_for_wake_only_gpe);
730 757
731 if ((gpe_event_info) && /* Only >0 for _Lxx/_Exx */ 758 if ((gpe_event_info) && /* Only >0 for _Lxx/_Exx */
732 ((gpe_event_info->flags & ACPI_GPE_SYSTEM_MASK) == ACPI_GPE_SYSTEM_RUNNING)) { /* System state at GPE time */ 759 ((gpe_event_info->flags & ACPI_GPE_SYSTEM_MASK) == ACPI_GPE_SYSTEM_RUNNING)) { /* System state at GPE time */
diff --git a/drivers/acpi/events/evgpeblk.c b/drivers/acpi/events/evgpeblk.c
index 0fd00b5ad650..95ddeb48bc0f 100644
--- a/drivers/acpi/events/evgpeblk.c
+++ b/drivers/acpi/events/evgpeblk.c
@@ -131,14 +131,14 @@ u8 acpi_ev_valid_gpe_event(struct acpi_gpe_event_info *gpe_event_info)
131 * 131 *
132 ******************************************************************************/ 132 ******************************************************************************/
133 133
134acpi_status acpi_ev_walk_gpe_list(ACPI_GPE_CALLBACK gpe_walk_callback) 134acpi_status acpi_ev_walk_gpe_list(acpi_gpe_callback gpe_walk_callback)
135{ 135{
136 struct acpi_gpe_block_info *gpe_block; 136 struct acpi_gpe_block_info *gpe_block;
137 struct acpi_gpe_xrupt_info *gpe_xrupt_info; 137 struct acpi_gpe_xrupt_info *gpe_xrupt_info;
138 acpi_status status = AE_OK; 138 acpi_status status = AE_OK;
139 acpi_cpu_flags flags; 139 acpi_cpu_flags flags;
140 140
141 ACPI_FUNCTION_TRACE("ev_walk_gpe_list"); 141 ACPI_FUNCTION_TRACE(ev_walk_gpe_list);
142 142
143 flags = acpi_os_acquire_lock(acpi_gbl_gpe_lock); 143 flags = acpi_os_acquire_lock(acpi_gbl_gpe_lock);
144 144
@@ -146,10 +146,12 @@ acpi_status acpi_ev_walk_gpe_list(ACPI_GPE_CALLBACK gpe_walk_callback)
146 146
147 gpe_xrupt_info = acpi_gbl_gpe_xrupt_list_head; 147 gpe_xrupt_info = acpi_gbl_gpe_xrupt_list_head;
148 while (gpe_xrupt_info) { 148 while (gpe_xrupt_info) {
149
149 /* Walk all Gpe Blocks attached to this interrupt level */ 150 /* Walk all Gpe Blocks attached to this interrupt level */
150 151
151 gpe_block = gpe_xrupt_info->gpe_block_list_head; 152 gpe_block = gpe_xrupt_info->gpe_block_list_head;
152 while (gpe_block) { 153 while (gpe_block) {
154
153 /* One callback per GPE block */ 155 /* One callback per GPE block */
154 156
155 status = gpe_walk_callback(gpe_xrupt_info, gpe_block); 157 status = gpe_walk_callback(gpe_xrupt_info, gpe_block);
@@ -190,11 +192,12 @@ acpi_ev_delete_gpe_handlers(struct acpi_gpe_xrupt_info *gpe_xrupt_info,
190 acpi_native_uint i; 192 acpi_native_uint i;
191 acpi_native_uint j; 193 acpi_native_uint j;
192 194
193 ACPI_FUNCTION_TRACE("ev_delete_gpe_handlers"); 195 ACPI_FUNCTION_TRACE(ev_delete_gpe_handlers);
194 196
195 /* Examine each GPE Register within the block */ 197 /* Examine each GPE Register within the block */
196 198
197 for (i = 0; i < gpe_block->register_count; i++) { 199 for (i = 0; i < gpe_block->register_count; i++) {
200
198 /* Now look at the individual GPEs in this byte register */ 201 /* Now look at the individual GPEs in this byte register */
199 202
200 for (j = 0; j < ACPI_GPE_REGISTER_WIDTH; j++) { 203 for (j = 0; j < ACPI_GPE_REGISTER_WIDTH; j++) {
@@ -204,7 +207,7 @@ acpi_ev_delete_gpe_handlers(struct acpi_gpe_xrupt_info *gpe_xrupt_info,
204 207
205 if ((gpe_event_info->flags & ACPI_GPE_DISPATCH_MASK) == 208 if ((gpe_event_info->flags & ACPI_GPE_DISPATCH_MASK) ==
206 ACPI_GPE_DISPATCH_HANDLER) { 209 ACPI_GPE_DISPATCH_HANDLER) {
207 ACPI_MEM_FREE(gpe_event_info->dispatch.handler); 210 ACPI_FREE(gpe_event_info->dispatch.handler);
208 gpe_event_info->dispatch.handler = NULL; 211 gpe_event_info->dispatch.handler = NULL;
209 gpe_event_info->flags &= 212 gpe_event_info->flags &=
210 ~ACPI_GPE_DISPATCH_MASK; 213 ~ACPI_GPE_DISPATCH_MASK;
@@ -248,7 +251,7 @@ acpi_ev_save_method_info(acpi_handle obj_handle,
248 u8 type; 251 u8 type;
249 acpi_status status; 252 acpi_status status;
250 253
251 ACPI_FUNCTION_TRACE("ev_save_method_info"); 254 ACPI_FUNCTION_TRACE(ev_save_method_info);
252 255
253 /* 256 /*
254 * _Lxx and _Exx GPE method support 257 * _Lxx and _Exx GPE method support
@@ -279,9 +282,9 @@ acpi_ev_save_method_info(acpi_handle obj_handle,
279 default: 282 default:
280 /* Unknown method type, just ignore it! */ 283 /* Unknown method type, just ignore it! */
281 284
282 ACPI_ERROR((AE_INFO, 285 ACPI_DEBUG_PRINT((ACPI_DB_LOAD,
283 "Unknown GPE method type: %s (name not of form _Lxx or _Exx)", 286 "Ignoring unknown GPE method type: %s (name not of form _Lxx or _Exx)",
284 name)); 287 name));
285 return_ACPI_STATUS(AE_OK); 288 return_ACPI_STATUS(AE_OK);
286 } 289 }
287 290
@@ -289,11 +292,12 @@ acpi_ev_save_method_info(acpi_handle obj_handle,
289 292
290 gpe_number = ACPI_STRTOUL(&name[2], NULL, 16); 293 gpe_number = ACPI_STRTOUL(&name[2], NULL, 16);
291 if (gpe_number == ACPI_UINT32_MAX) { 294 if (gpe_number == ACPI_UINT32_MAX) {
295
292 /* Conversion failed; invalid method, just ignore it */ 296 /* Conversion failed; invalid method, just ignore it */
293 297
294 ACPI_ERROR((AE_INFO, 298 ACPI_DEBUG_PRINT((ACPI_DB_LOAD,
295 "Could not extract GPE number from name: %s (name is not of form _Lxx or _Exx)", 299 "Could not extract GPE number from name: %s (name is not of form _Lxx or _Exx)",
296 name)); 300 name));
297 return_ACPI_STATUS(AE_OK); 301 return_ACPI_STATUS(AE_OK);
298 } 302 }
299 303
@@ -364,13 +368,14 @@ acpi_ev_match_prw_and_gpe(acpi_handle obj_handle,
364 u32 gpe_number; 368 u32 gpe_number;
365 acpi_status status; 369 acpi_status status;
366 370
367 ACPI_FUNCTION_TRACE("ev_match_prw_and_gpe"); 371 ACPI_FUNCTION_TRACE(ev_match_prw_and_gpe);
368 372
369 /* Check for a _PRW method under this device */ 373 /* Check for a _PRW method under this device */
370 374
371 status = acpi_ut_evaluate_object(obj_handle, METHOD_NAME__PRW, 375 status = acpi_ut_evaluate_object(obj_handle, METHOD_NAME__PRW,
372 ACPI_BTYPE_PACKAGE, &pkg_desc); 376 ACPI_BTYPE_PACKAGE, &pkg_desc);
373 if (ACPI_FAILURE(status)) { 377 if (ACPI_FAILURE(status)) {
378
374 /* Ignore all errors from _PRW, we don't want to abort the subsystem */ 379 /* Ignore all errors from _PRW, we don't want to abort the subsystem */
375 380
376 return_ACPI_STATUS(AE_OK); 381 return_ACPI_STATUS(AE_OK);
@@ -394,6 +399,7 @@ acpi_ev_match_prw_and_gpe(acpi_handle obj_handle,
394 obj_desc = pkg_desc->package.elements[0]; 399 obj_desc = pkg_desc->package.elements[0];
395 400
396 if (ACPI_GET_OBJECT_TYPE(obj_desc) == ACPI_TYPE_INTEGER) { 401 if (ACPI_GET_OBJECT_TYPE(obj_desc) == ACPI_TYPE_INTEGER) {
402
397 /* Use FADT-defined GPE device (from definition of _PRW) */ 403 /* Use FADT-defined GPE device (from definition of _PRW) */
398 404
399 target_gpe_device = acpi_gbl_fadt_gpe_device; 405 target_gpe_device = acpi_gbl_fadt_gpe_device;
@@ -402,6 +408,7 @@ acpi_ev_match_prw_and_gpe(acpi_handle obj_handle,
402 408
403 gpe_number = (u32) obj_desc->integer.value; 409 gpe_number = (u32) obj_desc->integer.value;
404 } else if (ACPI_GET_OBJECT_TYPE(obj_desc) == ACPI_TYPE_PACKAGE) { 410 } else if (ACPI_GET_OBJECT_TYPE(obj_desc) == ACPI_TYPE_PACKAGE) {
411
405 /* Package contains a GPE reference and GPE number within a GPE block */ 412 /* Package contains a GPE reference and GPE number within a GPE block */
406 413
407 if ((obj_desc->package.count < 2) || 414 if ((obj_desc->package.count < 2) ||
@@ -482,7 +489,7 @@ static struct acpi_gpe_xrupt_info *acpi_ev_get_gpe_xrupt_block(u32
482 acpi_status status; 489 acpi_status status;
483 acpi_cpu_flags flags; 490 acpi_cpu_flags flags;
484 491
485 ACPI_FUNCTION_TRACE("ev_get_gpe_xrupt_block"); 492 ACPI_FUNCTION_TRACE(ev_get_gpe_xrupt_block);
486 493
487 /* No need for lock since we are not changing any list elements here */ 494 /* No need for lock since we are not changing any list elements here */
488 495
@@ -497,7 +504,7 @@ static struct acpi_gpe_xrupt_info *acpi_ev_get_gpe_xrupt_block(u32
497 504
498 /* Not found, must allocate a new xrupt descriptor */ 505 /* Not found, must allocate a new xrupt descriptor */
499 506
500 gpe_xrupt = ACPI_MEM_CALLOCATE(sizeof(struct acpi_gpe_xrupt_info)); 507 gpe_xrupt = ACPI_ALLOCATE_ZEROED(sizeof(struct acpi_gpe_xrupt_info));
501 if (!gpe_xrupt) { 508 if (!gpe_xrupt) {
502 return_PTR(NULL); 509 return_PTR(NULL);
503 } 510 }
@@ -556,7 +563,7 @@ acpi_ev_delete_gpe_xrupt(struct acpi_gpe_xrupt_info *gpe_xrupt)
556 acpi_status status; 563 acpi_status status;
557 acpi_cpu_flags flags; 564 acpi_cpu_flags flags;
558 565
559 ACPI_FUNCTION_TRACE("ev_delete_gpe_xrupt"); 566 ACPI_FUNCTION_TRACE(ev_delete_gpe_xrupt);
560 567
561 /* We never want to remove the SCI interrupt handler */ 568 /* We never want to remove the SCI interrupt handler */
562 569
@@ -588,7 +595,7 @@ acpi_ev_delete_gpe_xrupt(struct acpi_gpe_xrupt_info *gpe_xrupt)
588 595
589 /* Free the block */ 596 /* Free the block */
590 597
591 ACPI_MEM_FREE(gpe_xrupt); 598 ACPI_FREE(gpe_xrupt);
592 return_ACPI_STATUS(AE_OK); 599 return_ACPI_STATUS(AE_OK);
593} 600}
594 601
@@ -614,7 +621,7 @@ acpi_ev_install_gpe_block(struct acpi_gpe_block_info *gpe_block,
614 acpi_status status; 621 acpi_status status;
615 acpi_cpu_flags flags; 622 acpi_cpu_flags flags;
616 623
617 ACPI_FUNCTION_TRACE("ev_install_gpe_block"); 624 ACPI_FUNCTION_TRACE(ev_install_gpe_block);
618 625
619 status = acpi_ut_acquire_mutex(ACPI_MTX_EVENTS); 626 status = acpi_ut_acquire_mutex(ACPI_MTX_EVENTS);
620 if (ACPI_FAILURE(status)) { 627 if (ACPI_FAILURE(status)) {
@@ -667,7 +674,7 @@ acpi_status acpi_ev_delete_gpe_block(struct acpi_gpe_block_info *gpe_block)
667 acpi_status status; 674 acpi_status status;
668 acpi_cpu_flags flags; 675 acpi_cpu_flags flags;
669 676
670 ACPI_FUNCTION_TRACE("ev_install_gpe_block"); 677 ACPI_FUNCTION_TRACE(ev_install_gpe_block);
671 678
672 status = acpi_ut_acquire_mutex(ACPI_MTX_EVENTS); 679 status = acpi_ut_acquire_mutex(ACPI_MTX_EVENTS);
673 if (ACPI_FAILURE(status)) { 680 if (ACPI_FAILURE(status)) {
@@ -679,6 +686,7 @@ acpi_status acpi_ev_delete_gpe_block(struct acpi_gpe_block_info *gpe_block)
679 status = acpi_hw_disable_gpe_block(gpe_block->xrupt_block, gpe_block); 686 status = acpi_hw_disable_gpe_block(gpe_block->xrupt_block, gpe_block);
680 687
681 if (!gpe_block->previous && !gpe_block->next) { 688 if (!gpe_block->previous && !gpe_block->next) {
689
682 /* This is the last gpe_block on this interrupt */ 690 /* This is the last gpe_block on this interrupt */
683 691
684 status = acpi_ev_delete_gpe_xrupt(gpe_block->xrupt_block); 692 status = acpi_ev_delete_gpe_xrupt(gpe_block->xrupt_block);
@@ -704,9 +712,9 @@ acpi_status acpi_ev_delete_gpe_block(struct acpi_gpe_block_info *gpe_block)
704 712
705 /* Free the gpe_block */ 713 /* Free the gpe_block */
706 714
707 ACPI_MEM_FREE(gpe_block->register_info); 715 ACPI_FREE(gpe_block->register_info);
708 ACPI_MEM_FREE(gpe_block->event_info); 716 ACPI_FREE(gpe_block->event_info);
709 ACPI_MEM_FREE(gpe_block); 717 ACPI_FREE(gpe_block);
710 718
711 unlock_and_exit: 719 unlock_and_exit:
712 status = acpi_ut_release_mutex(ACPI_MTX_EVENTS); 720 status = acpi_ut_release_mutex(ACPI_MTX_EVENTS);
@@ -736,17 +744,17 @@ acpi_ev_create_gpe_info_blocks(struct acpi_gpe_block_info *gpe_block)
736 acpi_native_uint j; 744 acpi_native_uint j;
737 acpi_status status; 745 acpi_status status;
738 746
739 ACPI_FUNCTION_TRACE("ev_create_gpe_info_blocks"); 747 ACPI_FUNCTION_TRACE(ev_create_gpe_info_blocks);
740 748
741 /* Allocate the GPE register information block */ 749 /* Allocate the GPE register information block */
742 750
743 gpe_register_info = ACPI_MEM_CALLOCATE((acpi_size) gpe_block-> 751 gpe_register_info = ACPI_ALLOCATE_ZEROED((acpi_size) gpe_block->
744 register_count * 752 register_count *
745 sizeof(struct 753 sizeof(struct
746 acpi_gpe_register_info)); 754 acpi_gpe_register_info));
747 if (!gpe_register_info) { 755 if (!gpe_register_info) {
748 ACPI_ERROR((AE_INFO, 756 ACPI_ERROR((AE_INFO,
749 "Could not allocate the gpe_register_info table")); 757 "Could not allocate the GpeRegisterInfo table"));
750 return_ACPI_STATUS(AE_NO_MEMORY); 758 return_ACPI_STATUS(AE_NO_MEMORY);
751 } 759 }
752 760
@@ -754,13 +762,14 @@ acpi_ev_create_gpe_info_blocks(struct acpi_gpe_block_info *gpe_block)
754 * Allocate the GPE event_info block. There are eight distinct GPEs 762 * Allocate the GPE event_info block. There are eight distinct GPEs
755 * per register. Initialization to zeros is sufficient. 763 * per register. Initialization to zeros is sufficient.
756 */ 764 */
757 gpe_event_info = ACPI_MEM_CALLOCATE(((acpi_size) gpe_block-> 765 gpe_event_info = ACPI_ALLOCATE_ZEROED(((acpi_size) gpe_block->
758 register_count * 766 register_count *
759 ACPI_GPE_REGISTER_WIDTH) * 767 ACPI_GPE_REGISTER_WIDTH) *
760 sizeof(struct acpi_gpe_event_info)); 768 sizeof(struct
769 acpi_gpe_event_info));
761 if (!gpe_event_info) { 770 if (!gpe_event_info) {
762 ACPI_ERROR((AE_INFO, 771 ACPI_ERROR((AE_INFO,
763 "Could not allocate the gpe_event_info table")); 772 "Could not allocate the GpeEventInfo table"));
764 status = AE_NO_MEMORY; 773 status = AE_NO_MEMORY;
765 goto error_exit; 774 goto error_exit;
766 } 775 }
@@ -780,6 +789,7 @@ acpi_ev_create_gpe_info_blocks(struct acpi_gpe_block_info *gpe_block)
780 this_event = gpe_event_info; 789 this_event = gpe_event_info;
781 790
782 for (i = 0; i < gpe_block->register_count; i++) { 791 for (i = 0; i < gpe_block->register_count; i++) {
792
783 /* Init the register_info for this GPE register (8 GPEs) */ 793 /* Init the register_info for this GPE register (8 GPEs) */
784 794
785 this_register->base_gpe_number = 795 this_register->base_gpe_number =
@@ -839,10 +849,10 @@ acpi_ev_create_gpe_info_blocks(struct acpi_gpe_block_info *gpe_block)
839 849
840 error_exit: 850 error_exit:
841 if (gpe_register_info) { 851 if (gpe_register_info) {
842 ACPI_MEM_FREE(gpe_register_info); 852 ACPI_FREE(gpe_register_info);
843 } 853 }
844 if (gpe_event_info) { 854 if (gpe_event_info) {
845 ACPI_MEM_FREE(gpe_event_info); 855 ACPI_FREE(gpe_event_info);
846 } 856 }
847 857
848 return_ACPI_STATUS(status); 858 return_ACPI_STATUS(status);
@@ -878,7 +888,7 @@ acpi_ev_create_gpe_block(struct acpi_namespace_node *gpe_device,
878 acpi_status status; 888 acpi_status status;
879 struct acpi_gpe_block_info *gpe_block; 889 struct acpi_gpe_block_info *gpe_block;
880 890
881 ACPI_FUNCTION_TRACE("ev_create_gpe_block"); 891 ACPI_FUNCTION_TRACE(ev_create_gpe_block);
882 892
883 if (!register_count) { 893 if (!register_count) {
884 return_ACPI_STATUS(AE_OK); 894 return_ACPI_STATUS(AE_OK);
@@ -886,7 +896,7 @@ acpi_ev_create_gpe_block(struct acpi_namespace_node *gpe_device,
886 896
887 /* Allocate a new GPE block */ 897 /* Allocate a new GPE block */
888 898
889 gpe_block = ACPI_MEM_CALLOCATE(sizeof(struct acpi_gpe_block_info)); 899 gpe_block = ACPI_ALLOCATE_ZEROED(sizeof(struct acpi_gpe_block_info));
890 if (!gpe_block) { 900 if (!gpe_block) {
891 return_ACPI_STATUS(AE_NO_MEMORY); 901 return_ACPI_STATUS(AE_NO_MEMORY);
892 } 902 }
@@ -906,7 +916,7 @@ acpi_ev_create_gpe_block(struct acpi_namespace_node *gpe_device,
906 */ 916 */
907 status = acpi_ev_create_gpe_info_blocks(gpe_block); 917 status = acpi_ev_create_gpe_info_blocks(gpe_block);
908 if (ACPI_FAILURE(status)) { 918 if (ACPI_FAILURE(status)) {
909 ACPI_MEM_FREE(gpe_block); 919 ACPI_FREE(gpe_block);
910 return_ACPI_STATUS(status); 920 return_ACPI_STATUS(status);
911 } 921 }
912 922
@@ -914,7 +924,7 @@ acpi_ev_create_gpe_block(struct acpi_namespace_node *gpe_device,
914 924
915 status = acpi_ev_install_gpe_block(gpe_block, interrupt_number); 925 status = acpi_ev_install_gpe_block(gpe_block, interrupt_number);
916 if (ACPI_FAILURE(status)) { 926 if (ACPI_FAILURE(status)) {
917 ACPI_MEM_FREE(gpe_block); 927 ACPI_FREE(gpe_block);
918 return_ACPI_STATUS(status); 928 return_ACPI_STATUS(status);
919 } 929 }
920 930
@@ -971,7 +981,7 @@ acpi_ev_initialize_gpe_block(struct acpi_namespace_node *gpe_device,
971 acpi_native_uint i; 981 acpi_native_uint i;
972 acpi_native_uint j; 982 acpi_native_uint j;
973 983
974 ACPI_FUNCTION_TRACE("ev_initialize_gpe_block"); 984 ACPI_FUNCTION_TRACE(ev_initialize_gpe_block);
975 985
976 /* Ignore a null GPE block (e.g., if no GPE block 1 exists) */ 986 /* Ignore a null GPE block (e.g., if no GPE block 1 exists) */
977 987
@@ -1013,6 +1023,7 @@ acpi_ev_initialize_gpe_block(struct acpi_namespace_node *gpe_device,
1013 1023
1014 for (i = 0; i < gpe_block->register_count; i++) { 1024 for (i = 0; i < gpe_block->register_count; i++) {
1015 for (j = 0; j < 8; j++) { 1025 for (j = 0; j < 8; j++) {
1026
1016 /* Get the info block for this particular GPE */ 1027 /* Get the info block for this particular GPE */
1017 1028
1018 gpe_event_info = 1029 gpe_event_info =
@@ -1040,7 +1051,7 @@ acpi_ev_initialize_gpe_block(struct acpi_namespace_node *gpe_device,
1040 1051
1041 status = acpi_hw_enable_runtime_gpe_block(NULL, gpe_block); 1052 status = acpi_hw_enable_runtime_gpe_block(NULL, gpe_block);
1042 if (ACPI_FAILURE(status)) { 1053 if (ACPI_FAILURE(status)) {
1043 ACPI_ERROR((AE_INFO, "Could not enable GPEs in gpe_block %p", 1054 ACPI_ERROR((AE_INFO, "Could not enable GPEs in GpeBlock %p",
1044 gpe_block)); 1055 gpe_block));
1045 } 1056 }
1046 1057
@@ -1066,7 +1077,7 @@ acpi_status acpi_ev_gpe_initialize(void)
1066 u32 gpe_number_max = 0; 1077 u32 gpe_number_max = 0;
1067 acpi_status status; 1078 acpi_status status;
1068 1079
1069 ACPI_FUNCTION_TRACE("ev_gpe_initialize"); 1080 ACPI_FUNCTION_TRACE(ev_gpe_initialize);
1070 1081
1071 status = acpi_ut_acquire_mutex(ACPI_MTX_NAMESPACE); 1082 status = acpi_ut_acquire_mutex(ACPI_MTX_NAMESPACE);
1072 if (ACPI_FAILURE(status)) { 1083 if (ACPI_FAILURE(status)) {
@@ -1099,6 +1110,7 @@ acpi_status acpi_ev_gpe_initialize(void)
1099 * particular block is not supported. 1110 * particular block is not supported.
1100 */ 1111 */
1101 if (acpi_gbl_FADT->gpe0_blk_len && acpi_gbl_FADT->xgpe0_blk.address) { 1112 if (acpi_gbl_FADT->gpe0_blk_len && acpi_gbl_FADT->xgpe0_blk.address) {
1113
1102 /* GPE block 0 exists (has both length and address > 0) */ 1114 /* GPE block 0 exists (has both length and address > 0) */
1103 1115
1104 register_count0 = (u16) (acpi_gbl_FADT->gpe0_blk_len / 2); 1116 register_count0 = (u16) (acpi_gbl_FADT->gpe0_blk_len / 2);
@@ -1121,6 +1133,7 @@ acpi_status acpi_ev_gpe_initialize(void)
1121 } 1133 }
1122 1134
1123 if (acpi_gbl_FADT->gpe1_blk_len && acpi_gbl_FADT->xgpe1_blk.address) { 1135 if (acpi_gbl_FADT->gpe1_blk_len && acpi_gbl_FADT->xgpe1_blk.address) {
1136
1124 /* GPE block 1 exists (has both length and address > 0) */ 1137 /* GPE block 1 exists (has both length and address > 0) */
1125 1138
1126 register_count1 = (u16) (acpi_gbl_FADT->gpe1_blk_len / 2); 1139 register_count1 = (u16) (acpi_gbl_FADT->gpe1_blk_len / 2);
@@ -1168,6 +1181,7 @@ acpi_status acpi_ev_gpe_initialize(void)
1168 /* Exit if there are no GPE registers */ 1181 /* Exit if there are no GPE registers */
1169 1182
1170 if ((register_count0 + register_count1) == 0) { 1183 if ((register_count0 + register_count1) == 0) {
1184
1171 /* GPEs are not required by ACPI, this is OK */ 1185 /* GPEs are not required by ACPI, this is OK */
1172 1186
1173 ACPI_DEBUG_PRINT((ACPI_DB_INIT, 1187 ACPI_DEBUG_PRINT((ACPI_DB_INIT,
diff --git a/drivers/acpi/events/evmisc.c b/drivers/acpi/events/evmisc.c
index 0909ba69577e..6eef4efddcf6 100644
--- a/drivers/acpi/events/evmisc.c
+++ b/drivers/acpi/events/evmisc.c
@@ -49,12 +49,13 @@
49#define _COMPONENT ACPI_EVENTS 49#define _COMPONENT ACPI_EVENTS
50ACPI_MODULE_NAME("evmisc") 50ACPI_MODULE_NAME("evmisc")
51 51
52/* Names for Notify() values, used for debug output */
52#ifdef ACPI_DEBUG_OUTPUT 53#ifdef ACPI_DEBUG_OUTPUT
53static const char *acpi_notify_value_names[] = { 54static const char *acpi_notify_value_names[] = {
54 "Bus Check", 55 "Bus Check",
55 "Device Check", 56 "Device Check",
56 "Device Wake", 57 "Device Wake",
57 "Eject request", 58 "Eject Request",
58 "Device Check Light", 59 "Device Check Light",
59 "Frequency Mismatch", 60 "Frequency Mismatch",
60 "Bus Mode Mismatch", 61 "Bus Mode Mismatch",
@@ -124,7 +125,7 @@ acpi_ev_queue_notify_request(struct acpi_namespace_node * node,
124 union acpi_generic_state *notify_info; 125 union acpi_generic_state *notify_info;
125 acpi_status status = AE_OK; 126 acpi_status status = AE_OK;
126 127
127 ACPI_FUNCTION_NAME("ev_queue_notify_request"); 128 ACPI_FUNCTION_NAME(ev_queue_notify_request);
128 129
129 /* 130 /*
130 * For value 3 (Ejection Request), some device method may need to be run. 131 * For value 3 (Ejection Request), some device method may need to be run.
@@ -150,6 +151,7 @@ acpi_ev_queue_notify_request(struct acpi_namespace_node * node,
150 151
151 obj_desc = acpi_ns_get_attached_object(node); 152 obj_desc = acpi_ns_get_attached_object(node);
152 if (obj_desc) { 153 if (obj_desc) {
154
153 /* We have the notify object, Get the right handler */ 155 /* We have the notify object, Get the right handler */
154 156
155 switch (node->type) { 157 switch (node->type) {
@@ -184,14 +186,15 @@ acpi_ev_queue_notify_request(struct acpi_namespace_node * node,
184 return (AE_NO_MEMORY); 186 return (AE_NO_MEMORY);
185 } 187 }
186 188
187 notify_info->common.data_type = ACPI_DESC_TYPE_STATE_NOTIFY; 189 notify_info->common.descriptor_type =
190 ACPI_DESC_TYPE_STATE_NOTIFY;
188 notify_info->notify.node = node; 191 notify_info->notify.node = node;
189 notify_info->notify.value = (u16) notify_value; 192 notify_info->notify.value = (u16) notify_value;
190 notify_info->notify.handler_obj = handler_obj; 193 notify_info->notify.handler_obj = handler_obj;
191 194
192 status = acpi_os_queue_for_execution(OSD_PRIORITY_HIGH, 195 status =
193 acpi_ev_notify_dispatch, 196 acpi_os_execute(OSL_NOTIFY_HANDLER, acpi_ev_notify_dispatch,
194 notify_info); 197 notify_info);
195 if (ACPI_FAILURE(status)) { 198 if (ACPI_FAILURE(status)) {
196 acpi_ut_delete_generic_state(notify_info); 199 acpi_ut_delete_generic_state(notify_info);
197 } 200 }
@@ -240,6 +243,7 @@ static void ACPI_SYSTEM_XFACE acpi_ev_notify_dispatch(void *context)
240 * to the device. 243 * to the device.
241 */ 244 */
242 if (notify_info->notify.value <= ACPI_MAX_SYS_NOTIFY) { 245 if (notify_info->notify.value <= ACPI_MAX_SYS_NOTIFY) {
246
243 /* Global system notification handler */ 247 /* Global system notification handler */
244 248
245 if (acpi_gbl_system_notify.handler) { 249 if (acpi_gbl_system_notify.handler) {
@@ -297,6 +301,7 @@ static void ACPI_SYSTEM_XFACE acpi_ev_global_lock_thread(void *context)
297 /* Signal threads that are waiting for the lock */ 301 /* Signal threads that are waiting for the lock */
298 302
299 if (acpi_gbl_global_lock_thread_count) { 303 if (acpi_gbl_global_lock_thread_count) {
304
300 /* Send sufficient units to the semaphore */ 305 /* Send sufficient units to the semaphore */
301 306
302 status = 307 status =
@@ -335,15 +340,16 @@ static u32 acpi_ev_global_lock_handler(void *context)
335 */ 340 */
336 ACPI_ACQUIRE_GLOBAL_LOCK(acpi_gbl_common_fACS.global_lock, acquired); 341 ACPI_ACQUIRE_GLOBAL_LOCK(acpi_gbl_common_fACS.global_lock, acquired);
337 if (acquired) { 342 if (acquired) {
343
338 /* Got the lock, now wake all threads waiting for it */ 344 /* Got the lock, now wake all threads waiting for it */
339 345
340 acpi_gbl_global_lock_acquired = TRUE; 346 acpi_gbl_global_lock_acquired = TRUE;
341 347
342 /* Run the Global Lock thread which will signal all waiting threads */ 348 /* Run the Global Lock thread which will signal all waiting threads */
343 349
344 status = acpi_os_queue_for_execution(OSD_PRIORITY_HIGH, 350 status =
345 acpi_ev_global_lock_thread, 351 acpi_os_execute(OSL_GLOBAL_LOCK_HANDLER,
346 context); 352 acpi_ev_global_lock_thread, context);
347 if (ACPI_FAILURE(status)) { 353 if (ACPI_FAILURE(status)) {
348 ACPI_EXCEPTION((AE_INFO, status, 354 ACPI_EXCEPTION((AE_INFO, status,
349 "Could not queue Global Lock thread")); 355 "Could not queue Global Lock thread"));
@@ -371,7 +377,7 @@ acpi_status acpi_ev_init_global_lock_handler(void)
371{ 377{
372 acpi_status status; 378 acpi_status status;
373 379
374 ACPI_FUNCTION_TRACE("ev_init_global_lock_handler"); 380 ACPI_FUNCTION_TRACE(ev_init_global_lock_handler);
375 381
376 acpi_gbl_global_lock_present = TRUE; 382 acpi_gbl_global_lock_present = TRUE;
377 status = acpi_install_fixed_event_handler(ACPI_EVENT_GLOBAL, 383 status = acpi_install_fixed_event_handler(ACPI_EVENT_GLOBAL,
@@ -413,7 +419,7 @@ acpi_status acpi_ev_acquire_global_lock(u16 timeout)
413 acpi_status status = AE_OK; 419 acpi_status status = AE_OK;
414 u8 acquired = FALSE; 420 u8 acquired = FALSE;
415 421
416 ACPI_FUNCTION_TRACE("ev_acquire_global_lock"); 422 ACPI_FUNCTION_TRACE(ev_acquire_global_lock);
417 423
418#ifndef ACPI_APPLICATION 424#ifndef ACPI_APPLICATION
419 /* Make sure that we actually have a global lock */ 425 /* Make sure that we actually have a global lock */
@@ -439,6 +445,7 @@ acpi_status acpi_ev_acquire_global_lock(u16 timeout)
439 445
440 ACPI_ACQUIRE_GLOBAL_LOCK(acpi_gbl_common_fACS.global_lock, acquired); 446 ACPI_ACQUIRE_GLOBAL_LOCK(acpi_gbl_common_fACS.global_lock, acquired);
441 if (acquired) { 447 if (acquired) {
448
442 /* We got the lock */ 449 /* We got the lock */
443 450
444 ACPI_DEBUG_PRINT((ACPI_DB_EXEC, 451 ACPI_DEBUG_PRINT((ACPI_DB_EXEC,
@@ -458,8 +465,9 @@ acpi_status acpi_ev_acquire_global_lock(u16 timeout)
458 * Acquire the global lock semaphore first. 465 * Acquire the global lock semaphore first.
459 * Since this wait will block, we must release the interpreter 466 * Since this wait will block, we must release the interpreter
460 */ 467 */
461 status = acpi_ex_system_wait_semaphore(acpi_gbl_global_lock_semaphore, 468 status =
462 timeout); 469 acpi_ex_system_wait_semaphore(acpi_gbl_global_lock_semaphore,
470 timeout);
463 return_ACPI_STATUS(status); 471 return_ACPI_STATUS(status);
464} 472}
465 473
@@ -480,7 +488,7 @@ acpi_status acpi_ev_release_global_lock(void)
480 u8 pending = FALSE; 488 u8 pending = FALSE;
481 acpi_status status = AE_OK; 489 acpi_status status = AE_OK;
482 490
483 ACPI_FUNCTION_TRACE("ev_release_global_lock"); 491 ACPI_FUNCTION_TRACE(ev_release_global_lock);
484 492
485 if (!acpi_gbl_global_lock_thread_count) { 493 if (!acpi_gbl_global_lock_thread_count) {
486 ACPI_WARNING((AE_INFO, 494 ACPI_WARNING((AE_INFO,
@@ -492,6 +500,7 @@ acpi_status acpi_ev_release_global_lock(void)
492 500
493 acpi_gbl_global_lock_thread_count--; 501 acpi_gbl_global_lock_thread_count--;
494 if (acpi_gbl_global_lock_thread_count) { 502 if (acpi_gbl_global_lock_thread_count) {
503
495 /* There are still some threads holding the lock, cannot release */ 504 /* There are still some threads holding the lock, cannot release */
496 505
497 return_ACPI_STATUS(AE_OK); 506 return_ACPI_STATUS(AE_OK);
@@ -533,7 +542,7 @@ void acpi_ev_terminate(void)
533 acpi_native_uint i; 542 acpi_native_uint i;
534 acpi_status status; 543 acpi_status status;
535 544
536 ACPI_FUNCTION_TRACE("ev_terminate"); 545 ACPI_FUNCTION_TRACE(ev_terminate);
537 546
538 if (acpi_gbl_events_initialized) { 547 if (acpi_gbl_events_initialized) {
539 /* 548 /*
@@ -573,7 +582,7 @@ void acpi_ev_terminate(void)
573 if (acpi_gbl_original_mode == ACPI_SYS_MODE_LEGACY) { 582 if (acpi_gbl_original_mode == ACPI_SYS_MODE_LEGACY) {
574 status = acpi_disable(); 583 status = acpi_disable();
575 if (ACPI_FAILURE(status)) { 584 if (ACPI_FAILURE(status)) {
576 ACPI_WARNING((AE_INFO, "acpi_disable failed")); 585 ACPI_WARNING((AE_INFO, "AcpiDisable failed"));
577 } 586 }
578 } 587 }
579 return_VOID; 588 return_VOID;
diff --git a/drivers/acpi/events/evregion.c b/drivers/acpi/events/evregion.c
index 6da58e776413..094a17e4c86d 100644
--- a/drivers/acpi/events/evregion.c
+++ b/drivers/acpi/events/evregion.c
@@ -83,7 +83,7 @@ acpi_status acpi_ev_install_region_handlers(void)
83 acpi_status status; 83 acpi_status status;
84 acpi_native_uint i; 84 acpi_native_uint i;
85 85
86 ACPI_FUNCTION_TRACE("ev_install_region_handlers"); 86 ACPI_FUNCTION_TRACE(ev_install_region_handlers);
87 87
88 status = acpi_ut_acquire_mutex(ACPI_MTX_NAMESPACE); 88 status = acpi_ut_acquire_mutex(ACPI_MTX_NAMESPACE);
89 if (ACPI_FAILURE(status)) { 89 if (ACPI_FAILURE(status)) {
@@ -153,7 +153,7 @@ acpi_status acpi_ev_initialize_op_regions(void)
153 acpi_status status; 153 acpi_status status;
154 acpi_native_uint i; 154 acpi_native_uint i;
155 155
156 ACPI_FUNCTION_TRACE("ev_initialize_op_regions"); 156 ACPI_FUNCTION_TRACE(ev_initialize_op_regions);
157 157
158 status = acpi_ut_acquire_mutex(ACPI_MTX_NAMESPACE); 158 status = acpi_ut_acquire_mutex(ACPI_MTX_NAMESPACE);
159 if (ACPI_FAILURE(status)) { 159 if (ACPI_FAILURE(status)) {
@@ -164,6 +164,7 @@ acpi_status acpi_ev_initialize_op_regions(void)
164 * Run the _REG methods for op_regions in each default address space 164 * Run the _REG methods for op_regions in each default address space
165 */ 165 */
166 for (i = 0; i < ACPI_NUM_DEFAULT_SPACES; i++) { 166 for (i = 0; i < ACPI_NUM_DEFAULT_SPACES; i++) {
167
167 /* TBD: Make sure handler is the DEFAULT handler, otherwise 168 /* TBD: Make sure handler is the DEFAULT handler, otherwise
168 * _REG will have already been run. 169 * _REG will have already been run.
169 */ 170 */
@@ -192,12 +193,12 @@ acpi_status acpi_ev_initialize_op_regions(void)
192acpi_status 193acpi_status
193acpi_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)
194{ 195{
195 struct acpi_parameter_info info; 196 struct acpi_evaluate_info *info;
196 union acpi_operand_object *params[3]; 197 union acpi_operand_object *args[3];
197 union acpi_operand_object *region_obj2; 198 union acpi_operand_object *region_obj2;
198 acpi_status status; 199 acpi_status status;
199 200
200 ACPI_FUNCTION_TRACE("ev_execute_reg_method"); 201 ACPI_FUNCTION_TRACE(ev_execute_reg_method);
201 202
202 region_obj2 = acpi_ns_get_secondary_object(region_obj); 203 region_obj2 = acpi_ns_get_secondary_object(region_obj);
203 if (!region_obj2) { 204 if (!region_obj2) {
@@ -208,48 +209,60 @@ acpi_ev_execute_reg_method(union acpi_operand_object *region_obj, u32 function)
208 return_ACPI_STATUS(AE_OK); 209 return_ACPI_STATUS(AE_OK);
209 } 210 }
210 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
211 /* 225 /*
212 * The _REG method has two arguments: 226 * The _REG method has two arguments:
213 * 227 *
214 * Arg0, Integer: Operation region space ID 228 * Arg0 - Integer:
215 * Same value as region_obj->Region.space_id 229 * Operation region space ID Same value as region_obj->Region.space_id
216 * Arg1, Integer: connection status 230 *
217 * 1 for connecting the handler, 231 * Arg1 - Integer:
218 * 0 for disconnecting the handler 232 * connection status 1 for connecting the handler, 0 for disconnecting
219 * Passed as a parameter 233 * the handler (Passed as a parameter)
220 */ 234 */
221 params[0] = acpi_ut_create_internal_object(ACPI_TYPE_INTEGER); 235 args[0] = acpi_ut_create_internal_object(ACPI_TYPE_INTEGER);
222 if (!params[0]) { 236 if (!args[0]) {
223 return_ACPI_STATUS(AE_NO_MEMORY); 237 status = AE_NO_MEMORY;
238 goto cleanup1;
224 } 239 }
225 240
226 params[1] = acpi_ut_create_internal_object(ACPI_TYPE_INTEGER); 241 args[1] = acpi_ut_create_internal_object(ACPI_TYPE_INTEGER);
227 if (!params[1]) { 242 if (!args[1]) {
228 status = AE_NO_MEMORY; 243 status = AE_NO_MEMORY;
229 goto cleanup; 244 goto cleanup2;
230 } 245 }
231 246
232 /* Setup the parameter objects */ 247 /* Setup the parameter objects */
233 248
234 params[0]->integer.value = region_obj->region.space_id; 249 args[0]->integer.value = region_obj->region.space_id;
235 params[1]->integer.value = function; 250 args[1]->integer.value = function;
236 params[2] = NULL; 251 args[2] = NULL;
237
238 info.node = region_obj2->extra.method_REG;
239 info.parameters = params;
240 info.parameter_type = ACPI_PARAM_ARGS;
241 252
242 /* Execute the method, no return value */ 253 /* Execute the method, no return value */
243 254
244 ACPI_DEBUG_EXEC(acpi_ut_display_init_pathname 255 ACPI_DEBUG_EXEC(acpi_ut_display_init_pathname
245 (ACPI_TYPE_METHOD, info.node, NULL)); 256 (ACPI_TYPE_METHOD, info->prefix_node, NULL));
246 status = acpi_ns_evaluate_by_handle(&info);
247 257
248 acpi_ut_remove_reference(params[1]); 258 status = acpi_ns_evaluate(info);
259 acpi_ut_remove_reference(args[1]);
249 260
250 cleanup: 261 cleanup2:
251 acpi_ut_remove_reference(params[0]); 262 acpi_ut_remove_reference(args[0]);
252 263
264 cleanup1:
265 ACPI_FREE(info);
253 return_ACPI_STATUS(status); 266 return_ACPI_STATUS(status);
254} 267}
255 268
@@ -261,7 +274,8 @@ acpi_ev_execute_reg_method(union acpi_operand_object *region_obj, u32 function)
261 * Function - Read or Write operation 274 * Function - Read or Write operation
262 * Address - Where in the space to read or write 275 * Address - Where in the space to read or write
263 * bit_width - Field width in bits (8, 16, 32, or 64) 276 * bit_width - Field width in bits (8, 16, 32, or 64)
264 * Value - Pointer to in or out value 277 * Value - Pointer to in or out value, must be
278 * full 64-bit acpi_integer
265 * 279 *
266 * RETURN: Status 280 * RETURN: Status
267 * 281 *
@@ -274,7 +288,7 @@ acpi_status
274acpi_ev_address_space_dispatch(union acpi_operand_object *region_obj, 288acpi_ev_address_space_dispatch(union acpi_operand_object *region_obj,
275 u32 function, 289 u32 function,
276 acpi_physical_address address, 290 acpi_physical_address address,
277 u32 bit_width, void *value) 291 u32 bit_width, acpi_integer * value)
278{ 292{
279 acpi_status status; 293 acpi_status status;
280 acpi_status status2; 294 acpi_status status2;
@@ -284,7 +298,7 @@ acpi_ev_address_space_dispatch(union acpi_operand_object *region_obj,
284 union acpi_operand_object *region_obj2; 298 union acpi_operand_object *region_obj2;
285 void *region_context = NULL; 299 void *region_context = NULL;
286 300
287 ACPI_FUNCTION_TRACE("ev_address_space_dispatch"); 301 ACPI_FUNCTION_TRACE(ev_address_space_dispatch);
288 302
289 region_obj2 = acpi_ns_get_secondary_object(region_obj); 303 region_obj2 = acpi_ns_get_secondary_object(region_obj);
290 if (!region_obj2) { 304 if (!region_obj2) {
@@ -315,6 +329,7 @@ acpi_ev_address_space_dispatch(union acpi_operand_object *region_obj,
315 */ 329 */
316 region_setup = handler_desc->address_space.setup; 330 region_setup = handler_desc->address_space.setup;
317 if (!region_setup) { 331 if (!region_setup) {
332
318 /* No initialization routine, exit with error */ 333 /* No initialization routine, exit with error */
319 334
320 ACPI_ERROR((AE_INFO, 335 ACPI_ERROR((AE_INFO,
@@ -361,9 +376,10 @@ acpi_ev_address_space_dispatch(union acpi_operand_object *region_obj,
361 region_obj->region.flags |= AOPOBJ_SETUP_COMPLETE; 376 region_obj->region.flags |= AOPOBJ_SETUP_COMPLETE;
362 377
363 if (region_obj2->extra.region_context) { 378 if (region_obj2->extra.region_context) {
379
364 /* The handler for this region was already installed */ 380 /* The handler for this region was already installed */
365 381
366 ACPI_MEM_FREE(region_context); 382 ACPI_FREE(region_context);
367 } else { 383 } else {
368 /* 384 /*
369 * Save the returned context for use in all accesses to 385 * Save the returned context for use in all accesses to
@@ -386,9 +402,8 @@ acpi_ev_address_space_dispatch(union acpi_operand_object *region_obj,
386 acpi_ut_get_region_name(region_obj->region. 402 acpi_ut_get_region_name(region_obj->region.
387 space_id))); 403 space_id)));
388 404
389 if (! 405 if (!(handler_desc->address_space.handler_flags &
390 (handler_desc->address_space. 406 ACPI_ADDR_HANDLER_DEFAULT_INSTALLED)) {
391 hflags & ACPI_ADDR_HANDLER_DEFAULT_INSTALLED)) {
392 /* 407 /*
393 * For handlers other than the default (supplied) handlers, we must 408 * For handlers other than the default (supplied) handlers, we must
394 * exit the interpreter because the handler *might* block -- we don't 409 * exit the interpreter because the handler *might* block -- we don't
@@ -409,9 +424,8 @@ acpi_ev_address_space_dispatch(union acpi_operand_object *region_obj,
409 space_id))); 424 space_id)));
410 } 425 }
411 426
412 if (! 427 if (!(handler_desc->address_space.handler_flags &
413 (handler_desc->address_space. 428 ACPI_ADDR_HANDLER_DEFAULT_INSTALLED)) {
414 hflags & ACPI_ADDR_HANDLER_DEFAULT_INSTALLED)) {
415 /* 429 /*
416 * We just returned from a non-default handler, we must re-enter the 430 * We just returned from a non-default handler, we must re-enter the
417 * interpreter 431 * interpreter
@@ -451,7 +465,7 @@ acpi_ev_detach_region(union acpi_operand_object *region_obj,
451 union acpi_operand_object *region_obj2; 465 union acpi_operand_object *region_obj2;
452 acpi_status status; 466 acpi_status status;
453 467
454 ACPI_FUNCTION_TRACE("ev_detach_region"); 468 ACPI_FUNCTION_TRACE(ev_detach_region);
455 469
456 region_obj2 = acpi_ns_get_secondary_object(region_obj); 470 region_obj2 = acpi_ns_get_secondary_object(region_obj);
457 if (!region_obj2) { 471 if (!region_obj2) {
@@ -463,6 +477,7 @@ acpi_ev_detach_region(union acpi_operand_object *region_obj,
463 477
464 handler_obj = region_obj->region.handler; 478 handler_obj = region_obj->region.handler;
465 if (!handler_obj) { 479 if (!handler_obj) {
480
466 /* This region has no handler, all done */ 481 /* This region has no handler, all done */
467 482
468 return_VOID; 483 return_VOID;
@@ -474,6 +489,7 @@ acpi_ev_detach_region(union acpi_operand_object *region_obj,
474 last_obj_ptr = &handler_obj->address_space.region_list; 489 last_obj_ptr = &handler_obj->address_space.region_list;
475 490
476 while (obj_desc) { 491 while (obj_desc) {
492
477 /* Is this the correct Region? */ 493 /* Is this the correct Region? */
478 494
479 if (obj_desc == region_obj) { 495 if (obj_desc == region_obj) {
@@ -583,7 +599,7 @@ acpi_ev_attach_region(union acpi_operand_object *handler_obj,
583 u8 acpi_ns_is_locked) 599 u8 acpi_ns_is_locked)
584{ 600{
585 601
586 ACPI_FUNCTION_TRACE("ev_attach_region"); 602 ACPI_FUNCTION_TRACE(ev_attach_region);
587 603
588 ACPI_DEBUG_PRINT((ACPI_DB_OPREGION, 604 ACPI_DEBUG_PRINT((ACPI_DB_OPREGION,
589 "Adding Region [%4.4s] %p to address handler %p [%s]\n", 605 "Adding Region [%4.4s] %p to address handler %p [%s]\n",
@@ -636,7 +652,7 @@ acpi_ev_install_handler(acpi_handle obj_handle,
636 struct acpi_namespace_node *node; 652 struct acpi_namespace_node *node;
637 acpi_status status; 653 acpi_status status;
638 654
639 ACPI_FUNCTION_NAME("ev_install_handler"); 655 ACPI_FUNCTION_NAME(ev_install_handler);
640 656
641 handler_obj = (union acpi_operand_object *)context; 657 handler_obj = (union acpi_operand_object *)context;
642 658
@@ -666,6 +682,7 @@ acpi_ev_install_handler(acpi_handle obj_handle,
666 682
667 obj_desc = acpi_ns_get_attached_object(node); 683 obj_desc = acpi_ns_get_attached_object(node);
668 if (!obj_desc) { 684 if (!obj_desc) {
685
669 /* No object, just exit */ 686 /* No object, just exit */
670 687
671 return (AE_OK); 688 return (AE_OK);
@@ -674,10 +691,12 @@ acpi_ev_install_handler(acpi_handle obj_handle,
674 /* Devices are handled different than regions */ 691 /* Devices are handled different than regions */
675 692
676 if (ACPI_GET_OBJECT_TYPE(obj_desc) == ACPI_TYPE_DEVICE) { 693 if (ACPI_GET_OBJECT_TYPE(obj_desc) == ACPI_TYPE_DEVICE) {
694
677 /* Check if this Device already has a handler for this address space */ 695 /* Check if this Device already has a handler for this address space */
678 696
679 next_handler_obj = obj_desc->device.handler; 697 next_handler_obj = obj_desc->device.handler;
680 while (next_handler_obj) { 698 while (next_handler_obj) {
699
681 /* Found a handler, is it for the same address space? */ 700 /* Found a handler, is it for the same address space? */
682 701
683 if (next_handler_obj->address_space.space_id == 702 if (next_handler_obj->address_space.space_id ==
@@ -764,9 +783,9 @@ acpi_ev_install_space_handler(struct acpi_namespace_node * node,
764 union acpi_operand_object *handler_obj; 783 union acpi_operand_object *handler_obj;
765 acpi_status status; 784 acpi_status status;
766 acpi_object_type type; 785 acpi_object_type type;
767 u16 flags = 0; 786 u8 flags = 0;
768 787
769 ACPI_FUNCTION_TRACE("ev_install_space_handler"); 788 ACPI_FUNCTION_TRACE(ev_install_space_handler);
770 789
771 /* 790 /*
772 * This registration is valid for only the types below 791 * This registration is valid for only the types below
@@ -839,6 +858,7 @@ acpi_ev_install_space_handler(struct acpi_namespace_node * node,
839 /* Walk the handler list for this device */ 858 /* Walk the handler list for this device */
840 859
841 while (handler_obj) { 860 while (handler_obj) {
861
842 /* Same space_id indicates a handler already installed */ 862 /* Same space_id indicates a handler already installed */
843 863
844 if (handler_obj->address_space.space_id == space_id) { 864 if (handler_obj->address_space.space_id == space_id) {
@@ -921,7 +941,7 @@ acpi_ev_install_space_handler(struct acpi_namespace_node * node,
921 /* Init handler obj */ 941 /* Init handler obj */
922 942
923 handler_obj->address_space.space_id = (u8) space_id; 943 handler_obj->address_space.space_id = (u8) space_id;
924 handler_obj->address_space.hflags = flags; 944 handler_obj->address_space.handler_flags = flags;
925 handler_obj->address_space.region_list = NULL; 945 handler_obj->address_space.region_list = NULL;
926 handler_obj->address_space.node = node; 946 handler_obj->address_space.node = node;
927 handler_obj->address_space.handler = handler; 947 handler_obj->address_space.handler = handler;
@@ -979,7 +999,7 @@ acpi_ev_execute_reg_methods(struct acpi_namespace_node *node,
979{ 999{
980 acpi_status status; 1000 acpi_status status;
981 1001
982 ACPI_FUNCTION_TRACE("ev_execute_reg_methods"); 1002 ACPI_FUNCTION_TRACE(ev_execute_reg_methods);
983 1003
984 /* 1004 /*
985 * Run all _REG methods for all Operation Regions for this 1005 * Run all _REG methods for all Operation Regions for this
@@ -1001,7 +1021,7 @@ acpi_ev_execute_reg_methods(struct acpi_namespace_node *node,
1001 * 1021 *
1002 * PARAMETERS: walk_namespace callback 1022 * PARAMETERS: walk_namespace callback
1003 * 1023 *
1004 * DESCRIPTION: Run _REg method for region objects of the requested space_iD 1024 * DESCRIPTION: Run _REG method for region objects of the requested space_iD
1005 * 1025 *
1006 ******************************************************************************/ 1026 ******************************************************************************/
1007 1027
@@ -1035,6 +1055,7 @@ acpi_ev_reg_run(acpi_handle obj_handle,
1035 1055
1036 obj_desc = acpi_ns_get_attached_object(node); 1056 obj_desc = acpi_ns_get_attached_object(node);
1037 if (!obj_desc) { 1057 if (!obj_desc) {
1058
1038 /* No object, just exit */ 1059 /* No object, just exit */
1039 1060
1040 return (AE_OK); 1061 return (AE_OK);
diff --git a/drivers/acpi/events/evrgnini.c b/drivers/acpi/events/evrgnini.c
index baed8c1a1b9f..5b3c7a85eb9a 100644
--- a/drivers/acpi/events/evrgnini.c
+++ b/drivers/acpi/events/evrgnini.c
@@ -71,11 +71,22 @@ acpi_ev_system_memory_region_setup(acpi_handle handle,
71 (union acpi_operand_object *)handle; 71 (union acpi_operand_object *)handle;
72 struct acpi_mem_space_context *local_region_context; 72 struct acpi_mem_space_context *local_region_context;
73 73
74 ACPI_FUNCTION_TRACE("ev_system_memory_region_setup"); 74 ACPI_FUNCTION_TRACE(ev_system_memory_region_setup);
75 75
76 if (function == ACPI_REGION_DEACTIVATE) { 76 if (function == ACPI_REGION_DEACTIVATE) {
77 if (*region_context) { 77 if (*region_context) {
78 ACPI_MEM_FREE(*region_context); 78 local_region_context =
79 (struct acpi_mem_space_context *)*region_context;
80
81 /* Delete a cached mapping if present */
82
83 if (local_region_context->mapped_length) {
84 acpi_os_unmap_memory(local_region_context->
85 mapped_logical_address,
86 local_region_context->
87 mapped_length);
88 }
89 ACPI_FREE(local_region_context);
79 *region_context = NULL; 90 *region_context = NULL;
80 } 91 }
81 return_ACPI_STATUS(AE_OK); 92 return_ACPI_STATUS(AE_OK);
@@ -84,7 +95,7 @@ acpi_ev_system_memory_region_setup(acpi_handle handle,
84 /* Create a new context */ 95 /* Create a new context */
85 96
86 local_region_context = 97 local_region_context =
87 ACPI_MEM_CALLOCATE(sizeof(struct acpi_mem_space_context)); 98 ACPI_ALLOCATE_ZEROED(sizeof(struct acpi_mem_space_context));
88 if (!(local_region_context)) { 99 if (!(local_region_context)) {
89 return_ACPI_STATUS(AE_NO_MEMORY); 100 return_ACPI_STATUS(AE_NO_MEMORY);
90 } 101 }
@@ -118,7 +129,7 @@ acpi_ev_io_space_region_setup(acpi_handle handle,
118 u32 function, 129 u32 function,
119 void *handler_context, void **region_context) 130 void *handler_context, void **region_context)
120{ 131{
121 ACPI_FUNCTION_TRACE("ev_io_space_region_setup"); 132 ACPI_FUNCTION_TRACE(ev_io_space_region_setup);
122 133
123 if (function == ACPI_REGION_DEACTIVATE) { 134 if (function == ACPI_REGION_DEACTIVATE) {
124 *region_context = NULL; 135 *region_context = NULL;
@@ -161,7 +172,7 @@ acpi_ev_pci_config_region_setup(acpi_handle handle,
161 (union acpi_operand_object *)handle; 172 (union acpi_operand_object *)handle;
162 struct acpi_device_id object_hID; 173 struct acpi_device_id object_hID;
163 174
164 ACPI_FUNCTION_TRACE("ev_pci_config_region_setup"); 175 ACPI_FUNCTION_TRACE(ev_pci_config_region_setup);
165 176
166 handler_obj = region_obj->region.handler; 177 handler_obj = region_obj->region.handler;
167 if (!handler_obj) { 178 if (!handler_obj) {
@@ -178,7 +189,7 @@ acpi_ev_pci_config_region_setup(acpi_handle handle,
178 *region_context = NULL; 189 *region_context = NULL;
179 if (function == ACPI_REGION_DEACTIVATE) { 190 if (function == ACPI_REGION_DEACTIVATE) {
180 if (pci_id) { 191 if (pci_id) {
181 ACPI_MEM_FREE(pci_id); 192 ACPI_FREE(pci_id);
182 } 193 }
183 return_ACPI_STATUS(status); 194 return_ACPI_STATUS(status);
184 } 195 }
@@ -199,6 +210,7 @@ acpi_ev_pci_config_region_setup(acpi_handle handle,
199 * handlers with that device. 210 * handlers with that device.
200 */ 211 */
201 if (handler_obj->address_space.node == acpi_gbl_root_node) { 212 if (handler_obj->address_space.node == acpi_gbl_root_node) {
213
202 /* Start search from the parent object */ 214 /* Start search from the parent object */
203 215
204 pci_root_node = parent_node; 216 pci_root_node = parent_node;
@@ -220,6 +232,7 @@ acpi_ev_pci_config_region_setup(acpi_handle handle,
220 PCI_EXPRESS_ROOT_HID_STRING, 232 PCI_EXPRESS_ROOT_HID_STRING,
221 sizeof(PCI_EXPRESS_ROOT_HID_STRING))))) 233 sizeof(PCI_EXPRESS_ROOT_HID_STRING)))))
222 { 234 {
235
223 /* Install a handler for this PCI root bridge */ 236 /* Install a handler for this PCI root bridge */
224 237
225 status = 238 status =
@@ -235,7 +248,7 @@ acpi_ev_pci_config_region_setup(acpi_handle handle,
235 } else { 248 } else {
236 ACPI_EXCEPTION((AE_INFO, 249 ACPI_EXCEPTION((AE_INFO,
237 status, 250 status,
238 "Could not install pci_config handler for Root Bridge %4.4s", 251 "Could not install PciConfig handler for Root Bridge %4.4s",
239 acpi_ut_get_node_name 252 acpi_ut_get_node_name
240 (pci_root_node))); 253 (pci_root_node)));
241 } 254 }
@@ -262,7 +275,7 @@ acpi_ev_pci_config_region_setup(acpi_handle handle,
262 275
263 /* Region is still not initialized. Create a new context */ 276 /* Region is still not initialized. Create a new context */
264 277
265 pci_id = ACPI_MEM_CALLOCATE(sizeof(struct acpi_pci_id)); 278 pci_id = ACPI_ALLOCATE_ZEROED(sizeof(struct acpi_pci_id));
266 if (!pci_id) { 279 if (!pci_id) {
267 return_ACPI_STATUS(AE_NO_MEMORY); 280 return_ACPI_STATUS(AE_NO_MEMORY);
268 } 281 }
@@ -337,7 +350,7 @@ acpi_ev_pci_bar_region_setup(acpi_handle handle,
337 u32 function, 350 u32 function,
338 void *handler_context, void **region_context) 351 void *handler_context, void **region_context)
339{ 352{
340 ACPI_FUNCTION_TRACE("ev_pci_bar_region_setup"); 353 ACPI_FUNCTION_TRACE(ev_pci_bar_region_setup);
341 354
342 return_ACPI_STATUS(AE_OK); 355 return_ACPI_STATUS(AE_OK);
343} 356}
@@ -364,7 +377,7 @@ acpi_ev_cmos_region_setup(acpi_handle handle,
364 u32 function, 377 u32 function,
365 void *handler_context, void **region_context) 378 void *handler_context, void **region_context)
366{ 379{
367 ACPI_FUNCTION_TRACE("ev_cmos_region_setup"); 380 ACPI_FUNCTION_TRACE(ev_cmos_region_setup);
368 381
369 return_ACPI_STATUS(AE_OK); 382 return_ACPI_STATUS(AE_OK);
370} 383}
@@ -389,7 +402,7 @@ acpi_ev_default_region_setup(acpi_handle handle,
389 u32 function, 402 u32 function,
390 void *handler_context, void **region_context) 403 void *handler_context, void **region_context)
391{ 404{
392 ACPI_FUNCTION_TRACE("ev_default_region_setup"); 405 ACPI_FUNCTION_TRACE(ev_default_region_setup);
393 406
394 if (function == ACPI_REGION_DEACTIVATE) { 407 if (function == ACPI_REGION_DEACTIVATE) {
395 *region_context = NULL; 408 *region_context = NULL;
@@ -435,7 +448,7 @@ acpi_ev_initialize_region(union acpi_operand_object *region_obj,
435 acpi_name *reg_name_ptr = (acpi_name *) METHOD_NAME__REG; 448 acpi_name *reg_name_ptr = (acpi_name *) METHOD_NAME__REG;
436 union acpi_operand_object *region_obj2; 449 union acpi_operand_object *region_obj2;
437 450
438 ACPI_FUNCTION_TRACE_U32("ev_initialize_region", acpi_ns_locked); 451 ACPI_FUNCTION_TRACE_U32(ev_initialize_region, acpi_ns_locked);
439 452
440 if (!region_obj) { 453 if (!region_obj) {
441 return_ACPI_STATUS(AE_BAD_PARAMETER); 454 return_ACPI_STATUS(AE_BAD_PARAMETER);
@@ -462,8 +475,9 @@ acpi_ev_initialize_region(union acpi_operand_object *region_obj,
462 475
463 /* Find any "_REG" method associated with this region definition */ 476 /* Find any "_REG" method associated with this region definition */
464 477
465 status = acpi_ns_search_node(*reg_name_ptr, node, 478 status =
466 ACPI_TYPE_METHOD, &method_node); 479 acpi_ns_search_one_scope(*reg_name_ptr, node, ACPI_TYPE_METHOD,
480 &method_node);
467 if (ACPI_SUCCESS(status)) { 481 if (ACPI_SUCCESS(status)) {
468 /* 482 /*
469 * The _REG method is optional and there can be only one per region 483 * The _REG method is optional and there can be only one per region
@@ -478,11 +492,13 @@ acpi_ev_initialize_region(union acpi_operand_object *region_obj,
478 * ie: acpi_gbl_root_node->parent_entry being set to NULL 492 * ie: acpi_gbl_root_node->parent_entry being set to NULL
479 */ 493 */
480 while (node) { 494 while (node) {
495
481 /* Check to see if a handler exists */ 496 /* Check to see if a handler exists */
482 497
483 handler_obj = NULL; 498 handler_obj = NULL;
484 obj_desc = acpi_ns_get_attached_object(node); 499 obj_desc = acpi_ns_get_attached_object(node);
485 if (obj_desc) { 500 if (obj_desc) {
501
486 /* Can only be a handler if the object exists */ 502 /* Can only be a handler if the object exists */
487 503
488 switch (node->type) { 504 switch (node->type) {
@@ -507,10 +523,12 @@ acpi_ev_initialize_region(union acpi_operand_object *region_obj,
507 } 523 }
508 524
509 while (handler_obj) { 525 while (handler_obj) {
526
510 /* Is this handler of the correct type? */ 527 /* Is this handler of the correct type? */
511 528
512 if (handler_obj->address_space.space_id == 529 if (handler_obj->address_space.space_id ==
513 space_id) { 530 space_id) {
531
514 /* Found correct handler */ 532 /* Found correct handler */
515 533
516 ACPI_DEBUG_PRINT((ACPI_DB_OPREGION, 534 ACPI_DEBUG_PRINT((ACPI_DB_OPREGION,
@@ -571,7 +589,7 @@ acpi_ev_initialize_region(union acpi_operand_object *region_obj,
571 /* If we get here, there is no handler for this region */ 589 /* If we get here, there is no handler for this region */
572 590
573 ACPI_DEBUG_PRINT((ACPI_DB_OPREGION, 591 ACPI_DEBUG_PRINT((ACPI_DB_OPREGION,
574 "No handler for region_type %s(%X) (region_obj %p)\n", 592 "No handler for RegionType %s(%X) (RegionObj %p)\n",
575 acpi_ut_get_region_name(space_id), space_id, 593 acpi_ut_get_region_name(space_id), space_id,
576 region_obj)); 594 region_obj));
577 595
diff --git a/drivers/acpi/events/evsci.c b/drivers/acpi/events/evsci.c
index 9a622169008a..8106215ad554 100644
--- a/drivers/acpi/events/evsci.c
+++ b/drivers/acpi/events/evsci.c
@@ -69,7 +69,7 @@ static u32 ACPI_SYSTEM_XFACE acpi_ev_sci_xrupt_handler(void *context)
69 struct acpi_gpe_xrupt_info *gpe_xrupt_list = context; 69 struct acpi_gpe_xrupt_info *gpe_xrupt_list = context;
70 u32 interrupt_handled = ACPI_INTERRUPT_NOT_HANDLED; 70 u32 interrupt_handled = ACPI_INTERRUPT_NOT_HANDLED;
71 71
72 ACPI_FUNCTION_TRACE("ev_sci_xrupt_handler"); 72 ACPI_FUNCTION_TRACE(ev_sci_xrupt_handler);
73 73
74 /* 74 /*
75 * We are guaranteed by the ACPI CA initialization/shutdown code that 75 * We are guaranteed by the ACPI CA initialization/shutdown code that
@@ -108,7 +108,7 @@ u32 ACPI_SYSTEM_XFACE acpi_ev_gpe_xrupt_handler(void *context)
108 struct acpi_gpe_xrupt_info *gpe_xrupt_list = context; 108 struct acpi_gpe_xrupt_info *gpe_xrupt_list = context;
109 u32 interrupt_handled = ACPI_INTERRUPT_NOT_HANDLED; 109 u32 interrupt_handled = ACPI_INTERRUPT_NOT_HANDLED;
110 110
111 ACPI_FUNCTION_TRACE("ev_gpe_xrupt_handler"); 111 ACPI_FUNCTION_TRACE(ev_gpe_xrupt_handler);
112 112
113 /* 113 /*
114 * We are guaranteed by the ACPI CA initialization/shutdown code that 114 * We are guaranteed by the ACPI CA initialization/shutdown code that
@@ -140,7 +140,7 @@ u32 acpi_ev_install_sci_handler(void)
140{ 140{
141 u32 status = AE_OK; 141 u32 status = AE_OK;
142 142
143 ACPI_FUNCTION_TRACE("ev_install_sci_handler"); 143 ACPI_FUNCTION_TRACE(ev_install_sci_handler);
144 144
145 status = acpi_os_install_interrupt_handler((u32) acpi_gbl_FADT->sci_int, 145 status = acpi_os_install_interrupt_handler((u32) acpi_gbl_FADT->sci_int,
146 acpi_ev_sci_xrupt_handler, 146 acpi_ev_sci_xrupt_handler,
@@ -171,7 +171,7 @@ acpi_status acpi_ev_remove_sci_handler(void)
171{ 171{
172 acpi_status status; 172 acpi_status status;
173 173
174 ACPI_FUNCTION_TRACE("ev_remove_sci_handler"); 174 ACPI_FUNCTION_TRACE(ev_remove_sci_handler);
175 175
176 /* Just let the OS remove the handler and disable the level */ 176 /* Just let the OS remove the handler and disable the level */
177 177
diff --git a/drivers/acpi/events/evxface.c b/drivers/acpi/events/evxface.c
index b38b39dde543..76c34a66e0e0 100644
--- a/drivers/acpi/events/evxface.c
+++ b/drivers/acpi/events/evxface.c
@@ -41,8 +41,6 @@
41 * POSSIBILITY OF SUCH DAMAGES. 41 * POSSIBILITY OF SUCH DAMAGES.
42 */ 42 */
43 43
44#include <linux/module.h>
45
46#include <acpi/acpi.h> 44#include <acpi/acpi.h>
47#include <acpi/acnamesp.h> 45#include <acpi/acnamesp.h>
48#include <acpi/acevents.h> 46#include <acpi/acevents.h>
@@ -68,7 +66,7 @@ acpi_status acpi_install_exception_handler(acpi_exception_handler handler)
68{ 66{
69 acpi_status status; 67 acpi_status status;
70 68
71 ACPI_FUNCTION_TRACE("acpi_install_exception_handler"); 69 ACPI_FUNCTION_TRACE(acpi_install_exception_handler);
72 70
73 status = acpi_ut_acquire_mutex(ACPI_MTX_EVENTS); 71 status = acpi_ut_acquire_mutex(ACPI_MTX_EVENTS);
74 if (ACPI_FAILURE(status)) { 72 if (ACPI_FAILURE(status)) {
@@ -90,6 +88,8 @@ acpi_status acpi_install_exception_handler(acpi_exception_handler handler)
90 (void)acpi_ut_release_mutex(ACPI_MTX_EVENTS); 88 (void)acpi_ut_release_mutex(ACPI_MTX_EVENTS);
91 return_ACPI_STATUS(status); 89 return_ACPI_STATUS(status);
92} 90}
91
92ACPI_EXPORT_SYMBOL(acpi_install_exception_handler)
93#endif /* ACPI_FUTURE_USAGE */ 93#endif /* ACPI_FUTURE_USAGE */
94 94
95/******************************************************************************* 95/*******************************************************************************
@@ -107,14 +107,13 @@ acpi_status acpi_install_exception_handler(acpi_exception_handler handler)
107 * event. 107 * event.
108 * 108 *
109 ******************************************************************************/ 109 ******************************************************************************/
110
111acpi_status 110acpi_status
112acpi_install_fixed_event_handler(u32 event, 111acpi_install_fixed_event_handler(u32 event,
113 acpi_event_handler handler, void *context) 112 acpi_event_handler handler, void *context)
114{ 113{
115 acpi_status status; 114 acpi_status status;
116 115
117 ACPI_FUNCTION_TRACE("acpi_install_fixed_event_handler"); 116 ACPI_FUNCTION_TRACE(acpi_install_fixed_event_handler);
118 117
119 /* Parameter validation */ 118 /* Parameter validation */
120 119
@@ -161,7 +160,7 @@ acpi_install_fixed_event_handler(u32 event,
161 return_ACPI_STATUS(status); 160 return_ACPI_STATUS(status);
162} 161}
163 162
164EXPORT_SYMBOL(acpi_install_fixed_event_handler); 163ACPI_EXPORT_SYMBOL(acpi_install_fixed_event_handler)
165 164
166/******************************************************************************* 165/*******************************************************************************
167 * 166 *
@@ -175,13 +174,12 @@ EXPORT_SYMBOL(acpi_install_fixed_event_handler);
175 * DESCRIPTION: Disables the event and unregisters the event handler. 174 * DESCRIPTION: Disables the event and unregisters the event handler.
176 * 175 *
177 ******************************************************************************/ 176 ******************************************************************************/
178
179acpi_status 177acpi_status
180acpi_remove_fixed_event_handler(u32 event, acpi_event_handler handler) 178acpi_remove_fixed_event_handler(u32 event, acpi_event_handler handler)
181{ 179{
182 acpi_status status = AE_OK; 180 acpi_status status = AE_OK;
183 181
184 ACPI_FUNCTION_TRACE("acpi_remove_fixed_event_handler"); 182 ACPI_FUNCTION_TRACE(acpi_remove_fixed_event_handler);
185 183
186 /* Parameter validation */ 184 /* Parameter validation */
187 185
@@ -216,7 +214,7 @@ acpi_remove_fixed_event_handler(u32 event, acpi_event_handler handler)
216 return_ACPI_STATUS(status); 214 return_ACPI_STATUS(status);
217} 215}
218 216
219EXPORT_SYMBOL(acpi_remove_fixed_event_handler); 217ACPI_EXPORT_SYMBOL(acpi_remove_fixed_event_handler)
220 218
221/******************************************************************************* 219/*******************************************************************************
222 * 220 *
@@ -235,7 +233,6 @@ EXPORT_SYMBOL(acpi_remove_fixed_event_handler);
235 * DESCRIPTION: Install a handler for notifies on an ACPI device 233 * DESCRIPTION: Install a handler for notifies on an ACPI device
236 * 234 *
237 ******************************************************************************/ 235 ******************************************************************************/
238
239acpi_status 236acpi_status
240acpi_install_notify_handler(acpi_handle device, 237acpi_install_notify_handler(acpi_handle device,
241 u32 handler_type, 238 u32 handler_type,
@@ -246,7 +243,7 @@ acpi_install_notify_handler(acpi_handle device,
246 struct acpi_namespace_node *node; 243 struct acpi_namespace_node *node;
247 acpi_status status; 244 acpi_status status;
248 245
249 ACPI_FUNCTION_TRACE("acpi_install_notify_handler"); 246 ACPI_FUNCTION_TRACE(acpi_install_notify_handler);
250 247
251 /* Parameter validation */ 248 /* Parameter validation */
252 249
@@ -275,6 +272,7 @@ acpi_install_notify_handler(acpi_handle device,
275 * only one <external> global handler can be regsitered (per notify type). 272 * only one <external> global handler can be regsitered (per notify type).
276 */ 273 */
277 if (device == ACPI_ROOT_OBJECT) { 274 if (device == ACPI_ROOT_OBJECT) {
275
278 /* Make sure the handler is not already installed */ 276 /* Make sure the handler is not already installed */
279 277
280 if (((handler_type & ACPI_SYSTEM_NOTIFY) && 278 if (((handler_type & ACPI_SYSTEM_NOTIFY) &&
@@ -317,6 +315,7 @@ acpi_install_notify_handler(acpi_handle device,
317 315
318 obj_desc = acpi_ns_get_attached_object(node); 316 obj_desc = acpi_ns_get_attached_object(node);
319 if (obj_desc) { 317 if (obj_desc) {
318
320 /* Object exists - make sure there's no handler */ 319 /* Object exists - make sure there's no handler */
321 320
322 if (((handler_type & ACPI_SYSTEM_NOTIFY) && 321 if (((handler_type & ACPI_SYSTEM_NOTIFY) &&
@@ -370,6 +369,7 @@ acpi_install_notify_handler(acpi_handle device,
370 } 369 }
371 370
372 if (handler_type == ACPI_ALL_NOTIFY) { 371 if (handler_type == ACPI_ALL_NOTIFY) {
372
373 /* Extra ref if installed in both */ 373 /* Extra ref if installed in both */
374 374
375 acpi_ut_add_reference(notify_obj); 375 acpi_ut_add_reference(notify_obj);
@@ -381,7 +381,7 @@ acpi_install_notify_handler(acpi_handle device,
381 return_ACPI_STATUS(status); 381 return_ACPI_STATUS(status);
382} 382}
383 383
384EXPORT_SYMBOL(acpi_install_notify_handler); 384ACPI_EXPORT_SYMBOL(acpi_install_notify_handler)
385 385
386/******************************************************************************* 386/*******************************************************************************
387 * 387 *
@@ -399,7 +399,6 @@ EXPORT_SYMBOL(acpi_install_notify_handler);
399 * DESCRIPTION: Remove a handler for notifies on an ACPI device 399 * DESCRIPTION: Remove a handler for notifies on an ACPI device
400 * 400 *
401 ******************************************************************************/ 401 ******************************************************************************/
402
403acpi_status 402acpi_status
404acpi_remove_notify_handler(acpi_handle device, 403acpi_remove_notify_handler(acpi_handle device,
405 u32 handler_type, acpi_notify_handler handler) 404 u32 handler_type, acpi_notify_handler handler)
@@ -409,7 +408,7 @@ acpi_remove_notify_handler(acpi_handle device,
409 struct acpi_namespace_node *node; 408 struct acpi_namespace_node *node;
410 acpi_status status; 409 acpi_status status;
411 410
412 ACPI_FUNCTION_TRACE("acpi_remove_notify_handler"); 411 ACPI_FUNCTION_TRACE(acpi_remove_notify_handler);
413 412
414 /* Parameter validation */ 413 /* Parameter validation */
415 414
@@ -535,7 +534,7 @@ acpi_remove_notify_handler(acpi_handle device,
535 return_ACPI_STATUS(status); 534 return_ACPI_STATUS(status);
536} 535}
537 536
538EXPORT_SYMBOL(acpi_remove_notify_handler); 537ACPI_EXPORT_SYMBOL(acpi_remove_notify_handler)
539 538
540/******************************************************************************* 539/*******************************************************************************
541 * 540 *
@@ -554,7 +553,6 @@ EXPORT_SYMBOL(acpi_remove_notify_handler);
554 * DESCRIPTION: Install a handler for a General Purpose Event. 553 * DESCRIPTION: Install a handler for a General Purpose Event.
555 * 554 *
556 ******************************************************************************/ 555 ******************************************************************************/
557
558acpi_status 556acpi_status
559acpi_install_gpe_handler(acpi_handle gpe_device, 557acpi_install_gpe_handler(acpi_handle gpe_device,
560 u32 gpe_number, 558 u32 gpe_number,
@@ -565,7 +563,7 @@ acpi_install_gpe_handler(acpi_handle gpe_device,
565 acpi_status status; 563 acpi_status status;
566 acpi_cpu_flags flags; 564 acpi_cpu_flags flags;
567 565
568 ACPI_FUNCTION_TRACE("acpi_install_gpe_handler"); 566 ACPI_FUNCTION_TRACE(acpi_install_gpe_handler);
569 567
570 /* Parameter validation */ 568 /* Parameter validation */
571 569
@@ -596,7 +594,7 @@ acpi_install_gpe_handler(acpi_handle gpe_device,
596 594
597 /* Allocate and init handler object */ 595 /* Allocate and init handler object */
598 596
599 handler = ACPI_MEM_CALLOCATE(sizeof(struct acpi_handler_info)); 597 handler = ACPI_ALLOCATE_ZEROED(sizeof(struct acpi_handler_info));
600 if (!handler) { 598 if (!handler) {
601 status = AE_NO_MEMORY; 599 status = AE_NO_MEMORY;
602 goto unlock_and_exit; 600 goto unlock_and_exit;
@@ -630,7 +628,7 @@ acpi_install_gpe_handler(acpi_handle gpe_device,
630 return_ACPI_STATUS(status); 628 return_ACPI_STATUS(status);
631} 629}
632 630
633EXPORT_SYMBOL(acpi_install_gpe_handler); 631ACPI_EXPORT_SYMBOL(acpi_install_gpe_handler)
634 632
635/******************************************************************************* 633/*******************************************************************************
636 * 634 *
@@ -646,7 +644,6 @@ EXPORT_SYMBOL(acpi_install_gpe_handler);
646 * DESCRIPTION: Remove a handler for a General Purpose acpi_event. 644 * DESCRIPTION: Remove a handler for a General Purpose acpi_event.
647 * 645 *
648 ******************************************************************************/ 646 ******************************************************************************/
649
650acpi_status 647acpi_status
651acpi_remove_gpe_handler(acpi_handle gpe_device, 648acpi_remove_gpe_handler(acpi_handle gpe_device,
652 u32 gpe_number, acpi_event_handler address) 649 u32 gpe_number, acpi_event_handler address)
@@ -656,7 +653,7 @@ acpi_remove_gpe_handler(acpi_handle gpe_device,
656 acpi_status status; 653 acpi_status status;
657 acpi_cpu_flags flags; 654 acpi_cpu_flags flags;
658 655
659 ACPI_FUNCTION_TRACE("acpi_remove_gpe_handler"); 656 ACPI_FUNCTION_TRACE(acpi_remove_gpe_handler);
660 657
661 /* Parameter validation */ 658 /* Parameter validation */
662 659
@@ -724,14 +721,14 @@ acpi_remove_gpe_handler(acpi_handle gpe_device,
724 721
725 /* Now we can free the handler object */ 722 /* Now we can free the handler object */
726 723
727 ACPI_MEM_FREE(handler); 724 ACPI_FREE(handler);
728 725
729 unlock_and_exit: 726 unlock_and_exit:
730 (void)acpi_ut_release_mutex(ACPI_MTX_EVENTS); 727 (void)acpi_ut_release_mutex(ACPI_MTX_EVENTS);
731 return_ACPI_STATUS(status); 728 return_ACPI_STATUS(status);
732} 729}
733 730
734EXPORT_SYMBOL(acpi_remove_gpe_handler); 731ACPI_EXPORT_SYMBOL(acpi_remove_gpe_handler)
735 732
736/******************************************************************************* 733/*******************************************************************************
737 * 734 *
@@ -746,7 +743,6 @@ EXPORT_SYMBOL(acpi_remove_gpe_handler);
746 * DESCRIPTION: Acquire the ACPI Global Lock 743 * DESCRIPTION: Acquire the ACPI Global Lock
747 * 744 *
748 ******************************************************************************/ 745 ******************************************************************************/
749
750acpi_status acpi_acquire_global_lock(u16 timeout, u32 * handle) 746acpi_status acpi_acquire_global_lock(u16 timeout, u32 * handle)
751{ 747{
752 acpi_status status; 748 acpi_status status;
@@ -771,7 +767,7 @@ acpi_status acpi_acquire_global_lock(u16 timeout, u32 * handle)
771 return (status); 767 return (status);
772} 768}
773 769
774EXPORT_SYMBOL(acpi_acquire_global_lock); 770ACPI_EXPORT_SYMBOL(acpi_acquire_global_lock)
775 771
776/******************************************************************************* 772/*******************************************************************************
777 * 773 *
@@ -784,7 +780,6 @@ EXPORT_SYMBOL(acpi_acquire_global_lock);
784 * DESCRIPTION: Release the ACPI Global Lock. The handle must be valid. 780 * DESCRIPTION: Release the ACPI Global Lock. The handle must be valid.
785 * 781 *
786 ******************************************************************************/ 782 ******************************************************************************/
787
788acpi_status acpi_release_global_lock(u32 handle) 783acpi_status acpi_release_global_lock(u32 handle)
789{ 784{
790 acpi_status status; 785 acpi_status status;
@@ -797,4 +792,4 @@ acpi_status acpi_release_global_lock(u32 handle)
797 return (status); 792 return (status);
798} 793}
799 794
800EXPORT_SYMBOL(acpi_release_global_lock); 795ACPI_EXPORT_SYMBOL(acpi_release_global_lock)
diff --git a/drivers/acpi/events/evxfevnt.c b/drivers/acpi/events/evxfevnt.c
index ec9ce8429f15..7ebc2efac936 100644
--- a/drivers/acpi/events/evxfevnt.c
+++ b/drivers/acpi/events/evxfevnt.c
@@ -41,8 +41,6 @@
41 * POSSIBILITY OF SUCH DAMAGES. 41 * POSSIBILITY OF SUCH DAMAGES.
42 */ 42 */
43 43
44#include <linux/module.h>
45
46#include <acpi/acpi.h> 44#include <acpi/acpi.h>
47#include <acpi/acevents.h> 45#include <acpi/acevents.h>
48#include <acpi/acnamesp.h> 46#include <acpi/acnamesp.h>
@@ -65,7 +63,7 @@ acpi_status acpi_enable(void)
65{ 63{
66 acpi_status status = AE_OK; 64 acpi_status status = AE_OK;
67 65
68 ACPI_FUNCTION_TRACE("acpi_enable"); 66 ACPI_FUNCTION_TRACE(acpi_enable);
69 67
70 /* Make sure we have the FADT */ 68 /* Make sure we have the FADT */
71 69
@@ -94,6 +92,8 @@ acpi_status acpi_enable(void)
94 return_ACPI_STATUS(status); 92 return_ACPI_STATUS(status);
95} 93}
96 94
95ACPI_EXPORT_SYMBOL(acpi_enable)
96
97/******************************************************************************* 97/*******************************************************************************
98 * 98 *
99 * FUNCTION: acpi_disable 99 * FUNCTION: acpi_disable
@@ -105,12 +105,11 @@ acpi_status acpi_enable(void)
105 * DESCRIPTION: Transfers the system into LEGACY (non-ACPI) mode. 105 * DESCRIPTION: Transfers the system into LEGACY (non-ACPI) mode.
106 * 106 *
107 ******************************************************************************/ 107 ******************************************************************************/
108
109acpi_status acpi_disable(void) 108acpi_status acpi_disable(void)
110{ 109{
111 acpi_status status = AE_OK; 110 acpi_status status = AE_OK;
112 111
113 ACPI_FUNCTION_TRACE("acpi_disable"); 112 ACPI_FUNCTION_TRACE(acpi_disable);
114 113
115 if (!acpi_gbl_FADT) { 114 if (!acpi_gbl_FADT) {
116 ACPI_WARNING((AE_INFO, "No FADT information present!")); 115 ACPI_WARNING((AE_INFO, "No FADT information present!"));
@@ -137,6 +136,8 @@ acpi_status acpi_disable(void)
137 return_ACPI_STATUS(status); 136 return_ACPI_STATUS(status);
138} 137}
139 138
139ACPI_EXPORT_SYMBOL(acpi_disable)
140
140/******************************************************************************* 141/*******************************************************************************
141 * 142 *
142 * FUNCTION: acpi_enable_event 143 * FUNCTION: acpi_enable_event
@@ -149,13 +150,12 @@ acpi_status acpi_disable(void)
149 * DESCRIPTION: Enable an ACPI event (fixed) 150 * DESCRIPTION: Enable an ACPI event (fixed)
150 * 151 *
151 ******************************************************************************/ 152 ******************************************************************************/
152
153acpi_status acpi_enable_event(u32 event, u32 flags) 153acpi_status acpi_enable_event(u32 event, u32 flags)
154{ 154{
155 acpi_status status = AE_OK; 155 acpi_status status = AE_OK;
156 u32 value; 156 u32 value;
157 157
158 ACPI_FUNCTION_TRACE("acpi_enable_event"); 158 ACPI_FUNCTION_TRACE(acpi_enable_event);
159 159
160 /* Decode the Fixed Event */ 160 /* Decode the Fixed Event */
161 161
@@ -193,7 +193,7 @@ acpi_status acpi_enable_event(u32 event, u32 flags)
193 return_ACPI_STATUS(status); 193 return_ACPI_STATUS(status);
194} 194}
195 195
196EXPORT_SYMBOL(acpi_enable_event); 196ACPI_EXPORT_SYMBOL(acpi_enable_event)
197 197
198/******************************************************************************* 198/*******************************************************************************
199 * 199 *
@@ -208,13 +208,12 @@ EXPORT_SYMBOL(acpi_enable_event);
208 * DESCRIPTION: Set the type of an individual GPE 208 * DESCRIPTION: Set the type of an individual GPE
209 * 209 *
210 ******************************************************************************/ 210 ******************************************************************************/
211
212acpi_status acpi_set_gpe_type(acpi_handle gpe_device, u32 gpe_number, u8 type) 211acpi_status acpi_set_gpe_type(acpi_handle gpe_device, u32 gpe_number, u8 type)
213{ 212{
214 acpi_status status = AE_OK; 213 acpi_status status = AE_OK;
215 struct acpi_gpe_event_info *gpe_event_info; 214 struct acpi_gpe_event_info *gpe_event_info;
216 215
217 ACPI_FUNCTION_TRACE("acpi_set_gpe_type"); 216 ACPI_FUNCTION_TRACE(acpi_set_gpe_type);
218 217
219 /* Ensure that we have a valid GPE number */ 218 /* Ensure that we have a valid GPE number */
220 219
@@ -236,7 +235,7 @@ acpi_status acpi_set_gpe_type(acpi_handle gpe_device, u32 gpe_number, u8 type)
236 return_ACPI_STATUS(status); 235 return_ACPI_STATUS(status);
237} 236}
238 237
239EXPORT_SYMBOL(acpi_set_gpe_type); 238ACPI_EXPORT_SYMBOL(acpi_set_gpe_type)
240 239
241/******************************************************************************* 240/*******************************************************************************
242 * 241 *
@@ -252,13 +251,12 @@ EXPORT_SYMBOL(acpi_set_gpe_type);
252 * DESCRIPTION: Enable an ACPI event (general purpose) 251 * DESCRIPTION: Enable an ACPI event (general purpose)
253 * 252 *
254 ******************************************************************************/ 253 ******************************************************************************/
255
256acpi_status acpi_enable_gpe(acpi_handle gpe_device, u32 gpe_number, u32 flags) 254acpi_status acpi_enable_gpe(acpi_handle gpe_device, u32 gpe_number, u32 flags)
257{ 255{
258 acpi_status status = AE_OK; 256 acpi_status status = AE_OK;
259 struct acpi_gpe_event_info *gpe_event_info; 257 struct acpi_gpe_event_info *gpe_event_info;
260 258
261 ACPI_FUNCTION_TRACE("acpi_enable_gpe"); 259 ACPI_FUNCTION_TRACE(acpi_enable_gpe);
262 260
263 /* Use semaphore lock if not executing at interrupt level */ 261 /* Use semaphore lock if not executing at interrupt level */
264 262
@@ -288,7 +286,7 @@ acpi_status acpi_enable_gpe(acpi_handle gpe_device, u32 gpe_number, u32 flags)
288 return_ACPI_STATUS(status); 286 return_ACPI_STATUS(status);
289} 287}
290 288
291EXPORT_SYMBOL(acpi_enable_gpe); 289ACPI_EXPORT_SYMBOL(acpi_enable_gpe)
292 290
293/******************************************************************************* 291/*******************************************************************************
294 * 292 *
@@ -304,13 +302,12 @@ EXPORT_SYMBOL(acpi_enable_gpe);
304 * DESCRIPTION: Disable an ACPI event (general purpose) 302 * DESCRIPTION: Disable an ACPI event (general purpose)
305 * 303 *
306 ******************************************************************************/ 304 ******************************************************************************/
307
308acpi_status acpi_disable_gpe(acpi_handle gpe_device, u32 gpe_number, u32 flags) 305acpi_status acpi_disable_gpe(acpi_handle gpe_device, u32 gpe_number, u32 flags)
309{ 306{
310 acpi_status status = AE_OK; 307 acpi_status status = AE_OK;
311 struct acpi_gpe_event_info *gpe_event_info; 308 struct acpi_gpe_event_info *gpe_event_info;
312 309
313 ACPI_FUNCTION_TRACE("acpi_disable_gpe"); 310 ACPI_FUNCTION_TRACE(acpi_disable_gpe);
314 311
315 /* Use semaphore lock if not executing at interrupt level */ 312 /* Use semaphore lock if not executing at interrupt level */
316 313
@@ -338,6 +335,8 @@ acpi_status acpi_disable_gpe(acpi_handle gpe_device, u32 gpe_number, u32 flags)
338 return_ACPI_STATUS(status); 335 return_ACPI_STATUS(status);
339} 336}
340 337
338ACPI_EXPORT_SYMBOL(acpi_disable_gpe)
339
341/******************************************************************************* 340/*******************************************************************************
342 * 341 *
343 * FUNCTION: acpi_disable_event 342 * FUNCTION: acpi_disable_event
@@ -350,13 +349,12 @@ acpi_status acpi_disable_gpe(acpi_handle gpe_device, u32 gpe_number, u32 flags)
350 * DESCRIPTION: Disable an ACPI event (fixed) 349 * DESCRIPTION: Disable an ACPI event (fixed)
351 * 350 *
352 ******************************************************************************/ 351 ******************************************************************************/
353
354acpi_status acpi_disable_event(u32 event, u32 flags) 352acpi_status acpi_disable_event(u32 event, u32 flags)
355{ 353{
356 acpi_status status = AE_OK; 354 acpi_status status = AE_OK;
357 u32 value; 355 u32 value;
358 356
359 ACPI_FUNCTION_TRACE("acpi_disable_event"); 357 ACPI_FUNCTION_TRACE(acpi_disable_event);
360 358
361 /* Decode the Fixed Event */ 359 /* Decode the Fixed Event */
362 360
@@ -392,7 +390,7 @@ acpi_status acpi_disable_event(u32 event, u32 flags)
392 return_ACPI_STATUS(status); 390 return_ACPI_STATUS(status);
393} 391}
394 392
395EXPORT_SYMBOL(acpi_disable_event); 393ACPI_EXPORT_SYMBOL(acpi_disable_event)
396 394
397/******************************************************************************* 395/*******************************************************************************
398 * 396 *
@@ -405,12 +403,11 @@ EXPORT_SYMBOL(acpi_disable_event);
405 * DESCRIPTION: Clear an ACPI event (fixed) 403 * DESCRIPTION: Clear an ACPI event (fixed)
406 * 404 *
407 ******************************************************************************/ 405 ******************************************************************************/
408
409acpi_status acpi_clear_event(u32 event) 406acpi_status acpi_clear_event(u32 event)
410{ 407{
411 acpi_status status = AE_OK; 408 acpi_status status = AE_OK;
412 409
413 ACPI_FUNCTION_TRACE("acpi_clear_event"); 410 ACPI_FUNCTION_TRACE(acpi_clear_event);
414 411
415 /* Decode the Fixed Event */ 412 /* Decode the Fixed Event */
416 413
@@ -429,7 +426,7 @@ acpi_status acpi_clear_event(u32 event)
429 return_ACPI_STATUS(status); 426 return_ACPI_STATUS(status);
430} 427}
431 428
432EXPORT_SYMBOL(acpi_clear_event); 429ACPI_EXPORT_SYMBOL(acpi_clear_event)
433 430
434/******************************************************************************* 431/*******************************************************************************
435 * 432 *
@@ -444,13 +441,12 @@ EXPORT_SYMBOL(acpi_clear_event);
444 * DESCRIPTION: Clear an ACPI event (general purpose) 441 * DESCRIPTION: Clear an ACPI event (general purpose)
445 * 442 *
446 ******************************************************************************/ 443 ******************************************************************************/
447
448acpi_status acpi_clear_gpe(acpi_handle gpe_device, u32 gpe_number, u32 flags) 444acpi_status acpi_clear_gpe(acpi_handle gpe_device, u32 gpe_number, u32 flags)
449{ 445{
450 acpi_status status = AE_OK; 446 acpi_status status = AE_OK;
451 struct acpi_gpe_event_info *gpe_event_info; 447 struct acpi_gpe_event_info *gpe_event_info;
452 448
453 ACPI_FUNCTION_TRACE("acpi_clear_gpe"); 449 ACPI_FUNCTION_TRACE(acpi_clear_gpe);
454 450
455 /* Use semaphore lock if not executing at interrupt level */ 451 /* Use semaphore lock if not executing at interrupt level */
456 452
@@ -478,6 +474,8 @@ acpi_status acpi_clear_gpe(acpi_handle gpe_device, u32 gpe_number, u32 flags)
478 return_ACPI_STATUS(status); 474 return_ACPI_STATUS(status);
479} 475}
480 476
477ACPI_EXPORT_SYMBOL(acpi_clear_gpe)
478
481#ifdef ACPI_FUTURE_USAGE 479#ifdef ACPI_FUTURE_USAGE
482/******************************************************************************* 480/*******************************************************************************
483 * 481 *
@@ -492,12 +490,11 @@ acpi_status acpi_clear_gpe(acpi_handle gpe_device, u32 gpe_number, u32 flags)
492 * DESCRIPTION: Obtains and returns the current status of the event 490 * DESCRIPTION: Obtains and returns the current status of the event
493 * 491 *
494 ******************************************************************************/ 492 ******************************************************************************/
495
496acpi_status acpi_get_event_status(u32 event, acpi_event_status * event_status) 493acpi_status acpi_get_event_status(u32 event, acpi_event_status * event_status)
497{ 494{
498 acpi_status status = AE_OK; 495 acpi_status status = AE_OK;
499 496
500 ACPI_FUNCTION_TRACE("acpi_get_event_status"); 497 ACPI_FUNCTION_TRACE(acpi_get_event_status);
501 498
502 if (!event_status) { 499 if (!event_status) {
503 return_ACPI_STATUS(AE_BAD_PARAMETER); 500 return_ACPI_STATUS(AE_BAD_PARAMETER);
@@ -518,6 +515,8 @@ acpi_status acpi_get_event_status(u32 event, acpi_event_status * event_status)
518 return_ACPI_STATUS(status); 515 return_ACPI_STATUS(status);
519} 516}
520 517
518ACPI_EXPORT_SYMBOL(acpi_get_event_status)
519
521/******************************************************************************* 520/*******************************************************************************
522 * 521 *
523 * FUNCTION: acpi_get_gpe_status 522 * FUNCTION: acpi_get_gpe_status
@@ -533,7 +532,6 @@ acpi_status acpi_get_event_status(u32 event, acpi_event_status * event_status)
533 * DESCRIPTION: Get status of an event (general purpose) 532 * DESCRIPTION: Get status of an event (general purpose)
534 * 533 *
535 ******************************************************************************/ 534 ******************************************************************************/
536
537acpi_status 535acpi_status
538acpi_get_gpe_status(acpi_handle gpe_device, 536acpi_get_gpe_status(acpi_handle gpe_device,
539 u32 gpe_number, u32 flags, acpi_event_status * event_status) 537 u32 gpe_number, u32 flags, acpi_event_status * event_status)
@@ -541,7 +539,7 @@ acpi_get_gpe_status(acpi_handle gpe_device,
541 acpi_status status = AE_OK; 539 acpi_status status = AE_OK;
542 struct acpi_gpe_event_info *gpe_event_info; 540 struct acpi_gpe_event_info *gpe_event_info;
543 541
544 ACPI_FUNCTION_TRACE("acpi_get_gpe_status"); 542 ACPI_FUNCTION_TRACE(acpi_get_gpe_status);
545 543
546 /* Use semaphore lock if not executing at interrupt level */ 544 /* Use semaphore lock if not executing at interrupt level */
547 545
@@ -570,6 +568,8 @@ acpi_get_gpe_status(acpi_handle gpe_device,
570 } 568 }
571 return_ACPI_STATUS(status); 569 return_ACPI_STATUS(status);
572} 570}
571
572ACPI_EXPORT_SYMBOL(acpi_get_gpe_status)
573#endif /* ACPI_FUTURE_USAGE */ 573#endif /* ACPI_FUTURE_USAGE */
574 574
575/******************************************************************************* 575/*******************************************************************************
@@ -586,7 +586,6 @@ acpi_get_gpe_status(acpi_handle gpe_device,
586 * DESCRIPTION: Create and Install a block of GPE registers 586 * DESCRIPTION: Create and Install a block of GPE registers
587 * 587 *
588 ******************************************************************************/ 588 ******************************************************************************/
589
590acpi_status 589acpi_status
591acpi_install_gpe_block(acpi_handle gpe_device, 590acpi_install_gpe_block(acpi_handle gpe_device,
592 struct acpi_generic_address *gpe_block_address, 591 struct acpi_generic_address *gpe_block_address,
@@ -597,7 +596,7 @@ acpi_install_gpe_block(acpi_handle gpe_device,
597 struct acpi_namespace_node *node; 596 struct acpi_namespace_node *node;
598 struct acpi_gpe_block_info *gpe_block; 597 struct acpi_gpe_block_info *gpe_block;
599 598
600 ACPI_FUNCTION_TRACE("acpi_install_gpe_block"); 599 ACPI_FUNCTION_TRACE(acpi_install_gpe_block);
601 600
602 if ((!gpe_device) || (!gpe_block_address) || (!register_count)) { 601 if ((!gpe_device) || (!gpe_block_address) || (!register_count)) {
603 return_ACPI_STATUS(AE_BAD_PARAMETER); 602 return_ACPI_STATUS(AE_BAD_PARAMETER);
@@ -636,6 +635,7 @@ acpi_install_gpe_block(acpi_handle gpe_device,
636 635
637 obj_desc = acpi_ns_get_attached_object(node); 636 obj_desc = acpi_ns_get_attached_object(node);
638 if (!obj_desc) { 637 if (!obj_desc) {
638
639 /* No object, create a new one */ 639 /* No object, create a new one */
640 640
641 obj_desc = acpi_ut_create_internal_object(ACPI_TYPE_DEVICE); 641 obj_desc = acpi_ut_create_internal_object(ACPI_TYPE_DEVICE);
@@ -665,7 +665,7 @@ acpi_install_gpe_block(acpi_handle gpe_device,
665 return_ACPI_STATUS(status); 665 return_ACPI_STATUS(status);
666} 666}
667 667
668EXPORT_SYMBOL(acpi_install_gpe_block); 668ACPI_EXPORT_SYMBOL(acpi_install_gpe_block)
669 669
670/******************************************************************************* 670/*******************************************************************************
671 * 671 *
@@ -678,14 +678,13 @@ EXPORT_SYMBOL(acpi_install_gpe_block);
678 * DESCRIPTION: Remove a previously installed block of GPE registers 678 * DESCRIPTION: Remove a previously installed block of GPE registers
679 * 679 *
680 ******************************************************************************/ 680 ******************************************************************************/
681
682acpi_status acpi_remove_gpe_block(acpi_handle gpe_device) 681acpi_status acpi_remove_gpe_block(acpi_handle gpe_device)
683{ 682{
684 union acpi_operand_object *obj_desc; 683 union acpi_operand_object *obj_desc;
685 acpi_status status; 684 acpi_status status;
686 struct acpi_namespace_node *node; 685 struct acpi_namespace_node *node;
687 686
688 ACPI_FUNCTION_TRACE("acpi_remove_gpe_block"); 687 ACPI_FUNCTION_TRACE(acpi_remove_gpe_block);
689 688
690 if (!gpe_device) { 689 if (!gpe_device) {
691 return_ACPI_STATUS(AE_BAD_PARAMETER); 690 return_ACPI_STATUS(AE_BAD_PARAMETER);
@@ -721,4 +720,4 @@ acpi_status acpi_remove_gpe_block(acpi_handle gpe_device)
721 return_ACPI_STATUS(status); 720 return_ACPI_STATUS(status);
722} 721}
723 722
724EXPORT_SYMBOL(acpi_remove_gpe_block); 723ACPI_EXPORT_SYMBOL(acpi_remove_gpe_block)
diff --git a/drivers/acpi/events/evxfregn.c b/drivers/acpi/events/evxfregn.c
index abf5caca9ae5..e8b86a0baad0 100644
--- a/drivers/acpi/events/evxfregn.c
+++ b/drivers/acpi/events/evxfregn.c
@@ -42,8 +42,6 @@
42 * POSSIBILITY OF SUCH DAMAGES. 42 * POSSIBILITY OF SUCH DAMAGES.
43 */ 43 */
44 44
45#include <linux/module.h>
46
47#include <acpi/acpi.h> 45#include <acpi/acpi.h>
48#include <acpi/acnamesp.h> 46#include <acpi/acnamesp.h>
49#include <acpi/acevents.h> 47#include <acpi/acevents.h>
@@ -75,7 +73,7 @@ acpi_install_address_space_handler(acpi_handle device,
75 struct acpi_namespace_node *node; 73 struct acpi_namespace_node *node;
76 acpi_status status; 74 acpi_status status;
77 75
78 ACPI_FUNCTION_TRACE("acpi_install_address_space_handler"); 76 ACPI_FUNCTION_TRACE(acpi_install_address_space_handler);
79 77
80 /* Parameter validation */ 78 /* Parameter validation */
81 79
@@ -114,7 +112,7 @@ acpi_install_address_space_handler(acpi_handle device,
114 return_ACPI_STATUS(status); 112 return_ACPI_STATUS(status);
115} 113}
116 114
117EXPORT_SYMBOL(acpi_install_address_space_handler); 115ACPI_EXPORT_SYMBOL(acpi_install_address_space_handler)
118 116
119/******************************************************************************* 117/*******************************************************************************
120 * 118 *
@@ -129,7 +127,6 @@ EXPORT_SYMBOL(acpi_install_address_space_handler);
129 * DESCRIPTION: Remove a previously installed handler. 127 * DESCRIPTION: Remove a previously installed handler.
130 * 128 *
131 ******************************************************************************/ 129 ******************************************************************************/
132
133acpi_status 130acpi_status
134acpi_remove_address_space_handler(acpi_handle device, 131acpi_remove_address_space_handler(acpi_handle device,
135 acpi_adr_space_type space_id, 132 acpi_adr_space_type space_id,
@@ -142,7 +139,7 @@ acpi_remove_address_space_handler(acpi_handle device,
142 struct acpi_namespace_node *node; 139 struct acpi_namespace_node *node;
143 acpi_status status; 140 acpi_status status;
144 141
145 ACPI_FUNCTION_TRACE("acpi_remove_address_space_handler"); 142 ACPI_FUNCTION_TRACE(acpi_remove_address_space_handler);
146 143
147 /* Parameter validation */ 144 /* Parameter validation */
148 145
@@ -176,9 +173,11 @@ acpi_remove_address_space_handler(acpi_handle device,
176 handler_obj = obj_desc->device.handler; 173 handler_obj = obj_desc->device.handler;
177 last_obj_ptr = &obj_desc->device.handler; 174 last_obj_ptr = &obj_desc->device.handler;
178 while (handler_obj) { 175 while (handler_obj) {
176
179 /* We have a handler, see if user requested this one */ 177 /* We have a handler, see if user requested this one */
180 178
181 if (handler_obj->address_space.space_id == space_id) { 179 if (handler_obj->address_space.space_id == space_id) {
180
182 /* Matched space_id, first dereference this in the Regions */ 181 /* Matched space_id, first dereference this in the Regions */
183 182
184 ACPI_DEBUG_PRINT((ACPI_DB_OPREGION, 183 ACPI_DEBUG_PRINT((ACPI_DB_OPREGION,
@@ -229,7 +228,7 @@ acpi_remove_address_space_handler(acpi_handle device,
229 /* The handler does not exist */ 228 /* The handler does not exist */
230 229
231 ACPI_DEBUG_PRINT((ACPI_DB_OPREGION, 230 ACPI_DEBUG_PRINT((ACPI_DB_OPREGION,
232 "Unable to remove address handler %p for %s(%X), dev_node %p, obj %p\n", 231 "Unable to remove address handler %p for %s(%X), DevNode %p, obj %p\n",
233 handler, acpi_ut_get_region_name(space_id), space_id, 232 handler, acpi_ut_get_region_name(space_id), space_id,
234 node, obj_desc)); 233 node, obj_desc));
235 234
@@ -240,4 +239,4 @@ acpi_remove_address_space_handler(acpi_handle device,
240 return_ACPI_STATUS(status); 239 return_ACPI_STATUS(status);
241} 240}
242 241
243EXPORT_SYMBOL(acpi_remove_address_space_handler); 242ACPI_EXPORT_SYMBOL(acpi_remove_address_space_handler)