sunhme/PCI: use list_for_each_entry() for bus->devices traversal
authorBjorn Helgaas <bhelgaas@google.com>
Fri, 16 Dec 2011 12:31:49 +0000 (12:31 +0000)
committerDavid S. Miller <davem@davemloft.net>
Mon, 19 Dec 2011 21:13:36 +0000 (16:13 -0500)
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>
drivers/net/ethernet/sun/sunhme.c

index eebd52f103657173dc0ddbbdb23d1d4eec845bca..09c518655db2bcc36ffca85518325a6af3358ecf 100644 (file)
@@ -2850,7 +2850,7 @@ err_out:
 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 ||
@@ -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)