Commit a44061aa8b5d58b2729faca4c155a94a5bea2a09
Committed by
Len Brown
1 parent
e8b6f97010
Exists in
master
and in
7 other branches
ACPICA: Remove wakeup GPE reference counting which is not used
After the previous patch that introduced acpi_gpe_wakeup() and modified the ACPI suspend and wakeup code to use it, the third argument of acpi_{enable|disable}_gpe() and the GPE wakeup reference counter are not necessary any more. Remove them and modify all of the users of acpi_{enable|disable}_gpe() accordingly. Also drop GPE type constants that aren't used any more. Signed-off-by: Rafael J. Wysocki <rjw@sisk.pl> Signed-off-by: Len Brown <len.brown@intel.com> Signed-off-by: Bob Moore <robert.moore@intel.com> Signed-off-by: Lin Ming <ming.m.lin@intel.com> Signed-off-by: Len Brown <len.brown@intel.com>
Showing 12 changed files with 50 additions and 135 deletions Side-by-side Diff
- drivers/acpi/acpica/acevents.h
- drivers/acpi/acpica/aclocal.h
- drivers/acpi/acpica/evgpe.c
- drivers/acpi/acpica/evgpeblk.c
- drivers/acpi/acpica/evgpeinit.c
- drivers/acpi/acpica/evxfevnt.c
- drivers/acpi/button.c
- drivers/acpi/ec.c
- drivers/acpi/system.c
- drivers/pci/pci-acpi.c
- include/acpi/acpixf.h
- include/acpi/actypes.h
drivers/acpi/acpica/acevents.h
... | ... | @@ -78,7 +78,7 @@ |
78 | 78 | u32 acpi_ev_gpe_detect(struct acpi_gpe_xrupt_info *gpe_xrupt_list); |
79 | 79 | |
80 | 80 | acpi_status |
81 | -acpi_ev_update_gpe_enable_masks(struct acpi_gpe_event_info *gpe_event_info); | |
81 | +acpi_ev_update_gpe_enable_mask(struct acpi_gpe_event_info *gpe_event_info); | |
82 | 82 | |
83 | 83 | struct acpi_gpe_event_info *acpi_ev_get_gpe_event_info(acpi_handle gpe_device, |
84 | 84 | u32 gpe_number); |
drivers/acpi/acpica/aclocal.h
... | ... | @@ -429,7 +429,6 @@ |
429 | 429 | u8 flags; /* Misc info about this GPE */ |
430 | 430 | u8 gpe_number; /* This GPE */ |
431 | 431 | u8 runtime_count; /* References to a run GPE */ |
432 | - u8 wakeup_count; /* References to a wake GPE */ | |
433 | 432 | }; |
434 | 433 | |
435 | 434 | /* Information about a GPE register pair, one per each status/enable pair in an array */ |
drivers/acpi/acpica/evgpe.c
... | ... | @@ -54,24 +54,24 @@ |
54 | 54 | |
55 | 55 | /******************************************************************************* |
56 | 56 | * |
57 | - * FUNCTION: acpi_ev_update_gpe_enable_masks | |
57 | + * FUNCTION: acpi_ev_update_gpe_enable_mask | |
58 | 58 | * |
59 | 59 | * PARAMETERS: gpe_event_info - GPE to update |
60 | 60 | * |
61 | 61 | * RETURN: Status |
62 | 62 | * |
63 | - * DESCRIPTION: Updates GPE register enable masks based upon whether there are | |
64 | - * references (either wake or run) to this GPE | |
63 | + * DESCRIPTION: Updates GPE register enable mask based upon whether there are | |
64 | + * runtime references to this GPE | |
65 | 65 | * |
66 | 66 | ******************************************************************************/ |
67 | 67 | |
68 | 68 | acpi_status |
69 | -acpi_ev_update_gpe_enable_masks(struct acpi_gpe_event_info *gpe_event_info) | |
69 | +acpi_ev_update_gpe_enable_mask(struct acpi_gpe_event_info *gpe_event_info) | |
70 | 70 | { |
71 | 71 | struct acpi_gpe_register_info *gpe_register_info; |
72 | 72 | u32 register_bit; |
73 | 73 | |
74 | - ACPI_FUNCTION_TRACE(ev_update_gpe_enable_masks); | |
74 | + ACPI_FUNCTION_TRACE(ev_update_gpe_enable_mask); | |
75 | 75 | |
76 | 76 | gpe_register_info = gpe_event_info->register_info; |
77 | 77 | if (!gpe_register_info) { |
78 | 78 | |
79 | 79 | |
80 | 80 | |
... | ... | @@ -81,19 +81,14 @@ |
81 | 81 | register_bit = acpi_hw_get_gpe_register_bit(gpe_event_info, |
82 | 82 | gpe_register_info); |
83 | 83 | |
84 | - /* Clear the wake/run bits up front */ | |
84 | + /* Clear the run bit up front */ | |
85 | 85 | |
86 | - ACPI_CLEAR_BIT(gpe_register_info->enable_for_wake, register_bit); | |
87 | 86 | ACPI_CLEAR_BIT(gpe_register_info->enable_for_run, register_bit); |
88 | 87 | |
89 | - /* Set the mask bits only if there are references to this GPE */ | |
88 | + /* Set the mask bit only if there are references to this GPE */ | |
90 | 89 | |
91 | 90 | if (gpe_event_info->runtime_count) { |
92 | - ACPI_SET_BIT(gpe_register_info->enable_for_run, register_bit); | |
93 | - } | |
94 | - | |
95 | - if (gpe_event_info->wakeup_count) { | |
96 | - ACPI_SET_BIT(gpe_register_info->enable_for_wake, register_bit); | |
91 | + ACPI_SET_BIT(gpe_register_info->enable_for_run, (u8)register_bit); | |
97 | 92 | } |
98 | 93 | |
99 | 94 | return_ACPI_STATUS(AE_OK); |
drivers/acpi/acpica/evgpeblk.c
... | ... | @@ -529,8 +529,7 @@ |
529 | 529 | |
530 | 530 | /* Enable this GPE */ |
531 | 531 | |
532 | - status = acpi_enable_gpe(gpe_device, gpe_number, | |
533 | - ACPI_GPE_TYPE_RUNTIME); | |
532 | + status = acpi_enable_gpe(gpe_device, gpe_number); | |
534 | 533 | if (ACPI_FAILURE(status)) { |
535 | 534 | ACPI_EXCEPTION((AE_INFO, status, |
536 | 535 | "Could not enable GPE 0x%02X", |
drivers/acpi/acpica/evgpeinit.c
... | ... | @@ -482,8 +482,7 @@ |
482 | 482 | gpe_device = NULL; |
483 | 483 | } |
484 | 484 | |
485 | - status = acpi_enable_gpe(gpe_device, gpe_number, | |
486 | - ACPI_GPE_TYPE_RUNTIME); | |
485 | + status = acpi_enable_gpe(gpe_device, gpe_number); | |
487 | 486 | if (ACPI_FAILURE(status)) { |
488 | 487 | ACPI_EXCEPTION((AE_INFO, status, |
489 | 488 | "Could not enable GPE 0x%02X", |
drivers/acpi/acpica/evxfevnt.c
... | ... | @@ -352,12 +352,13 @@ |
352 | 352 | |
353 | 353 | switch (action) { |
354 | 354 | case ACPI_GPE_ENABLE: |
355 | - ACPI_SET_BIT(gpe_register_info->enable_for_wake, register_bit); | |
355 | + ACPI_SET_BIT(gpe_register_info->enable_for_wake, | |
356 | + (u8)register_bit); | |
356 | 357 | break; |
357 | 358 | |
358 | 359 | case ACPI_GPE_DISABLE: |
359 | 360 | ACPI_CLEAR_BIT(gpe_register_info->enable_for_wake, |
360 | - register_bit); | |
361 | + (u8)register_bit); | |
361 | 362 | break; |
362 | 363 | |
363 | 364 | default: |
364 | 365 | |
365 | 366 | |
... | ... | @@ -379,17 +380,14 @@ |
379 | 380 | * |
380 | 381 | * PARAMETERS: gpe_device - Parent GPE Device. NULL for GPE0/GPE1 |
381 | 382 | * gpe_number - GPE level within the GPE block |
382 | - * gpe_type - ACPI_GPE_TYPE_RUNTIME or ACPI_GPE_TYPE_WAKE | |
383 | - * or both | |
384 | 383 | * |
385 | 384 | * RETURN: Status |
386 | 385 | * |
387 | 386 | * DESCRIPTION: Add a reference to a GPE. On the first reference, the GPE is |
388 | - * hardware-enabled (for runtime GPEs), or the GPE register mask | |
389 | - * is updated (for wake GPEs). | |
387 | + * hardware-enabled. | |
390 | 388 | * |
391 | 389 | ******************************************************************************/ |
392 | -acpi_status acpi_enable_gpe(acpi_handle gpe_device, u32 gpe_number, u8 gpe_type) | |
390 | +acpi_status acpi_enable_gpe(acpi_handle gpe_device, u32 gpe_number) | |
393 | 391 | { |
394 | 392 | acpi_status status = AE_OK; |
395 | 393 | struct acpi_gpe_event_info *gpe_event_info; |
... | ... | @@ -397,12 +395,6 @@ |
397 | 395 | |
398 | 396 | ACPI_FUNCTION_TRACE(acpi_enable_gpe); |
399 | 397 | |
400 | - /* Parameter validation */ | |
401 | - | |
402 | - if (!gpe_type || (gpe_type & ~ACPI_GPE_TYPE_WAKE_RUN)) { | |
403 | - return_ACPI_STATUS(AE_BAD_PARAMETER); | |
404 | - } | |
405 | - | |
406 | 398 | flags = acpi_os_acquire_lock(acpi_gbl_gpe_lock); |
407 | 399 | |
408 | 400 | /* Ensure that we have a valid GPE number */ |
409 | 401 | |
410 | 402 | |
411 | 403 | |
... | ... | @@ -413,47 +405,20 @@ |
413 | 405 | goto unlock_and_exit; |
414 | 406 | } |
415 | 407 | |
416 | - if (gpe_type & ACPI_GPE_TYPE_RUNTIME) { | |
417 | - if (gpe_event_info->runtime_count == ACPI_UINT8_MAX) { | |
418 | - status = AE_LIMIT; /* Too many references */ | |
419 | - goto unlock_and_exit; | |
420 | - } | |
421 | - | |
422 | - gpe_event_info->runtime_count++; | |
423 | - if (gpe_event_info->runtime_count == 1) { | |
424 | - status = acpi_ev_update_gpe_enable_masks(gpe_event_info); | |
425 | - if (ACPI_SUCCESS(status)) { | |
426 | - status = acpi_clear_and_enable_gpe(gpe_event_info); | |
427 | - } | |
428 | - | |
429 | - if (ACPI_FAILURE(status)) { | |
430 | - gpe_event_info->runtime_count--; | |
431 | - goto unlock_and_exit; | |
432 | - } | |
433 | - } | |
408 | + if (gpe_event_info->runtime_count == ACPI_UINT8_MAX) { | |
409 | + status = AE_LIMIT; /* Too many references */ | |
410 | + goto unlock_and_exit; | |
434 | 411 | } |
435 | 412 | |
436 | - if (gpe_type & ACPI_GPE_TYPE_WAKE) { | |
437 | - /* The GPE must have the ability to wake the system */ | |
438 | - | |
439 | - if (!(gpe_event_info->flags & ACPI_GPE_CAN_WAKE)) { | |
440 | - status = AE_TYPE; | |
441 | - goto unlock_and_exit; | |
413 | + gpe_event_info->runtime_count++; | |
414 | + if (gpe_event_info->runtime_count == 1) { | |
415 | + status = acpi_ev_update_gpe_enable_mask(gpe_event_info); | |
416 | + if (ACPI_SUCCESS(status)) { | |
417 | + status = acpi_clear_and_enable_gpe(gpe_event_info); | |
442 | 418 | } |
443 | - | |
444 | - if (gpe_event_info->wakeup_count == ACPI_UINT8_MAX) { | |
445 | - status = AE_LIMIT; /* Too many references */ | |
446 | - goto unlock_and_exit; | |
419 | + if (ACPI_FAILURE(status)) { | |
420 | + gpe_event_info->runtime_count--; | |
447 | 421 | } |
448 | - | |
449 | - /* | |
450 | - * Update the enable mask on the first wakeup reference. Wake GPEs | |
451 | - * are only hardware-enabled just before sleeping. | |
452 | - */ | |
453 | - gpe_event_info->wakeup_count++; | |
454 | - if (gpe_event_info->wakeup_count == 1) { | |
455 | - status = acpi_ev_update_gpe_enable_masks(gpe_event_info); | |
456 | - } | |
457 | 422 | } |
458 | 423 | |
459 | 424 | unlock_and_exit: |
... | ... | @@ -468,8 +433,6 @@ |
468 | 433 | * |
469 | 434 | * PARAMETERS: gpe_device - Parent GPE Device. NULL for GPE0/GPE1 |
470 | 435 | * gpe_number - GPE level within the GPE block |
471 | - * gpe_type - ACPI_GPE_TYPE_RUNTIME or ACPI_GPE_TYPE_WAKE | |
472 | - * or both | |
473 | 436 | * |
474 | 437 | * RETURN: Status |
475 | 438 | * |
... | ... | @@ -478,7 +441,7 @@ |
478 | 441 | * the GPE mask bit disabled (for wake GPEs) |
479 | 442 | * |
480 | 443 | ******************************************************************************/ |
481 | -acpi_status acpi_disable_gpe(acpi_handle gpe_device, u32 gpe_number, u8 gpe_type) | |
444 | +acpi_status acpi_disable_gpe(acpi_handle gpe_device, u32 gpe_number) | |
482 | 445 | { |
483 | 446 | acpi_status status = AE_OK; |
484 | 447 | struct acpi_gpe_event_info *gpe_event_info; |
... | ... | @@ -486,12 +449,6 @@ |
486 | 449 | |
487 | 450 | ACPI_FUNCTION_TRACE(acpi_disable_gpe); |
488 | 451 | |
489 | - /* Parameter validation */ | |
490 | - | |
491 | - if (!gpe_type || (gpe_type & ~ACPI_GPE_TYPE_WAKE_RUN)) { | |
492 | - return_ACPI_STATUS(AE_BAD_PARAMETER); | |
493 | - } | |
494 | - | |
495 | 452 | flags = acpi_os_acquire_lock(acpi_gbl_gpe_lock); |
496 | 453 | |
497 | 454 | /* Ensure that we have a valid GPE number */ |
498 | 455 | |
499 | 456 | |
... | ... | @@ -504,41 +461,21 @@ |
504 | 461 | |
505 | 462 | /* Hardware-disable a runtime GPE on removal of the last reference */ |
506 | 463 | |
507 | - if (gpe_type & ACPI_GPE_TYPE_RUNTIME) { | |
508 | - if (!gpe_event_info->runtime_count) { | |
509 | - status = AE_LIMIT; /* There are no references to remove */ | |
510 | - goto unlock_and_exit; | |
511 | - } | |
512 | - | |
513 | - gpe_event_info->runtime_count--; | |
514 | - if (!gpe_event_info->runtime_count) { | |
515 | - status = acpi_ev_update_gpe_enable_masks(gpe_event_info); | |
516 | - if (ACPI_SUCCESS(status)) { | |
517 | - status = acpi_hw_low_set_gpe(gpe_event_info, | |
518 | - ACPI_GPE_DISABLE); | |
519 | - } | |
520 | - | |
521 | - if (ACPI_FAILURE(status)) { | |
522 | - gpe_event_info->runtime_count++; | |
523 | - goto unlock_and_exit; | |
524 | - } | |
525 | - } | |
464 | + if (!gpe_event_info->runtime_count) { | |
465 | + status = AE_LIMIT; /* There are no references to remove */ | |
466 | + goto unlock_and_exit; | |
526 | 467 | } |
527 | 468 | |
528 | - /* | |
529 | - * Update masks for wake GPE on removal of the last reference. | |
530 | - * No need to hardware-disable wake GPEs here, they are not currently | |
531 | - * enabled. | |
532 | - */ | |
533 | - if (gpe_type & ACPI_GPE_TYPE_WAKE) { | |
534 | - if (!gpe_event_info->wakeup_count) { | |
535 | - status = AE_LIMIT; /* There are no references to remove */ | |
536 | - goto unlock_and_exit; | |
469 | + gpe_event_info->runtime_count--; | |
470 | + if (!gpe_event_info->runtime_count) { | |
471 | + status = acpi_ev_update_gpe_enable_mask(gpe_event_info); | |
472 | + if (ACPI_SUCCESS(status)) { | |
473 | + status = | |
474 | + acpi_hw_low_set_gpe(gpe_event_info, | |
475 | + ACPI_GPE_DISABLE); | |
537 | 476 | } |
538 | - | |
539 | - gpe_event_info->wakeup_count--; | |
540 | - if (!gpe_event_info->wakeup_count) { | |
541 | - status = acpi_ev_update_gpe_enable_masks(gpe_event_info); | |
477 | + if (ACPI_FAILURE(status)) { | |
478 | + gpe_event_info->runtime_count++; | |
542 | 479 | } |
543 | 480 | } |
544 | 481 |
drivers/acpi/button.c
... | ... | @@ -424,8 +424,7 @@ |
424 | 424 | if (device->wakeup.flags.valid) { |
425 | 425 | /* Button's GPE is run-wake GPE */ |
426 | 426 | acpi_enable_gpe(device->wakeup.gpe_device, |
427 | - device->wakeup.gpe_number, | |
428 | - ACPI_GPE_TYPE_RUNTIME); | |
427 | + device->wakeup.gpe_number); | |
429 | 428 | device->wakeup.run_wake_count++; |
430 | 429 | device->wakeup.state.enabled = 1; |
431 | 430 | } |
... | ... | @@ -448,8 +447,7 @@ |
448 | 447 | |
449 | 448 | if (device->wakeup.flags.valid) { |
450 | 449 | acpi_disable_gpe(device->wakeup.gpe_device, |
451 | - device->wakeup.gpe_number, | |
452 | - ACPI_GPE_TYPE_RUNTIME); | |
450 | + device->wakeup.gpe_number); | |
453 | 451 | device->wakeup.run_wake_count--; |
454 | 452 | device->wakeup.state.enabled = 0; |
455 | 453 | } |
drivers/acpi/ec.c
... | ... | @@ -822,7 +822,7 @@ |
822 | 822 | if (ACPI_FAILURE(status)) |
823 | 823 | return -ENODEV; |
824 | 824 | |
825 | - acpi_enable_gpe(NULL, ec->gpe, ACPI_GPE_TYPE_RUNTIME); | |
825 | + acpi_enable_gpe(NULL, ec->gpe); | |
826 | 826 | status = acpi_install_address_space_handler(ec->handle, |
827 | 827 | ACPI_ADR_SPACE_EC, |
828 | 828 | &acpi_ec_space_handler, |
... | ... | @@ -839,7 +839,7 @@ |
839 | 839 | } else { |
840 | 840 | acpi_remove_gpe_handler(NULL, ec->gpe, |
841 | 841 | &acpi_ec_gpe_handler); |
842 | - acpi_disable_gpe(NULL, ec->gpe, ACPI_GPE_TYPE_RUNTIME); | |
842 | + acpi_disable_gpe(NULL, ec->gpe); | |
843 | 843 | return -ENODEV; |
844 | 844 | } |
845 | 845 | } |
... | ... | @@ -850,7 +850,7 @@ |
850 | 850 | |
851 | 851 | static void ec_remove_handlers(struct acpi_ec *ec) |
852 | 852 | { |
853 | - acpi_disable_gpe(NULL, ec->gpe, ACPI_GPE_TYPE_RUNTIME); | |
853 | + acpi_disable_gpe(NULL, ec->gpe); | |
854 | 854 | if (ACPI_FAILURE(acpi_remove_address_space_handler(ec->handle, |
855 | 855 | ACPI_ADR_SPACE_EC, &acpi_ec_space_handler))) |
856 | 856 | pr_err(PREFIX "failed to remove space handler\n"); |
drivers/acpi/system.c
... | ... | @@ -388,12 +388,10 @@ |
388 | 388 | if (index < num_gpes) { |
389 | 389 | if (!strcmp(buf, "disable\n") && |
390 | 390 | (status & ACPI_EVENT_FLAG_ENABLED)) |
391 | - result = acpi_disable_gpe(handle, index, | |
392 | - ACPI_GPE_TYPE_RUNTIME); | |
391 | + result = acpi_disable_gpe(handle, index); | |
393 | 392 | else if (!strcmp(buf, "enable\n") && |
394 | 393 | !(status & ACPI_EVENT_FLAG_ENABLED)) |
395 | - result = acpi_enable_gpe(handle, index, | |
396 | - ACPI_GPE_TYPE_RUNTIME); | |
394 | + result = acpi_enable_gpe(handle, index); | |
397 | 395 | else if (!strcmp(buf, "clear\n") && |
398 | 396 | (status & ACPI_EVENT_FLAG_SET)) |
399 | 397 | result = acpi_clear_gpe(handle, index); |
drivers/pci/pci-acpi.c
... | ... | @@ -295,14 +295,12 @@ |
295 | 295 | if (!dev->wakeup.run_wake_count++) { |
296 | 296 | acpi_enable_wakeup_device_power(dev, ACPI_STATE_S0); |
297 | 297 | acpi_enable_gpe(dev->wakeup.gpe_device, |
298 | - dev->wakeup.gpe_number, | |
299 | - ACPI_GPE_TYPE_RUNTIME); | |
298 | + dev->wakeup.gpe_number); | |
300 | 299 | } |
301 | 300 | } else if (dev->wakeup.run_wake_count > 0) { |
302 | 301 | if (!--dev->wakeup.run_wake_count) { |
303 | 302 | acpi_disable_gpe(dev->wakeup.gpe_device, |
304 | - dev->wakeup.gpe_number, | |
305 | - ACPI_GPE_TYPE_RUNTIME); | |
303 | + dev->wakeup.gpe_number); | |
306 | 304 | acpi_disable_wakeup_device_power(dev); |
307 | 305 | } |
308 | 306 | } else { |
include/acpi/acpixf.h
... | ... | @@ -284,11 +284,9 @@ |
284 | 284 | */ |
285 | 285 | acpi_status acpi_set_gpe(acpi_handle gpe_device, u32 gpe_number, u8 action); |
286 | 286 | |
287 | -acpi_status | |
288 | -acpi_enable_gpe(acpi_handle gpe_device, u32 gpe_number, u8 gpe_type); | |
287 | +acpi_status acpi_enable_gpe(acpi_handle gpe_device, u32 gpe_number); | |
289 | 288 | |
290 | -acpi_status | |
291 | -acpi_disable_gpe(acpi_handle gpe_device, u32 gpe_number, u8 gpe_type); | |
289 | +acpi_status acpi_disable_gpe(acpi_handle gpe_device, u32 gpe_number); | |
292 | 290 | |
293 | 291 | acpi_status acpi_clear_gpe(acpi_handle gpe_device, u32 gpe_number); |
294 | 292 |
include/acpi/actypes.h
... | ... | @@ -669,12 +669,6 @@ |
669 | 669 | #define ACPI_GPE_DISABLE 1 |
670 | 670 | #define ACPI_GPE_COND_ENABLE 2 |
671 | 671 | |
672 | -/* gpe_types for acpi_enable_gpe and acpi_disable_gpe */ | |
673 | - | |
674 | -#define ACPI_GPE_TYPE_WAKE (u8) 0x01 | |
675 | -#define ACPI_GPE_TYPE_RUNTIME (u8) 0x02 | |
676 | -#define ACPI_GPE_TYPE_WAKE_RUN (u8) 0x03 | |
677 | - | |
678 | 672 | /* |
679 | 673 | * GPE info flags - Per GPE |
680 | 674 | * +-------+---+-+-+ |