aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/pci
diff options
context:
space:
mode:
authorKulikov Vasiliy <segooon@gmail.com>2010-07-03 12:04:39 -0400
committerJesse Barnes <jbarnes@virtuousgeek.org>2010-07-30 12:47:22 -0400
commit4e344b1cc53989e8ecc1140e9346f657d7c8aa9e (patch)
tree8b6f8d4b7445e7b8e0b6d1b6f68bf165f5735f16 /drivers/pci
parent30da55242818a8ca08583188ebcbaccd283ad4d9 (diff)
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>
Diffstat (limited to 'drivers/pci')
-rw-r--r--drivers/pci/hotplug/fakephp.c2
-rw-r--r--drivers/pci/proc.c4
-rw-r--r--drivers/pci/quirks.c2
-rw-r--r--drivers/pci/search.c2
-rw-r--r--drivers/pci/setup-irq.c3
5 files changed, 6 insertions, 7 deletions
diff --git a/drivers/pci/hotplug/fakephp.c b/drivers/pci/hotplug/fakephp.c
index 5317e4d7d96e..17d10e2e8fb6 100644
--- a/drivers/pci/hotplug/fakephp.c
+++ b/drivers/pci/hotplug/fakephp.c
@@ -135,7 +135,7 @@ static int __init init_legacy(void)
135 struct pci_dev *pdev = NULL; 135 struct pci_dev *pdev = NULL;
136 136
137 /* Add existing devices */ 137 /* Add existing devices */
138 while ((pdev = pci_get_device(PCI_ANY_ID, PCI_ANY_ID, pdev))) 138 for_each_pci_dev(pdev)
139 legacy_add_slot(pdev); 139 legacy_add_slot(pdev);
140 140
141 /* Be alerted of any new ones */ 141 /* Be alerted of any new ones */
diff --git a/drivers/pci/proc.c b/drivers/pci/proc.c
index 68316b59d7d3..01f0306525a5 100644
--- a/drivers/pci/proc.c
+++ b/drivers/pci/proc.c
@@ -483,9 +483,9 @@ static int __init pci_proc_init(void)
483 proc_create("devices", 0, proc_bus_pci_dir, 483 proc_create("devices", 0, proc_bus_pci_dir,
484 &proc_bus_pci_dev_operations); 484 &proc_bus_pci_dev_operations);
485 proc_initialized = 1; 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 pci_proc_attach_device(dev); 487 pci_proc_attach_device(dev);
488 } 488
489 return 0; 489 return 0;
490} 490}
491 491
diff --git a/drivers/pci/quirks.c b/drivers/pci/quirks.c
index 202efa6f57c4..8141f442e3df 100644
--- a/drivers/pci/quirks.c
+++ b/drivers/pci/quirks.c
@@ -2773,7 +2773,7 @@ static int __init pci_apply_final_quirks(void)
2773 printk(KERN_DEBUG "PCI: CLS %u bytes\n", 2773 printk(KERN_DEBUG "PCI: CLS %u bytes\n",
2774 pci_cache_line_size << 2); 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 pci_fixup_device(pci_fixup_final, dev); 2777 pci_fixup_device(pci_fixup_final, dev);
2778 /* 2778 /*
2779 * If arch hasn't set it explicitly yet, use the CLS 2779 * If arch hasn't set it explicitly yet, use the CLS
diff --git a/drivers/pci/search.c b/drivers/pci/search.c
index 20d03f772289..9d75dc8ca602 100644
--- a/drivers/pci/search.c
+++ b/drivers/pci/search.c
@@ -169,7 +169,7 @@ struct pci_dev *pci_get_domain_bus_and_slot(int domain, unsigned int bus,
169{ 169{
170 struct pci_dev *dev = NULL; 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 if (pci_domain_nr(dev->bus) == domain && 173 if (pci_domain_nr(dev->bus) == domain &&
174 (dev->bus->number == bus && dev->devfn == devfn)) 174 (dev->bus->number == bus && dev->devfn == devfn))
175 return dev; 175 return dev;
diff --git a/drivers/pci/setup-irq.c b/drivers/pci/setup-irq.c
index aa795fd428de..eec9738f3492 100644
--- a/drivers/pci/setup-irq.c
+++ b/drivers/pci/setup-irq.c
@@ -59,7 +59,6 @@ pci_fixup_irqs(u8 (*swizzle)(struct pci_dev *, u8 *),
59 int (*map_irq)(struct pci_dev *, u8, u8)) 59 int (*map_irq)(struct pci_dev *, u8, u8))
60{ 60{
61 struct pci_dev *dev = NULL; 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 pdev_fixup_irq(dev, swizzle, map_irq); 63 pdev_fixup_irq(dev, swizzle, map_irq);
64 }
65} 64}