Commit de4f10466e9347a2f1bfe39e501539557bed2c4b
Committed by
Matthew Garrett
1 parent
7a0691c16f
Exists in
master
and in
7 other branches
acpi ec: Fix possible double io port registration
which will result in a harmless but ugly WARN message on some machines. Signed-off-by: Thomas Renninger <trenn@suse.de> CC: mjg59@srcf.ucam.org CC: platform-driver-x86@vger.kernel.org CC: linux-acpi@vger.kernel.org CC: astarikovskiy@suse.de CC: akpm@linux-foundation.org Signed-off-by: Matthew Garrett <mjg@redhat.com>
Showing 1 changed file with 10 additions and 10 deletions Side-by-side Diff
drivers/acpi/ec.c
... | ... | @@ -818,6 +818,12 @@ |
818 | 818 | if (!first_ec) |
819 | 819 | first_ec = ec; |
820 | 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 | 827 | pr_info(PREFIX "GPE = 0x%lx, I/O: command/status = 0x%lx, data = 0x%lx\n", |
822 | 828 | ec->gpe, ec->command_addr, ec->data_addr); |
823 | 829 | |
... | ... | @@ -844,6 +850,8 @@ |
844 | 850 | kfree(handler); |
845 | 851 | } |
846 | 852 | mutex_unlock(&ec->lock); |
853 | + release_region(ec->data_addr, 1); | |
854 | + release_region(ec->command_addr, 1); | |
847 | 855 | device->driver_data = NULL; |
848 | 856 | if (ec == first_ec) |
849 | 857 | first_ec = NULL; |
850 | 858 | |
851 | 859 | |
... | ... | @@ -864,18 +872,10 @@ |
864 | 872 | * the second address region returned is the status/command |
865 | 873 | * port. |
866 | 874 | */ |
867 | - if (ec->data_addr == 0) { | |
875 | + if (ec->data_addr == 0) | |
868 | 876 | ec->data_addr = resource->data.io.minimum; |
869 | - WARN(!request_region(ec->data_addr, 1, "EC data"), | |
870 | - "Could not request EC data io port %lu", | |
871 | - ec->data_addr); | |
872 | - } | |
873 | - else if (ec->command_addr == 0) { | |
877 | + else if (ec->command_addr == 0) | |
874 | 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 | 879 | else |
880 | 880 | return AE_CTRL_TERMINATE; |
881 | 881 |