diff options
Diffstat (limited to 'drivers/acpi/ec.c')
-rw-r--r-- | drivers/acpi/ec.c | 43 |
1 files changed, 20 insertions, 23 deletions
diff --git a/drivers/acpi/ec.c b/drivers/acpi/ec.c index c9dcf9a2a469..125046884b8b 100644 --- a/drivers/acpi/ec.c +++ b/drivers/acpi/ec.c | |||
@@ -102,7 +102,7 @@ static struct acpi_ec { | |||
102 | atomic_t query_pending; | 102 | atomic_t query_pending; |
103 | atomic_t event_count; | 103 | atomic_t event_count; |
104 | wait_queue_head_t wait; | 104 | wait_queue_head_t wait; |
105 | } *ec_ecdt; | 105 | } *boot_ec; |
106 | 106 | ||
107 | /* External interfaces use first EC only, so remember */ | 107 | /* External interfaces use first EC only, so remember */ |
108 | static struct acpi_device *first_ec; | 108 | static struct acpi_device *first_ec; |
@@ -646,21 +646,18 @@ static int acpi_ec_add(struct acpi_device *device) | |||
646 | } | 646 | } |
647 | 647 | ||
648 | /* Check if we found the boot EC */ | 648 | /* Check if we found the boot EC */ |
649 | if (ec_ecdt) { | 649 | if (boot_ec) { |
650 | if (ec_ecdt->gpe == ec->gpe) { | 650 | if (boot_ec->gpe == ec->gpe) { |
651 | /* We might have incorrect info for GL at boot time */ | 651 | /* We might have incorrect info for GL at boot time */ |
652 | mutex_lock(&ec_ecdt->lock); | 652 | mutex_lock(&boot_ec->lock); |
653 | ec_ecdt->global_lock = ec->global_lock; | 653 | boot_ec->global_lock = ec->global_lock; |
654 | mutex_unlock(&ec_ecdt->lock); | 654 | mutex_unlock(&boot_ec->lock); |
655 | kfree(ec); | 655 | kfree(ec); |
656 | ec = ec_ecdt; | 656 | ec = boot_ec; |
657 | } | 657 | } |
658 | } | 658 | } |
659 | |||
660 | ec->handle = device->handle; | 659 | ec->handle = device->handle; |
661 | |||
662 | acpi_driver_data(device) = ec; | 660 | acpi_driver_data(device) = ec; |
663 | |||
664 | if (!first_ec) | 661 | if (!first_ec) |
665 | first_ec = device; | 662 | first_ec = device; |
666 | 663 | ||
@@ -689,7 +686,7 @@ static int acpi_ec_remove(struct acpi_device *device, int type) | |||
689 | first_ec = NULL; | 686 | first_ec = NULL; |
690 | 687 | ||
691 | /* Don't touch boot EC */ | 688 | /* Don't touch boot EC */ |
692 | if (ec_ecdt != ec) | 689 | if (boot_ec != ec) |
693 | kfree(ec); | 690 | kfree(ec); |
694 | 691 | ||
695 | return 0; | 692 | return 0; |
@@ -759,7 +756,7 @@ static int acpi_ec_start(struct acpi_device *device) | |||
759 | ec->gpe, ec->command_addr, ec->data_addr)); | 756 | ec->gpe, ec->command_addr, ec->data_addr)); |
760 | 757 | ||
761 | /* Boot EC is already working */ | 758 | /* Boot EC is already working */ |
762 | if (ec == ec_ecdt) | 759 | if (ec == boot_ec) |
763 | return 0; | 760 | return 0; |
764 | 761 | ||
765 | return ec_install_handlers(ec); | 762 | return ec_install_handlers(ec); |
@@ -778,7 +775,7 @@ static int acpi_ec_stop(struct acpi_device *device, int type) | |||
778 | return -EINVAL; | 775 | return -EINVAL; |
779 | 776 | ||
780 | /* Don't touch boot EC */ | 777 | /* Don't touch boot EC */ |
781 | if (ec == ec_ecdt) | 778 | if (ec == boot_ec) |
782 | return 0; | 779 | return 0; |
783 | 780 | ||
784 | status = acpi_remove_address_space_handler(ec->handle, | 781 | status = acpi_remove_address_space_handler(ec->handle, |
@@ -828,8 +825,8 @@ int __init acpi_ec_ecdt_probe(void) | |||
828 | acpi_status status; | 825 | acpi_status status; |
829 | struct acpi_table_ecdt *ecdt_ptr; | 826 | struct acpi_table_ecdt *ecdt_ptr; |
830 | 827 | ||
831 | ec_ecdt = make_acpi_ec(); | 828 | boot_ec = make_acpi_ec(); |
832 | if (!ec_ecdt) | 829 | if (!boot_ec) |
833 | return -ENOMEM; | 830 | return -ENOMEM; |
834 | /* | 831 | /* |
835 | * Generate a boot ec context | 832 | * Generate a boot ec context |
@@ -842,18 +839,18 @@ int __init acpi_ec_ecdt_probe(void) | |||
842 | 839 | ||
843 | ACPI_DEBUG_PRINT((ACPI_DB_INFO, "Found ECDT")); | 840 | ACPI_DEBUG_PRINT((ACPI_DB_INFO, "Found ECDT")); |
844 | 841 | ||
845 | ec_ecdt->command_addr = ecdt_ptr->control.address; | 842 | boot_ec->command_addr = ecdt_ptr->control.address; |
846 | ec_ecdt->data_addr = ecdt_ptr->data.address; | 843 | boot_ec->data_addr = ecdt_ptr->data.address; |
847 | ec_ecdt->gpe = ecdt_ptr->gpe; | 844 | boot_ec->gpe = ecdt_ptr->gpe; |
848 | ec_ecdt->uid = ecdt_ptr->uid; | 845 | boot_ec->uid = ecdt_ptr->uid; |
849 | ec_ecdt->handle = ACPI_ROOT_OBJECT; | 846 | boot_ec->handle = ACPI_ROOT_OBJECT; |
850 | 847 | ||
851 | ret = ec_install_handlers(ec_ecdt); | 848 | ret = ec_install_handlers(boot_ec); |
852 | if (!ret) | 849 | if (!ret) |
853 | return 0; | 850 | return 0; |
854 | error: | 851 | error: |
855 | kfree(ec_ecdt); | 852 | kfree(boot_ec); |
856 | ec_ecdt = NULL; | 853 | boot_ec = NULL; |
857 | 854 | ||
858 | return -ENODEV; | 855 | return -ENODEV; |
859 | } | 856 | } |