From patchwork Fri Dec 16 22:31:49 2011 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Bjorn Helgaas X-Patchwork-Id: 131924 X-Patchwork-Delegate: davem@davemloft.net Return-Path: X-Original-To: patchwork-incoming@ozlabs.org Delivered-To: patchwork-incoming@ozlabs.org Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by ozlabs.org (Postfix) with ESMTP id 1B40B1007D7 for ; Sat, 17 Dec 2011 09:31:57 +1100 (EST) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1760898Ab1LPWbv (ORCPT ); Fri, 16 Dec 2011 17:31:51 -0500 Received: from mail-yx0-f202.google.com ([209.85.213.202]:40106 "EHLO mail-yx0-f202.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752591Ab1LPWbu (ORCPT ); Fri, 16 Dec 2011 17:31:50 -0500 Received: by mail-yx0-f202.google.com with SMTP id m5so459911yen.1 for ; Fri, 16 Dec 2011 14:31:50 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=beta; h=subject:to:from:cc:date:message-id:in-reply-to:references :user-agent:mime-version:content-type:content-transfer-encoding; bh=i7a5bzwz2zH9ZvmXyktzCZpA7KEpyxQTjgDNWl5ctaw=; b=GkwMEvd4vfCn2TlnNxh8WXp91am86n7lXeATMxag19/rKzFL671YrI/cPlsSRulg6Z gUVEIJTPr8Ca5npWDeFA== Received: by 10.236.124.80 with SMTP id w56mr3022495yhh.0.1324074710342; Fri, 16 Dec 2011 14:31:50 -0800 (PST) Received: by 10.236.124.80 with SMTP id w56mr3022466yhh.0.1324074710265; Fri, 16 Dec 2011 14:31:50 -0800 (PST) Received: from wpzn4.hot.corp.google.com (216-239-44-65.google.com [216.239.44.65]) by gmr-mx.google.com with ESMTPS id k7si1336865yhm.1.2011.12.16.14.31.50 (version=TLSv1/SSLv3 cipher=AES128-SHA); Fri, 16 Dec 2011 14:31:50 -0800 (PST) Received: from bhelgaas.mtv.corp.google.com (bhelgaas.mtv.corp.google.com [172.18.96.155]) by wpzn4.hot.corp.google.com (Postfix) with ESMTP id 2A1FF1E004D; Fri, 16 Dec 2011 14:31:50 -0800 (PST) Received: from bhelgaas.mtv.corp.google.com (unknown [IPv6:::1]) by bhelgaas.mtv.corp.google.com (Postfix) with ESMTP id DA06818273A; Fri, 16 Dec 2011 14:31:49 -0800 (PST) Subject: [PATCH 4/6] sunhme/PCI: use list_for_each_entry() for bus->devices traversal To: Jesse Barnes From: Bjorn Helgaas Cc: linux-pci@vger.kernel.org, "David S. Miller" , netdev@vger.kernel.org Date: Fri, 16 Dec 2011 15:31:49 -0700 Message-ID: <20111216223149.5963.61942.stgit@bhelgaas.mtv.corp.google.com> In-Reply-To: <20111216223043.5963.87534.stgit@bhelgaas.mtv.corp.google.com> References: <20111216223043.5963.87534.stgit@bhelgaas.mtv.corp.google.com> User-Agent: StGit/0.15 MIME-Version: 1.0 Sender: netdev-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org Replace open-coded list traversal with list_for_each_entry(). CC: David S. Miller CC: netdev@vger.kernel.org Signed-off-by: Bjorn Helgaas --- drivers/net/ethernet/sun/sunhme.c | 9 ++------- 1 files changed, 2 insertions(+), 7 deletions(-) -- To unsubscribe from this list: send the line "unsubscribe netdev" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html 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)