Skip to content

Commit

Permalink
parisc/PCI: Use list_for_each_entry() for bus->devices traversal
Browse files Browse the repository at this point in the history
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
  • Loading branch information
bjorn-helgaas committed Aug 22, 2012
1 parent f5725f4 commit 0b79ca2
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 12 deletions.
10 changes: 3 additions & 7 deletions drivers/parisc/dino.c
Original file line number Diff line number Diff line change
Expand Up @@ -477,14 +477,12 @@ dino_card_setup(struct pci_bus *bus, void __iomem *base_addr)
if (ccio_allocate_resource(dino_dev->hba.dev, res, _8MB,
F_EXTEND(0xf0000000UL) | _8MB,
F_EXTEND(0xffffffffUL) &~ _8MB, _8MB) < 0) {
struct list_head *ln, *tmp_ln;
struct pci_dev *dev, *tmp;

printk(KERN_ERR "Dino: cannot attach bus %s\n",
dev_name(bus->bridge));
/* kill the bus, we can't do anything with it */
list_for_each_safe(ln, tmp_ln, &bus->devices) {
struct pci_dev *dev = pci_dev_b(ln);

list_for_each_entry_safe(dev, tmp, &bus->devices, bus_list) {
list_del(&dev->bus_list);
}

Expand Down Expand Up @@ -549,7 +547,6 @@ dino_card_fixup(struct pci_dev *dev)
static void __init
dino_fixup_bus(struct pci_bus *bus)
{
struct list_head *ln;
struct pci_dev *dev;
struct dino_device *dino_dev = DINO_DEV(parisc_walk_tree(bus->bridge));

Expand Down Expand Up @@ -596,8 +593,7 @@ dino_fixup_bus(struct pci_bus *bus)
}


list_for_each(ln, &bus->devices) {
dev = pci_dev_b(ln);
list_for_each_entry(dev, &bus->devices, bus_list) {
if (is_card_dino(&dino_dev->hba.dev->id))
dino_card_fixup(dev);

Expand Down
7 changes: 2 additions & 5 deletions drivers/parisc/lba_pci.c
Original file line number Diff line number Diff line change
Expand Up @@ -629,7 +629,6 @@ truncate_pat_collision(struct resource *root, struct resource *new)
static void
lba_fixup_bus(struct pci_bus *bus)
{
struct list_head *ln;
struct pci_dev *dev;
#ifdef FBB_SUPPORT
u16 status;
Expand Down Expand Up @@ -711,10 +710,9 @@ lba_fixup_bus(struct pci_bus *bus)

}

list_for_each(ln, &bus->devices) {
list_for_each_entry(dev, &bus->devices, bus_list) {
int i;

dev = pci_dev_b(ln);
DBG("lba_fixup_bus() %s\n", pci_name(dev));

/* Virtualize Device/Bridge Resources. */
Expand Down Expand Up @@ -771,8 +769,7 @@ lba_fixup_bus(struct pci_bus *bus)
}

/* Lastly enable FBB/PERR/SERR on all devices too */
list_for_each(ln, &bus->devices) {
dev = pci_dev_b(ln);
list_for_each_entry(dev, &bus->devices, bus_list) {
(void) pci_read_config_word(dev, PCI_COMMAND, &status);
status |= PCI_COMMAND_PARITY | PCI_COMMAND_SERR | fbb_enable;
(void) pci_write_config_word(dev, PCI_COMMAND, status);
Expand Down

0 comments on commit 0b79ca2

Please sign in to comment.