diff options
author | Alexey Starikovskiy <alexey.y.starikovskiy@intel.com> | 2007-03-07 14:28:00 -0500 |
---|---|---|
committer | Len Brown <len.brown@intel.com> | 2007-03-09 23:27:28 -0500 |
commit | e8284321048aac7be307b3ec5e0631f5c514935a (patch) | |
tree | 816af79bf0b5c897d3faa568f670632247c5717f /drivers | |
parent | 3d02b90be2c7bc7ffbc5e502a135c13838d23ef4 (diff) |
ACPI: EC: Put install handlers into separate function.
Signed-off-by: Alexey Starikovskiy <alexey.y.starikovskiy@intel.com>
Signed-off-by: Len Brown <len.brown@intel.com>
Diffstat (limited to 'drivers')
-rw-r--r-- | drivers/acpi/ec.c | 87 |
1 files changed, 27 insertions, 60 deletions
diff --git a/drivers/acpi/ec.c b/drivers/acpi/ec.c index 19896311214f..399cedf2cfa6 100644 --- a/drivers/acpi/ec.c +++ b/drivers/acpi/ec.c | |||
@@ -715,6 +715,28 @@ acpi_ec_io_ports(struct acpi_resource *resource, void *context) | |||
715 | return AE_OK; | 715 | return AE_OK; |
716 | } | 716 | } |
717 | 717 | ||
718 | static int ec_install_handlers(struct acpi_ec *ec) | ||
719 | { | ||
720 | acpi_status status = acpi_install_gpe_handler(NULL, ec->gpe, | ||
721 | ACPI_GPE_EDGE_TRIGGERED, | ||
722 | &acpi_ec_gpe_handler, ec); | ||
723 | if (ACPI_FAILURE(status)) | ||
724 | return -ENODEV; | ||
725 | acpi_set_gpe_type(NULL, ec->gpe, ACPI_GPE_TYPE_RUNTIME); | ||
726 | acpi_enable_gpe(NULL, ec->gpe, ACPI_NOT_ISR); | ||
727 | |||
728 | status = acpi_install_address_space_handler(ec->handle, | ||
729 | ACPI_ADR_SPACE_EC, | ||
730 | &acpi_ec_space_handler, | ||
731 | &acpi_ec_space_setup, ec); | ||
732 | if (ACPI_FAILURE(status)) { | ||
733 | acpi_remove_gpe_handler(NULL, ec->gpe, &acpi_ec_gpe_handler); | ||
734 | return -ENODEV; | ||
735 | } | ||
736 | |||
737 | return 0; | ||
738 | } | ||
739 | |||
718 | static int acpi_ec_start(struct acpi_device *device) | 740 | static int acpi_ec_start(struct acpi_device *device) |
719 | { | 741 | { |
720 | acpi_status status = AE_OK; | 742 | acpi_status status = AE_OK; |
@@ -742,28 +764,7 @@ static int acpi_ec_start(struct acpi_device *device) | |||
742 | ACPI_DEBUG_PRINT((ACPI_DB_INFO, "gpe=0x%02lx, ports=0x%2lx,0x%2lx", | 764 | ACPI_DEBUG_PRINT((ACPI_DB_INFO, "gpe=0x%02lx, ports=0x%2lx,0x%2lx", |
743 | ec->gpe, ec->command_addr, ec->data_addr)); | 765 | ec->gpe, ec->command_addr, ec->data_addr)); |
744 | 766 | ||
745 | /* | 767 | return ec_install_handlers(ec); |
746 | * Install GPE handler | ||
747 | */ | ||
748 | status = acpi_install_gpe_handler(NULL, ec->gpe, | ||
749 | ACPI_GPE_EDGE_TRIGGERED, | ||
750 | &acpi_ec_gpe_handler, ec); | ||
751 | if (ACPI_FAILURE(status)) { | ||
752 | return -ENODEV; | ||
753 | } | ||
754 | acpi_set_gpe_type(NULL, ec->gpe, ACPI_GPE_TYPE_RUNTIME); | ||
755 | acpi_enable_gpe(NULL, ec->gpe, ACPI_NOT_ISR); | ||
756 | |||
757 | status = acpi_install_address_space_handler(ec->handle, | ||
758 | ACPI_ADR_SPACE_EC, | ||
759 | &acpi_ec_space_handler, | ||
760 | &acpi_ec_space_setup, ec); | ||
761 | if (ACPI_FAILURE(status)) { | ||
762 | acpi_remove_gpe_handler(NULL, ec->gpe, &acpi_ec_gpe_handler); | ||
763 | return -ENODEV; | ||
764 | } | ||
765 | |||
766 | return AE_OK; | ||
767 | } | 768 | } |
768 | 769 | ||
769 | static int acpi_ec_stop(struct acpi_device *device, int type) | 770 | static int acpi_ec_stop(struct acpi_device *device, int type) |
@@ -818,56 +819,22 @@ static int __init acpi_ec_get_real_ecdt(void) | |||
818 | ec_ecdt->gpe = ecdt_ptr->gpe; | 819 | ec_ecdt->gpe = ecdt_ptr->gpe; |
819 | ec_ecdt->uid = ecdt_ptr->uid; | 820 | ec_ecdt->uid = ecdt_ptr->uid; |
820 | 821 | ||
821 | status = acpi_get_handle(NULL, ecdt_ptr->id, &ec_ecdt->handle); | 822 | ec_ecdt->handle = ACPI_ROOT_OBJECT; |
822 | if (ACPI_FAILURE(status)) { | ||
823 | goto error; | ||
824 | } | ||
825 | |||
826 | return 0; | 823 | return 0; |
827 | error: | ||
828 | ACPI_EXCEPTION((AE_INFO, status, "Could not use ECDT")); | ||
829 | kfree(ec_ecdt); | ||
830 | ec_ecdt = NULL; | ||
831 | |||
832 | return -ENODEV; | ||
833 | } | 824 | } |
834 | 825 | ||
835 | int __init acpi_ec_ecdt_probe(void) | 826 | int __init acpi_ec_ecdt_probe(void) |
836 | { | 827 | { |
837 | acpi_status status; | ||
838 | int ret; | 828 | int ret; |
839 | 829 | ||
840 | ret = acpi_ec_get_real_ecdt(); | 830 | ret = acpi_ec_get_real_ecdt(); |
841 | if (ret) | 831 | if (ret) |
842 | return 0; | 832 | return 0; |
843 | 833 | ||
844 | /* | 834 | ret = ec_install_handlers(ec_ecdt); |
845 | * Install GPE handler | 835 | if (!ret) |
846 | */ | 836 | return 0; |
847 | status = acpi_install_gpe_handler(NULL, ec_ecdt->gpe, | ||
848 | ACPI_GPE_EDGE_TRIGGERED, | ||
849 | &acpi_ec_gpe_handler, ec_ecdt); | ||
850 | if (ACPI_FAILURE(status)) { | ||
851 | goto error; | ||
852 | } | ||
853 | acpi_set_gpe_type(NULL, ec_ecdt->gpe, ACPI_GPE_TYPE_RUNTIME); | ||
854 | acpi_enable_gpe(NULL, ec_ecdt->gpe, ACPI_NOT_ISR); | ||
855 | |||
856 | status = acpi_install_address_space_handler(ACPI_ROOT_OBJECT, | ||
857 | ACPI_ADR_SPACE_EC, | ||
858 | &acpi_ec_space_handler, | ||
859 | &acpi_ec_space_setup, | ||
860 | ec_ecdt); | ||
861 | if (ACPI_FAILURE(status)) { | ||
862 | acpi_remove_gpe_handler(NULL, ec_ecdt->gpe, | ||
863 | &acpi_ec_gpe_handler); | ||
864 | goto error; | ||
865 | } | ||
866 | |||
867 | return 0; | ||
868 | 837 | ||
869 | error: | ||
870 | ACPI_EXCEPTION((AE_INFO, status, "Could not use ECDT")); | ||
871 | kfree(ec_ecdt); | 838 | kfree(ec_ecdt); |
872 | ec_ecdt = NULL; | 839 | ec_ecdt = NULL; |
873 | 840 | ||