aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/pci/setup-res.c
diff options
context:
space:
mode:
authorBjorn Helgaas <bhelgaas@google.com>2014-02-26 13:25:58 -0500
committerBjorn Helgaas <bhelgaas@google.com>2014-02-27 12:43:32 -0500
commitbd064f0a231af336218838474ea45a64f1672190 (patch)
treea1deda3444f1c2554e22c6969641352cc2cc8eb1 /drivers/pci/setup-res.c
parentf44116ae881868ab72274df1eff48fdbde9898af (diff)
PCI: Mark resources as IORESOURCE_UNSET if we can't assign them
When assigning addresses to resources, mark them with IORESOURCE_UNSET before we start and clear IORESOURCE_UNSET if assignment is successful. That means that if we print the resource during assignment, we will show the size, not a meaningless address. Also, clear IORESOURCE_UNSET if we do assign an address, so we print the address when it is valid. Signed-off-by: Bjorn Helgaas <bhelgaas@google.com>
Diffstat (limited to 'drivers/pci/setup-res.c')
-rw-r--r--drivers/pci/setup-res.c4
1 files changed, 4 insertions, 0 deletions
diff --git a/drivers/pci/setup-res.c b/drivers/pci/setup-res.c
index 5c060b152ce6..0474b0217fdf 100644
--- a/drivers/pci/setup-res.c
+++ b/drivers/pci/setup-res.c
@@ -263,6 +263,7 @@ int pci_assign_resource(struct pci_dev *dev, int resno)
263 resource_size_t align, size; 263 resource_size_t align, size;
264 int ret; 264 int ret;
265 265
266 res->flags |= IORESOURCE_UNSET;
266 align = pci_resource_alignment(dev, res); 267 align = pci_resource_alignment(dev, res);
267 if (!align) { 268 if (!align) {
268 dev_info(&dev->dev, "BAR %d: can't assign %pR " 269 dev_info(&dev->dev, "BAR %d: can't assign %pR "
@@ -282,6 +283,7 @@ int pci_assign_resource(struct pci_dev *dev, int resno)
282 ret = pci_revert_fw_address(res, dev, resno, size); 283 ret = pci_revert_fw_address(res, dev, resno, size);
283 284
284 if (!ret) { 285 if (!ret) {
286 res->flags &= ~IORESOURCE_UNSET;
285 res->flags &= ~IORESOURCE_STARTALIGN; 287 res->flags &= ~IORESOURCE_STARTALIGN;
286 dev_info(&dev->dev, "BAR %d: assigned %pR\n", resno, res); 288 dev_info(&dev->dev, "BAR %d: assigned %pR\n", resno, res);
287 if (resno < PCI_BRIDGE_RESOURCES) 289 if (resno < PCI_BRIDGE_RESOURCES)
@@ -297,6 +299,7 @@ int pci_reassign_resource(struct pci_dev *dev, int resno, resource_size_t addsiz
297 resource_size_t new_size; 299 resource_size_t new_size;
298 int ret; 300 int ret;
299 301
302 res->flags |= IORESOURCE_UNSET;
300 if (!res->parent) { 303 if (!res->parent) {
301 dev_info(&dev->dev, "BAR %d: can't reassign an unassigned resource %pR " 304 dev_info(&dev->dev, "BAR %d: can't reassign an unassigned resource %pR "
302 "\n", resno, res); 305 "\n", resno, res);
@@ -307,6 +310,7 @@ int pci_reassign_resource(struct pci_dev *dev, int resno, resource_size_t addsiz
307 new_size = resource_size(res) + addsize; 310 new_size = resource_size(res) + addsize;
308 ret = _pci_assign_resource(dev, resno, new_size, min_align); 311 ret = _pci_assign_resource(dev, resno, new_size, min_align);
309 if (!ret) { 312 if (!ret) {
313 res->flags &= ~IORESOURCE_UNSET;
310 res->flags &= ~IORESOURCE_STARTALIGN; 314 res->flags &= ~IORESOURCE_STARTALIGN;
311 dev_info(&dev->dev, "BAR %d: reassigned %pR\n", resno, res); 315 dev_info(&dev->dev, "BAR %d: reassigned %pR\n", resno, res);
312 if (resno < PCI_BRIDGE_RESOURCES) 316 if (resno < PCI_BRIDGE_RESOURCES)