diff options
author | Zhichang Yuan <yuanzhichang@hisilicon.com> | 2015-04-24 05:05:09 -0400 |
---|---|---|
committer | Greg Kroah-Hartman <gregkh@linuxfoundation.org> | 2015-07-21 13:10:05 -0400 |
commit | d389ad7c0e6c02efaa3fe7992efb2452022e4b63 (patch) | |
tree | 941d151b54b22fd7b61630ff65677a25eda6de2d | |
parent | 5224e2a708f617fb69ea7cb56613838af40af188 (diff) |
of/pci: Fix pci_address_to_pio() conversion of CPU address to I/O port
commit 5dbb4c6167229c8d4f528e8ec26699a7305000a3 upstream.
41f8bba7f555 ("of/pci: Add pci_register_io_range() and
pci_pio_to_address()") added support for systems with several I/O ranges
described by OF bindings. It modified pci_address_to_pio() look up the
io_range for a given CPU physical address, but the conversion was wrong.
Fix the conversion of address to I/O port.
[bhelgaas: changelog]
Fixes: 41f8bba7f555 ("of/pci: Add pci_register_io_range() and pci_pio_to_address()")
Signed-off-by: Zhichang Yuan <yuanzhichang@hisilicon.com>
Signed-off-by: Bjorn Helgaas <bhelgaas@google.com>
Acked-by: Liviu Dudau <Liviu.Dudau@arm.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
-rw-r--r-- | drivers/of/address.c | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/drivers/of/address.c b/drivers/of/address.c index 78a7dcbec7d8..6906a3f61bd8 100644 --- a/drivers/of/address.c +++ b/drivers/of/address.c | |||
@@ -765,7 +765,7 @@ unsigned long __weak pci_address_to_pio(phys_addr_t address) | |||
765 | spin_lock(&io_range_lock); | 765 | spin_lock(&io_range_lock); |
766 | list_for_each_entry(res, &io_range_list, list) { | 766 | list_for_each_entry(res, &io_range_list, list) { |
767 | if (address >= res->start && address < res->start + res->size) { | 767 | if (address >= res->start && address < res->start + res->size) { |
768 | addr = res->start - address + offset; | 768 | addr = address - res->start + offset; |
769 | break; | 769 | break; |
770 | } | 770 | } |
771 | offset += res->size; | 771 | offset += res->size; |