[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Message-ID: <20111216223149.5963.61942.stgit@bhelgaas.mtv.corp.google.com>
Date: Fri, 16 Dec 2011 15:31:49 -0700
From: Bjorn Helgaas <bhelgaas@...gle.com>
To: Jesse Barnes <jbarnes@...tuousgeek.org>
Cc: linux-pci@...r.kernel.org, "David S. Miller" <davem@...emloft.net>,
netdev@...r.kernel.org
Subject: [PATCH 4/6] sunhme/PCI: use list_for_each_entry() for bus->devices
traversal
Replace open-coded list traversal with list_for_each_entry().
CC: David S. Miller <davem@...emloft.net>
CC: netdev@...r.kernel.org
Signed-off-by: Bjorn Helgaas <bhelgaas@...gle.com>
---
drivers/net/ethernet/sun/sunhme.c | 9 ++-------
1 files changed, 2 insertions(+), 7 deletions(-)
diff --git a/drivers/net/ethernet/sun/sunhme.c b/drivers/net/ethernet/sun/sunhme.c
index cf14ab9..1d00a4c 100644
--- a/drivers/net/ethernet/sun/sunhme.c
+++ b/drivers/net/ethernet/sun/sunhme.c
@@ -2849,7 +2849,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 ||
@@ -2858,15 +2858,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)
--
To unsubscribe from this list: send the line "unsubscribe netdev" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Powered by blists - more mailing lists