From: Kevin Hao <haokexin@gmail.com>
To: Bjorn Helgaas <bhelgaas@google.com>
Cc: <linux-pci@vger.kernel.org>
Subject: [PATCH 1/2] PCI: make pcibios_bus_to_resource return either success or failure
Date: Tue, 14 May 2013 21:07:55 +0800 [thread overview]
Message-ID: <1368536876-27307-2-git-send-email-haokexin@gmail.com> (raw)
In-Reply-To: <1368536876-27307-1-git-send-email-haokexin@gmail.com>
In some cases we need to make sure whether the address translation is
success or failure. So add a bool return value for this function.
Signed-off-by: Kevin Hao <haokexin@gmail.com>
---
drivers/pci/host-bridge.c | 5 ++++-
include/linux/pci.h | 2 +-
2 files changed, 5 insertions(+), 2 deletions(-)
diff --git a/drivers/pci/host-bridge.c b/drivers/pci/host-bridge.c
index a68dc61..a31885f 100644
--- a/drivers/pci/host-bridge.c
+++ b/drivers/pci/host-bridge.c
@@ -68,12 +68,13 @@ static bool region_contains(struct pci_bus_region *region1,
return region1->start <= region2->start && region1->end >= region2->end;
}
-void pcibios_bus_to_resource(struct pci_dev *dev, struct resource *res,
+bool pcibios_bus_to_resource(struct pci_dev *dev, struct resource *res,
struct pci_bus_region *region)
{
struct pci_host_bridge *bridge = find_pci_host_bridge(dev);
struct pci_host_bridge_window *window;
resource_size_t offset = 0;
+ bool ret = false;
list_for_each_entry(window, &bridge->windows, list) {
struct pci_bus_region bus_region;
@@ -86,11 +87,13 @@ void pcibios_bus_to_resource(struct pci_dev *dev, struct resource *res,
if (region_contains(&bus_region, region)) {
offset = window->offset;
+ ret = true;
break;
}
}
res->start = region->start + offset;
res->end = region->end + offset;
+ return ret;
}
EXPORT_SYMBOL(pcibios_bus_to_resource);
diff --git a/include/linux/pci.h b/include/linux/pci.h
index 3a24e4f..ea5fb61 100644
--- a/include/linux/pci.h
+++ b/include/linux/pci.h
@@ -714,7 +714,7 @@ void pci_fixup_cardbus(struct pci_bus *);
void pcibios_resource_to_bus(struct pci_dev *dev, struct pci_bus_region *region,
struct resource *res);
-void pcibios_bus_to_resource(struct pci_dev *dev, struct resource *res,
+bool pcibios_bus_to_resource(struct pci_dev *dev, struct resource *res,
struct pci_bus_region *region);
void pcibios_scan_specific_bus(int busn);
struct pci_bus *pci_find_bus(int domain, int busnr);
--
1.8.1.4
next prev parent reply other threads:[~2013-05-14 13:08 UTC|newest]
Thread overview: 12+ messages / expand[flat|nested] mbox.gz Atom feed top
2013-05-14 13:07 [PATCH 0/2] fix the pci device malfunction if a wrong bus address is assigned by firmware Kevin Hao
2013-05-14 13:07 ` Kevin Hao [this message]
2013-05-14 13:07 ` [PATCH 2/2] PCI: unset the resource if we can't get the correct CPU address Kevin Hao
2013-05-16 16:18 ` Liu Jiang
2013-05-17 2:11 ` Kevin Hao
2013-05-17 14:51 ` Liu Jiang
2013-05-19 2:24 ` Kevin Hao
2013-05-20 15:27 ` Liu Jiang
2013-05-23 20:22 ` Bjorn Helgaas
2013-05-24 2:54 ` Kevin Hao
2013-05-24 17:13 ` Bjorn Helgaas
2013-05-25 11:17 ` Kevin Hao
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1368536876-27307-2-git-send-email-haokexin@gmail.com \
--to=haokexin@gmail.com \
--cc=bhelgaas@google.com \
--cc=linux-pci@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
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).