diff options
author | Bjorn Helgaas <bhelgaas@google.com> | 2015-03-12 12:30:11 -0500 |
---|---|---|
committer | Alex Shi <alex.shi@linaro.org> | 2015-11-07 21:52:52 +0800 |
commit | a3f374263f7839e94472d845a12033a7784727ae (patch) | |
tree | 05eb2c684a380128fbd0b672d25f40292409c77b | |
parent | 8f2c8a7a5ac41696d1afec4d94693bbcbda475dd (diff) |
PCI: Show driver, BAR#, and resource on pci_ioremap_bar() failure
Use dev_warn() to complain about a pci_ioremap_bar() failure so we can
include the driver name, BAR number, and the resource itself. We could use
dev_WARN() to also get the backtrace as we did previously, but I think
that's more information than we need.
Signed-off-by: Bjorn Helgaas <bhelgaas@google.com>
Acked-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
(cherry picked from commit 1f7bf3bfb5d60c87dcaa708fd9eabbec93f15830)
Signed-off-by: Alex Shi <alex.shi@linaro.org>
-rw-r--r-- | drivers/pci/pci.c | 9 |
1 files changed, 5 insertions, 4 deletions
diff --git a/drivers/pci/pci.c b/drivers/pci/pci.c index ff7af33f2353..22b5aabca6dc 100644 --- a/drivers/pci/pci.c +++ b/drivers/pci/pci.c @@ -124,15 +124,16 @@ EXPORT_SYMBOL_GPL(pci_bus_max_busnr); #ifdef CONFIG_HAS_IOMEM void __iomem *pci_ioremap_bar(struct pci_dev *pdev, int bar) { + struct resource *res = &pdev->resource[bar]; + /* * Make sure the BAR is actually a memory resource, not an IO resource */ - if (!(pci_resource_flags(pdev, bar) & IORESOURCE_MEM)) { - WARN_ON(1); + if (!(res->flags & IORESOURCE_MEM)) { + dev_warn(&pdev->dev, "can't ioremap BAR %d: %pR\n", bar, res); return NULL; } - return ioremap_nocache(pci_resource_start(pdev, bar), - pci_resource_len(pdev, bar)); + return ioremap_nocache(res->start, resource_size(res)); } EXPORT_SYMBOL_GPL(pci_ioremap_bar); #endif |