diff options
author | Mika Westerberg <mika.westerberg@linux.intel.com> | 2023-03-30 19:24:30 +0300 |
---|---|---|
committer | Bjorn Helgaas <bhelgaas@google.com> | 2023-04-04 18:43:52 +0300 |
commit | 09cc900632400079619e9154604fd299c2cc9a5a (patch) | |
tree | 9abeb2ee2000fd6b91b4de0b7f401a4e23ee8fca /drivers/pci/setup-res.c | |
parent | 144d204df78e40e6250201e71ef7d0e42d2a13fc (diff) | |
download | linux-09cc900632400079619e9154604fd299c2cc9a5a.tar.xz |
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/setup-res.c')
-rw-r--r-- | drivers/pci/setup-res.c | 4 |
1 files changed, 1 insertions, 3 deletions
diff --git a/drivers/pci/setup-res.c b/drivers/pci/setup-res.c index b492e67c3d87..967f9a758923 100644 --- a/drivers/pci/setup-res.c +++ b/drivers/pci/setup-res.c @@ -484,12 +484,10 @@ int pci_enable_resources(struct pci_dev *dev, int mask) pci_read_config_word(dev, PCI_COMMAND, &cmd); old_cmd = cmd; - for (i = 0; i < PCI_NUM_RESOURCES; i++) { + pci_dev_for_each_resource(dev, r, i) { if (!(mask & (1 << i))) continue; - r = &dev->resource[i]; - if (!(r->flags & (IORESOURCE_IO | IORESOURCE_MEM))) continue; if ((i == PCI_ROM_RESOURCE) && |