diff options
-rw-r--r-- | drivers/acpi/ec.c | 20 |
1 files changed, 10 insertions, 10 deletions
diff --git a/drivers/acpi/ec.c b/drivers/acpi/ec.c index 265a99c1eb14..1fa0aafebe2a 100644 --- a/drivers/acpi/ec.c +++ b/drivers/acpi/ec.c | |||
@@ -818,6 +818,12 @@ static int acpi_ec_add(struct acpi_device *device) | |||
818 | if (!first_ec) | 818 | if (!first_ec) |
819 | first_ec = ec; | 819 | first_ec = ec; |
820 | device->driver_data = ec; | 820 | device->driver_data = ec; |
821 | |||
822 | WARN(!request_region(ec->data_addr, 1, "EC data"), | ||
823 | "Could not request EC data io port 0x%lx", ec->data_addr); | ||
824 | WARN(!request_region(ec->command_addr, 1, "EC cmd"), | ||
825 | "Could not request EC cmd io port 0x%lx", ec->command_addr); | ||
826 | |||
821 | pr_info(PREFIX "GPE = 0x%lx, I/O: command/status = 0x%lx, data = 0x%lx\n", | 827 | pr_info(PREFIX "GPE = 0x%lx, I/O: command/status = 0x%lx, data = 0x%lx\n", |
822 | ec->gpe, ec->command_addr, ec->data_addr); | 828 | ec->gpe, ec->command_addr, ec->data_addr); |
823 | 829 | ||
@@ -844,6 +850,8 @@ static int acpi_ec_remove(struct acpi_device *device, int type) | |||
844 | kfree(handler); | 850 | kfree(handler); |
845 | } | 851 | } |
846 | mutex_unlock(&ec->lock); | 852 | mutex_unlock(&ec->lock); |
853 | release_region(ec->data_addr, 1); | ||
854 | release_region(ec->command_addr, 1); | ||
847 | device->driver_data = NULL; | 855 | device->driver_data = NULL; |
848 | if (ec == first_ec) | 856 | if (ec == first_ec) |
849 | first_ec = NULL; | 857 | first_ec = NULL; |
@@ -864,18 +872,10 @@ ec_parse_io_ports(struct acpi_resource *resource, void *context) | |||
864 | * the second address region returned is the status/command | 872 | * the second address region returned is the status/command |
865 | * port. | 873 | * port. |
866 | */ | 874 | */ |
867 | if (ec->data_addr == 0) { | 875 | if (ec->data_addr == 0) |
868 | ec->data_addr = resource->data.io.minimum; | 876 | ec->data_addr = resource->data.io.minimum; |
869 | WARN(!request_region(ec->data_addr, 1, "EC data"), | 877 | else if (ec->command_addr == 0) |
870 | "Could not request EC data io port %lu", | ||
871 | ec->data_addr); | ||
872 | } | ||
873 | else if (ec->command_addr == 0) { | ||
874 | ec->command_addr = resource->data.io.minimum; | 878 | ec->command_addr = resource->data.io.minimum; |
875 | WARN(!request_region(ec->command_addr, 1, "EC command"), | ||
876 | "Could not request EC command io port %lu", | ||
877 | ec->command_addr); | ||
878 | } | ||
879 | else | 879 | else |
880 | return AE_CTRL_TERMINATE; | 880 | return AE_CTRL_TERMINATE; |
881 | 881 | ||