All of lore.kernel.org
 help / color / mirror / Atom feed
From: Bjorn Helgaas <bhelgaas@google.com>
To: linux-pci@vger.kernel.org
Cc: linux-acpi@vger.kernel.org
Subject: [PATCH v1 3/4] PCI: Show driver, BAR#, and resource on pci_ioremap_bar() failure
Date: Thu, 12 Mar 2015 12:35:40 -0500	[thread overview]
Message-ID: <20150312173540.1052.39833.stgit@bhelgaas-glaptop2.roam.corp.google.com> (raw)
In-Reply-To: <20150312173201.1052.28341.stgit@bhelgaas-glaptop2.roam.corp.google.com>

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>
---
 drivers/pci/pci.c |    9 +++++----
 1 file changed, 5 insertions(+), 4 deletions(-)

diff --git a/drivers/pci/pci.c b/drivers/pci/pci.c
index 81f06e8dcc04..a6d191ad9743 100644
--- a/drivers/pci/pci.c
+++ b/drivers/pci/pci.c
@@ -126,15 +126,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

  parent reply	other threads:[~2015-03-12 17:35 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-03-12 17:35 [PATCH v1 0/4] Unassigned resource fixes Bjorn Helgaas
2015-03-12 17:35 ` [PATCH v1 1/4] PNP: Don't check for overlaps with unassigned PCI BARs Bjorn Helgaas
2015-03-12 17:35 ` [PATCH v1 2/4] PCI: Mark invalid BARs as unassigned Bjorn Helgaas
2015-04-14 23:14   ` Tony Luck
2015-04-14 23:30     ` Bjorn Helgaas
     [not found]       ` <CA+8MBbLnFQ2_zWniBFN6=kJMo-3PbBQvdsfPFV+zyApYpN6BQA@mail.gmail.com>
2015-04-15 14:48         ` Bjorn Helgaas
2015-04-15 16:27           ` Tony Luck
2015-04-15 19:42             ` Bjorn Helgaas
2015-04-15 21:28               ` Tony Luck
2015-04-15 23:04                 ` Bjorn Helgaas
2015-03-12 17:35 ` Bjorn Helgaas [this message]
2015-03-12 17:35 ` [PATCH v1 4/4] PCI: Fail pci_ioremap_bar() on unassigned resources Bjorn Helgaas
2015-03-12 22:32 ` [PATCH v1 0/4] Unassigned resource fixes Rafael J. Wysocki
2015-03-19 15:06 ` Bjorn Helgaas

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=20150312173540.1052.39833.stgit@bhelgaas-glaptop2.roam.corp.google.com \
    --to=bhelgaas@google.com \
    --cc=linux-acpi@vger.kernel.org \
    --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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.