diff options
author | Bjorn Helgaas <bhelgaas@google.com> | 2012-08-16 18:45:02 -0400 |
---|---|---|
committer | Bjorn Helgaas <bhelgaas@google.com> | 2012-08-22 13:34:38 -0400 |
commit | 0b79ca2a800d1a2ed0386886c8358217f3371592 (patch) | |
tree | e78f58f56b3de5f22804e72c21641e78155d9c4d /drivers | |
parent | f5725f4d3d9a69c647d6d2d504bd0ae87d9a08df (diff) |
parisc/PCI: Use list_for_each_entry() for bus->devices traversal
Replace list_for_each() + pci_dev_b() with the simpler
list_for_each_entry().
Signed-off-by: Bjorn Helgaas <bhelgaas@google.com>
Acked-by: Yinghai Lu <yinghai@kernel.org>
CC: linux-parisc@vger.kernel.org
Diffstat (limited to 'drivers')
-rw-r--r-- | drivers/parisc/dino.c | 10 | ||||
-rw-r--r-- | drivers/parisc/lba_pci.c | 7 |
2 files changed, 5 insertions, 12 deletions
diff --git a/drivers/parisc/dino.c b/drivers/parisc/dino.c index ffddc4f64268..fb6a1fe21b93 100644 --- a/drivers/parisc/dino.c +++ b/drivers/parisc/dino.c | |||
@@ -477,14 +477,12 @@ dino_card_setup(struct pci_bus *bus, void __iomem *base_addr) | |||
477 | if (ccio_allocate_resource(dino_dev->hba.dev, res, _8MB, | 477 | if (ccio_allocate_resource(dino_dev->hba.dev, res, _8MB, |
478 | F_EXTEND(0xf0000000UL) | _8MB, | 478 | F_EXTEND(0xf0000000UL) | _8MB, |
479 | F_EXTEND(0xffffffffUL) &~ _8MB, _8MB) < 0) { | 479 | F_EXTEND(0xffffffffUL) &~ _8MB, _8MB) < 0) { |
480 | struct list_head *ln, *tmp_ln; | 480 | struct pci_dev *dev, *tmp; |
481 | 481 | ||
482 | printk(KERN_ERR "Dino: cannot attach bus %s\n", | 482 | printk(KERN_ERR "Dino: cannot attach bus %s\n", |
483 | dev_name(bus->bridge)); | 483 | dev_name(bus->bridge)); |
484 | /* kill the bus, we can't do anything with it */ | 484 | /* kill the bus, we can't do anything with it */ |
485 | list_for_each_safe(ln, tmp_ln, &bus->devices) { | 485 | list_for_each_entry_safe(dev, tmp, &bus->devices, bus_list) { |
486 | struct pci_dev *dev = pci_dev_b(ln); | ||
487 | |||
488 | list_del(&dev->bus_list); | 486 | list_del(&dev->bus_list); |
489 | } | 487 | } |
490 | 488 | ||
@@ -549,7 +547,6 @@ dino_card_fixup(struct pci_dev *dev) | |||
549 | static void __init | 547 | static void __init |
550 | dino_fixup_bus(struct pci_bus *bus) | 548 | dino_fixup_bus(struct pci_bus *bus) |
551 | { | 549 | { |
552 | struct list_head *ln; | ||
553 | struct pci_dev *dev; | 550 | struct pci_dev *dev; |
554 | struct dino_device *dino_dev = DINO_DEV(parisc_walk_tree(bus->bridge)); | 551 | struct dino_device *dino_dev = DINO_DEV(parisc_walk_tree(bus->bridge)); |
555 | 552 | ||
@@ -596,8 +593,7 @@ dino_fixup_bus(struct pci_bus *bus) | |||
596 | } | 593 | } |
597 | 594 | ||
598 | 595 | ||
599 | list_for_each(ln, &bus->devices) { | 596 | list_for_each_entry(dev, &bus->devices, bus_list) { |
600 | dev = pci_dev_b(ln); | ||
601 | if (is_card_dino(&dino_dev->hba.dev->id)) | 597 | if (is_card_dino(&dino_dev->hba.dev->id)) |
602 | dino_card_fixup(dev); | 598 | dino_card_fixup(dev); |
603 | 599 | ||
diff --git a/drivers/parisc/lba_pci.c b/drivers/parisc/lba_pci.c index 4ce57c92e559..fdd63a6a62d6 100644 --- a/drivers/parisc/lba_pci.c +++ b/drivers/parisc/lba_pci.c | |||
@@ -629,7 +629,6 @@ truncate_pat_collision(struct resource *root, struct resource *new) | |||
629 | static void | 629 | static void |
630 | lba_fixup_bus(struct pci_bus *bus) | 630 | lba_fixup_bus(struct pci_bus *bus) |
631 | { | 631 | { |
632 | struct list_head *ln; | ||
633 | struct pci_dev *dev; | 632 | struct pci_dev *dev; |
634 | #ifdef FBB_SUPPORT | 633 | #ifdef FBB_SUPPORT |
635 | u16 status; | 634 | u16 status; |
@@ -711,10 +710,9 @@ lba_fixup_bus(struct pci_bus *bus) | |||
711 | 710 | ||
712 | } | 711 | } |
713 | 712 | ||
714 | list_for_each(ln, &bus->devices) { | 713 | list_for_each_entry(dev, &bus->devices, bus_list) { |
715 | int i; | 714 | int i; |
716 | 715 | ||
717 | dev = pci_dev_b(ln); | ||
718 | DBG("lba_fixup_bus() %s\n", pci_name(dev)); | 716 | DBG("lba_fixup_bus() %s\n", pci_name(dev)); |
719 | 717 | ||
720 | /* Virtualize Device/Bridge Resources. */ | 718 | /* Virtualize Device/Bridge Resources. */ |
@@ -771,8 +769,7 @@ lba_fixup_bus(struct pci_bus *bus) | |||
771 | } | 769 | } |
772 | 770 | ||
773 | /* Lastly enable FBB/PERR/SERR on all devices too */ | 771 | /* Lastly enable FBB/PERR/SERR on all devices too */ |
774 | list_for_each(ln, &bus->devices) { | 772 | list_for_each_entry(dev, &bus->devices, bus_list) { |
775 | dev = pci_dev_b(ln); | ||
776 | (void) pci_read_config_word(dev, PCI_COMMAND, &status); | 773 | (void) pci_read_config_word(dev, PCI_COMMAND, &status); |
777 | status |= PCI_COMMAND_PARITY | PCI_COMMAND_SERR | fbb_enable; | 774 | status |= PCI_COMMAND_PARITY | PCI_COMMAND_SERR | fbb_enable; |
778 | (void) pci_write_config_word(dev, PCI_COMMAND, status); | 775 | (void) pci_write_config_word(dev, PCI_COMMAND, status); |