aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/acpi
diff options
context:
space:
mode:
authorBjorn Helgaas <bjorn.helgaas@hp.com>2009-06-22 16:41:30 -0400
committerLen Brown <len.brown@intel.com>2009-06-25 12:16:33 -0400
commit5efc5476184173996dfcce780c2bb5e727df674e (patch)
treed1c1fe6912e9c5eda7016a012f8e9f4f5639182e /drivers/acpi
parent80f20fef6a2381402e59b169eb51b989cc175ab7 (diff)
ACPI: EC: move acpi_ec_start() after acpi_ec_add()
This patch rearranges ec_install_handlers() and acpi_ec_start() so acpi_ec_start() ends up just after acpi_ec_add(). A subsequent patch will merge them. Code movement only; no functional change. Signed-off-by: Bjorn Helgaas <bjorn.helgaas@hp.com> CC: Alexey Starikovskiy <astarikovskiy@suse.de> Signed-off-by: Len Brown <len.brown@intel.com>
Diffstat (limited to 'drivers/acpi')
-rw-r--r--drivers/acpi/ec.c112
1 files changed, 56 insertions, 56 deletions
diff --git a/drivers/acpi/ec.c b/drivers/acpi/ec.c
index 391f331674c7..8b387a48e843 100644
--- a/drivers/acpi/ec.c
+++ b/drivers/acpi/ec.c
@@ -788,6 +788,42 @@ ec_parse_device(acpi_handle handle, u32 Level, void *context, void **retval)
788 return AE_CTRL_TERMINATE; 788 return AE_CTRL_TERMINATE;
789} 789}
790 790
791static int ec_install_handlers(struct acpi_ec *ec)
792{
793 acpi_status status;
794 if (test_bit(EC_FLAGS_HANDLERS_INSTALLED, &ec->flags))
795 return 0;
796 status = acpi_install_gpe_handler(NULL, ec->gpe,
797 ACPI_GPE_EDGE_TRIGGERED,
798 &acpi_ec_gpe_handler, ec);
799 if (ACPI_FAILURE(status))
800 return -ENODEV;
801 acpi_set_gpe_type(NULL, ec->gpe, ACPI_GPE_TYPE_RUNTIME);
802 acpi_enable_gpe(NULL, ec->gpe);
803 status = acpi_install_address_space_handler(ec->handle,
804 ACPI_ADR_SPACE_EC,
805 &acpi_ec_space_handler,
806 NULL, ec);
807 if (ACPI_FAILURE(status)) {
808 if (status == AE_NOT_FOUND) {
809 /*
810 * Maybe OS fails in evaluating the _REG object.
811 * The AE_NOT_FOUND error will be ignored and OS
812 * continue to initialize EC.
813 */
814 printk(KERN_ERR "Fail in evaluating the _REG object"
815 " of EC device. Broken bios is suspected.\n");
816 } else {
817 acpi_remove_gpe_handler(NULL, ec->gpe,
818 &acpi_ec_gpe_handler);
819 return -ENODEV;
820 }
821 }
822
823 set_bit(EC_FLAGS_HANDLERS_INSTALLED, &ec->flags);
824 return 0;
825}
826
791static void ec_remove_handlers(struct acpi_ec *ec) 827static void ec_remove_handlers(struct acpi_ec *ec)
792{ 828{
793 if (ACPI_FAILURE(acpi_remove_address_space_handler(ec->handle, 829 if (ACPI_FAILURE(acpi_remove_address_space_handler(ec->handle,
@@ -842,6 +878,26 @@ static int acpi_ec_add(struct acpi_device *device)
842 return 0; 878 return 0;
843} 879}
844 880
881static int acpi_ec_start(struct acpi_device *device)
882{
883 struct acpi_ec *ec;
884 int ret = 0;
885
886 if (!device)
887 return -EINVAL;
888
889 ec = acpi_driver_data(device);
890
891 if (!ec)
892 return -EINVAL;
893
894 ret = ec_install_handlers(ec);
895
896 /* EC is fully operational, allow queries */
897 clear_bit(EC_FLAGS_QUERY_PENDING, &ec->flags);
898 return ret;
899}
900
845static int acpi_ec_remove(struct acpi_device *device, int type) 901static int acpi_ec_remove(struct acpi_device *device, int type)
846{ 902{
847 struct acpi_ec *ec; 903 struct acpi_ec *ec;
@@ -888,62 +944,6 @@ ec_parse_io_ports(struct acpi_resource *resource, void *context)
888 return AE_OK; 944 return AE_OK;
889} 945}
890 946
891static int ec_install_handlers(struct acpi_ec *ec)
892{
893 acpi_status status;
894 if (test_bit(EC_FLAGS_HANDLERS_INSTALLED, &ec->flags))
895 return 0;
896 status = acpi_install_gpe_handler(NULL, ec->gpe,
897 ACPI_GPE_EDGE_TRIGGERED,
898 &acpi_ec_gpe_handler, ec);
899 if (ACPI_FAILURE(status))
900 return -ENODEV;
901 acpi_set_gpe_type(NULL, ec->gpe, ACPI_GPE_TYPE_RUNTIME);
902 acpi_enable_gpe(NULL, ec->gpe);
903 status = acpi_install_address_space_handler(ec->handle,
904 ACPI_ADR_SPACE_EC,
905 &acpi_ec_space_handler,
906 NULL, ec);
907 if (ACPI_FAILURE(status)) {
908 if (status == AE_NOT_FOUND) {
909 /*
910 * Maybe OS fails in evaluating the _REG object.
911 * The AE_NOT_FOUND error will be ignored and OS
912 * continue to initialize EC.
913 */
914 printk(KERN_ERR "Fail in evaluating the _REG object"
915 " of EC device. Broken bios is suspected.\n");
916 } else {
917 acpi_remove_gpe_handler(NULL, ec->gpe,
918 &acpi_ec_gpe_handler);
919 return -ENODEV;
920 }
921 }
922
923 set_bit(EC_FLAGS_HANDLERS_INSTALLED, &ec->flags);
924 return 0;
925}
926
927static int acpi_ec_start(struct acpi_device *device)
928{
929 struct acpi_ec *ec;
930 int ret = 0;
931
932 if (!device)
933 return -EINVAL;
934
935 ec = acpi_driver_data(device);
936
937 if (!ec)
938 return -EINVAL;
939
940 ret = ec_install_handlers(ec);
941
942 /* EC is fully operational, allow queries */
943 clear_bit(EC_FLAGS_QUERY_PENDING, &ec->flags);
944 return ret;
945}
946
947static int acpi_ec_stop(struct acpi_device *device, int type) 947static int acpi_ec_stop(struct acpi_device *device, int type)
948{ 948{
949 struct acpi_ec *ec; 949 struct acpi_ec *ec;