diff options
author | Mika Westerberg <mika.westerberg@linux.intel.com> | 2023-03-30 18:24:30 +0200 |
---|---|---|
committer | Bjorn Helgaas <bhelgaas@google.com> | 2023-04-04 17:43:52 +0200 |
commit | 09cc900632400079619e9154604fd299c2cc9a5a (patch) | |
tree | 9abeb2ee2000fd6b91b4de0b7f401a4e23ee8fca /drivers/pci/xen-pcifront.c | |
parent | PCI: Introduce pci_resource_n() (diff) | |
download | linux-09cc900632400079619e9154604fd299c2cc9a5a.tar.xz linux-09cc900632400079619e9154604fd299c2cc9a5a.zip |
PCI: Introduce pci_dev_for_each_resource()
Instead of open-coding it everywhere introduce a tiny helper that can be
used to iterate over each resource of a PCI device, and convert the most
obvious users into it.
While at it drop doubled empty line before pdev_sort_resources().
No functional changes intended.
Suggested-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Link: https://lore.kernel.org/r/20230330162434.35055-4-andriy.shevchenko@linux.intel.com
Signed-off-by: Mika Westerberg <mika.westerberg@linux.intel.com>
Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Signed-off-by: Bjorn Helgaas <bhelgaas@google.com>
Reviewed-by: Krzysztof WilczyĆski <kw@linux.com>
Diffstat (limited to 'drivers/pci/xen-pcifront.c')
-rw-r--r-- | drivers/pci/xen-pcifront.c | 4 |
1 files changed, 1 insertions, 3 deletions
diff --git a/drivers/pci/xen-pcifront.c b/drivers/pci/xen-pcifront.c index fcd029ca2eb1..83c0ab50676d 100644 --- a/drivers/pci/xen-pcifront.c +++ b/drivers/pci/xen-pcifront.c @@ -390,9 +390,7 @@ static int pcifront_claim_resource(struct pci_dev *dev, void *data) int i; struct resource *r; - for (i = 0; i < PCI_NUM_RESOURCES; i++) { - r = &dev->resource[i]; - + pci_dev_for_each_resource(dev, r, i) { if (!r->parent && r->start && r->flags) { dev_info(&pdev->xdev->dev, "claiming resource %s/%d\n", pci_name(dev), i); |