Skip to content

Commit

Permalink
sunhme/PCI: use list_for_each_entry() for bus->devices traversal
Browse files Browse the repository at this point in the history
Replace open-coded list traversal with list_for_each_entry().

CC: David S. Miller <davem@davemloft.net>
CC: netdev@vger.kernel.org
Signed-off-by: Bjorn Helgaas <bhelgaas@google.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
  • Loading branch information
Bjorn Helgaas authored and David S. Miller committed Dec 19, 2011
1 parent 0a955c3 commit bc12d28
Showing 1 changed file with 2 additions and 7 deletions.
9 changes: 2 additions & 7 deletions drivers/net/ethernet/sun/sunhme.c
Original file line number Diff line number Diff line change
Expand Up @@ -2850,7 +2850,7 @@ static int __devinit happy_meal_sbus_probe_one(struct platform_device *op, int i
static int is_quattro_p(struct pci_dev *pdev)
{
struct pci_dev *busdev = pdev->bus->self;
struct list_head *tmp;
struct pci_dev *this_pdev;
int n_hmes;

if (busdev == NULL ||
Expand All @@ -2859,15 +2859,10 @@ static int is_quattro_p(struct pci_dev *pdev)
return 0;

n_hmes = 0;
tmp = pdev->bus->devices.next;
while (tmp != &pdev->bus->devices) {
struct pci_dev *this_pdev = pci_dev_b(tmp);

list_for_each_entry(this_pdev, &pdev->bus->devices, bus_list) {
if (this_pdev->vendor == PCI_VENDOR_ID_SUN &&
this_pdev->device == PCI_DEVICE_ID_SUN_HAPPYMEAL)
n_hmes++;

tmp = tmp->next;
}

if (n_hmes != 4)
Expand Down

0 comments on commit bc12d28

Please sign in to comment.