public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Bjorn Helgaas <bjorn.helgaas@hp.com>
To: Jesse Barnes <jbarnes@virtuousgeek.org>
Cc: linux-pci@vger.kernel.org, linux-kernel@vger.kernel.org,
	"Rafael J. Wysocki" <rjw@sisk.pl>,
	Yanko Kaneti <yaneti@declera.com>,
	Linus Torvalds <torvalds@linux-foundation.org>,
	Thomas Renninger <trenn@suse.de>,
	maciej.rutecki@gmail.com
Subject: [PATCH v1 3/3] PCI: for address space collisions, show conflicting resource
Date: Thu, 11 Mar 2010 17:01:19 -0700	[thread overview]
Message-ID: <20100312000119.4355.21178.stgit@bob.kio> (raw)
In-Reply-To: <20100311235954.4355.23100.stgit@bob.kio>


With request_resource_conflict(), we can learn what the actual conflict is,
so print that info for debugging purposes.

Signed-off-by: Bjorn Helgaas <bjorn.helgaas@hp.com>
---

 drivers/pci/setup-res.c |   14 ++++++++------
 1 files changed, 8 insertions(+), 6 deletions(-)


diff --git a/drivers/pci/setup-res.c b/drivers/pci/setup-res.c
index 7d678bb..17bed18 100644
--- a/drivers/pci/setup-res.c
+++ b/drivers/pci/setup-res.c
@@ -93,8 +93,7 @@ void pci_update_resource(struct pci_dev *dev, int resno)
 int pci_claim_resource(struct pci_dev *dev, int resource)
 {
 	struct resource *res = &dev->resource[resource];
-	struct resource *root;
-	int err;
+	struct resource *root, *conflict;
 
 	root = pci_find_parent_resource(dev, res);
 	if (!root) {
@@ -103,12 +102,15 @@ int pci_claim_resource(struct pci_dev *dev, int resource)
 		return -EINVAL;
 	}
 
-	err = request_resource(root, res);
-	if (err)
+	conflict = request_resource_conflict(root, res);
+	if (conflict) {
 		dev_err(&dev->dev,
-			"address space collision: %pR already in use\n", res);
+			"address space collision: %pR conflicts with %s %pR\n",
+			res, conflict->name, conflict);
+		return -EBUSY;
+	}
 
-	return err;
+	return 0;
 }
 EXPORT_SYMBOL(pci_claim_resource);
 


  parent reply	other threads:[~2010-03-12  0:01 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-03-12  0:01 [PATCH v1 0/3] [RFC] resource, PCI: work around pci=use_crs conflicts Bjorn Helgaas
2010-03-12  0:01 ` [PATCH v1 1/3] resources: add interfaces that return conflict information Bjorn Helgaas
2010-03-19 20:46   ` Jesse Barnes
2010-03-12  0:01 ` [PATCH v1 2/3] x86/PCI: trim _CRS windows when they conflict with previous reservations Bjorn Helgaas
2010-03-17  3:25   ` Kenji Kaneshige
2010-03-17  4:22     ` Bjorn Helgaas
2010-03-17  8:47       ` Kenji Kaneshige
2010-03-17 13:15         ` Bjorn Helgaas
2010-03-12  0:01 ` Bjorn Helgaas [this message]
2010-03-12 14:49 ` [PATCH v1 0/3] [RFC] resource, PCI: work around pci=use_crs conflicts Yanko Kaneti
2010-03-16 19:59 ` 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=20100312000119.4355.21178.stgit@bob.kio \
    --to=bjorn.helgaas@hp.com \
    --cc=jbarnes@virtuousgeek.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-pci@vger.kernel.org \
    --cc=maciej.rutecki@gmail.com \
    --cc=rjw@sisk.pl \
    --cc=torvalds@linux-foundation.org \
    --cc=trenn@suse.de \
    --cc=yaneti@declera.com \
    /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