Commit 4e344b1cc53989e8ecc1140e9346f657d7c8aa9e

Authored by Kulikov Vasiliy
Committed by Jesse Barnes
1 parent 30da552428

PCI: use for_each_pci_dev()

Use for_each_pci_dev() to simplify the code.

Signed-off-by: Kulikov Vasiliy <segooon@gmail.com>
Signed-off-by: Jesse Barnes <jbarnes@virtuousgeek.org>

Showing 5 changed files with 6 additions and 7 deletions Side-by-side Diff

drivers/pci/hotplug/fakephp.c
... ... @@ -135,7 +135,7 @@
135 135 struct pci_dev *pdev = NULL;
136 136  
137 137 /* Add existing devices */
138   - while ((pdev = pci_get_device(PCI_ANY_ID, PCI_ANY_ID, pdev)))
  138 + for_each_pci_dev(pdev)
139 139 legacy_add_slot(pdev);
140 140  
141 141 /* Be alerted of any new ones */
... ... @@ -483,9 +483,9 @@
483 483 proc_create("devices", 0, proc_bus_pci_dir,
484 484 &proc_bus_pci_dev_operations);
485 485 proc_initialized = 1;
486   - while ((dev = pci_get_device(PCI_ANY_ID, PCI_ANY_ID, dev)) != NULL) {
  486 + for_each_pci_dev(dev)
487 487 pci_proc_attach_device(dev);
488   - }
  488 +
489 489 return 0;
490 490 }
491 491  
drivers/pci/quirks.c
... ... @@ -2773,7 +2773,7 @@
2773 2773 printk(KERN_DEBUG "PCI: CLS %u bytes\n",
2774 2774 pci_cache_line_size << 2);
2775 2775  
2776   - while ((dev = pci_get_device(PCI_ANY_ID, PCI_ANY_ID, dev)) != NULL) {
  2776 + for_each_pci_dev(dev) {
2777 2777 pci_fixup_device(pci_fixup_final, dev);
2778 2778 /*
2779 2779 * If arch hasn't set it explicitly yet, use the CLS
drivers/pci/search.c
... ... @@ -169,7 +169,7 @@
169 169 {
170 170 struct pci_dev *dev = NULL;
171 171  
172   - while ((dev = pci_get_device(PCI_ANY_ID, PCI_ANY_ID, dev)) != NULL) {
  172 + for_each_pci_dev(dev) {
173 173 if (pci_domain_nr(dev->bus) == domain &&
174 174 (dev->bus->number == bus && dev->devfn == devfn))
175 175 return dev;
drivers/pci/setup-irq.c
... ... @@ -59,8 +59,7 @@
59 59 int (*map_irq)(struct pci_dev *, u8, u8))
60 60 {
61 61 struct pci_dev *dev = NULL;
62   - while ((dev = pci_get_device(PCI_ANY_ID, PCI_ANY_ID, dev)) != NULL) {
  62 + for_each_pci_dev(dev)
63 63 pdev_fixup_irq(dev, swizzle, map_irq);
64   - }
65 64 }