From: Zhichang Yuan <[email protected]>

This patch has been added to the 3.18 stable tree. If you have any
objections, please let us know.

===============

[ Upstream commit 5dbb4c6167229c8d4f528e8ec26699a7305000a3 ]

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 <[email protected]>
Signed-off-by: Bjorn Helgaas <[email protected]>
Acked-by: Liviu Dudau <[email protected]>
CC: [email protected]      # v3.18+

Signed-off-by: Sasha Levin <[email protected]>
---
 drivers/of/address.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/of/address.c b/drivers/of/address.c
index 216b00d..d880aff 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)
        spin_lock(&io_range_lock);
        list_for_each_entry(res, &io_range_list, list) {
                if (address >= res->start && address < res->start + res->size) {
-                       addr = res->start - address + offset;
+                       addr = address - res->start + offset;
                        break;
                }
                offset += res->size;
-- 
2.1.0

--
To unsubscribe from this list: send the line "unsubscribe stable" in
the body of a message to [email protected]
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Reply via email to