linux-pci.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH v2] of/pci: fix a bug in function pci_pio_to_address
@ 2015-04-24  9:05 Zhichang Yuan
  2015-04-24 10:13 ` Liviu Dudau
  2015-05-16 16:06 ` Bjorn Helgaas
  0 siblings, 2 replies; 4+ messages in thread
From: Zhichang Yuan @ 2015-04-24  9:05 UTC (permalink / raw)
  To: bhelgaas, grant.likely
  Cc: linux-pci, stable, gabriele.paoloni, Liviu.Dudau, Zhichang Yuan

In the patch whose commit id is 41f8bba7f5552d0, function pci_pio_to_address
was modified to retieve the corresponding I/O port by CPU physical address.
But the convertion processing is not correct. It will return a wrong I/O port.
This patch will fix it.

Fixes: 41f8bba7f555 ("of/pci: Add pci_register_io_range() and pci_pio_to_address()")
CC: stable@vger.kernel.org
Signed-off-by: Zhichang Yuan <yuanzhichang@hisilicon.com>
---
changes since V1:
Improved commit message.

 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 78a7dcb..6906a3f 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;
-- 
1.9.1


^ permalink raw reply related	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2015-06-29  8:27 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2015-04-24  9:05 [PATCH v2] of/pci: fix a bug in function pci_pio_to_address Zhichang Yuan
2015-04-24 10:13 ` Liviu Dudau
2015-05-16 16:06 ` Bjorn Helgaas
2015-06-29  8:20   ` yuanzhichang

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).