[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <1332136129-14010-11-git-send-email-yinghai@kernel.org>
Date: Sun, 18 Mar 2012 22:48:33 -0700
From: Yinghai Lu <yinghai@...nel.org>
To: Jesse Barnes <jbarnes@...tuousgeek.org>, x86 <x86@...nel.org>
Cc: Bjorn Helgaas <bhelgaas@...gle.com>,
Andrew Morton <akpm@...ux-foundation.org>,
Linus Torvalds <torvalds@...ux-foundation.org>,
Greg Kroah-Hartman <gregkh@...uxfoundation.org>,
linux-pci@...r.kernel.org, linux-kernel@...r.kernel.org,
Yinghai Lu <yinghai@...nel.org>
Subject: [PATCH -v2 10/26] PCI: Use for_each_pci_dev_resource pci_enable_dev
Signed-off-by: Yinghai Lu <yinghai@...nel.org>
---
drivers/pci/pci.c | 15 ++++++++-------
1 files changed, 8 insertions(+), 7 deletions(-)
diff --git a/drivers/pci/pci.c b/drivers/pci/pci.c
index 82ed56a..44b4835 100644
--- a/drivers/pci/pci.c
+++ b/drivers/pci/pci.c
@@ -486,8 +486,9 @@ static void
pci_restore_bars(struct pci_dev *dev)
{
int i;
+ struct resource *res;
- for (i = 0; i < PCI_BRIDGE_RESOURCES; i++)
+ for_each_pci_dev_nobridge_resource(dev, res, i)
pci_update_resource(dev, i);
}
@@ -1141,6 +1142,7 @@ static int __pci_enable_device_flags(struct pci_dev *dev,
{
int err;
int i, bars = 0;
+ struct resource *res;
/*
* Power state could be unknown at this point, either due to a fresh
@@ -1158,12 +1160,11 @@ static int __pci_enable_device_flags(struct pci_dev *dev,
return 0; /* already enabled */
/* only skip sriov related */
- for (i = 0; i <= PCI_ROM_RESOURCE; i++)
- if (dev->resource[i].flags & flags)
- bars |= (1 << i);
- for (i = PCI_BRIDGE_RESOURCES; i < DEVICE_COUNT_RESOURCE; i++)
- if (dev->resource[i].flags & flags)
+ for_each_pci_dev_noiov_resource(dev, res, i) {
+ /* TODO: check i with bits of bars */
+ if (res->flags & flags)
bars |= (1 << i);
+ }
err = do_pci_enable_device(dev, bars);
if (err < 0)
@@ -2465,7 +2466,7 @@ static int __pci_request_region(struct pci_dev *pdev, int bar, const char *res_n
err_out:
dev_warn(&pdev->dev, "BAR %d: can't reserve %pR\n", bar,
- &pdev->resource[bar]);
+ pci_dev_resource_n(pdev, bar));
return -EBUSY;
}
--
1.7.7
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Powered by blists - more mailing lists