linuxppc-dev.lists.ozlabs.org archive mirror
 help / color / mirror / Atom feed
From: Yijing Wang <wangyijing@huawei.com>
To: Bjorn Helgaas <bhelgaas@google.com>
Cc: Russell King <linux@arm.linux.org.uk>,
	David Airlie <airlied@linux.ie>,
	linux-pcmcia@lists.infradead.org,
	Hanjun Guo <guohanjun@huawei.com>,
	dri-devel@lists.freedesktop.org, linux-pci@vger.kernel.org,
	Yijing Wang <wangyijing@huawei.com>,
	linuxppc-dev@lists.ozlabs.org
Subject: [PATCH 6/6] PCI: Remove pci_bus_b() and use list_entry() directly
Date: Thu, 13 Feb 2014 21:14:03 +0800	[thread overview]
Message-ID: <1392297243-61848-6-git-send-email-wangyijing@huawei.com> (raw)
In-Reply-To: <1392297243-61848-1-git-send-email-wangyijing@huawei.com>

Replace pci_bus_b() with list_entry(), so we can remove
pci_bus_b().

Signed-off-by: Yijing Wang <wangyijing@huawei.com>
---
 drivers/pci/pci.c    |    6 +++---
 drivers/pci/search.c |   10 +++++-----
 include/linux/pci.h  |    1 -
 3 files changed, 8 insertions(+), 9 deletions(-)

diff --git a/drivers/pci/pci.c b/drivers/pci/pci.c
index 1febe90..6f5ed88 100644
--- a/drivers/pci/pci.c
+++ b/drivers/pci/pci.c
@@ -108,12 +108,12 @@ static bool pcie_ari_disabled;
  */
 unsigned char pci_bus_max_busnr(struct pci_bus* bus)
 {
-	struct list_head *tmp;
+	struct pci_bus *tmp;
 	unsigned char max, n;
 
 	max = bus->busn_res.end;
-	list_for_each(tmp, &bus->children) {
-		n = pci_bus_max_busnr(pci_bus_b(tmp));
+	list_for_each_entry(tmp, &bus->children, node) {
+		n = pci_bus_max_busnr(tmp);
 		if(n > max)
 			max = n;
 	}
diff --git a/drivers/pci/search.c b/drivers/pci/search.c
index 3ff2ac7..4a1b972 100644
--- a/drivers/pci/search.c
+++ b/drivers/pci/search.c
@@ -54,14 +54,14 @@ pci_find_upstream_pcie_bridge(struct pci_dev *pdev)
 
 static struct pci_bus *pci_do_find_bus(struct pci_bus *bus, unsigned char busnr)
 {
-	struct pci_bus* child;
-	struct list_head *tmp;
+	struct pci_bus *child;
+	struct pci_bus *tmp;
 
 	if(bus->number == busnr)
 		return bus;
 
-	list_for_each(tmp, &bus->children) {
-		child = pci_do_find_bus(pci_bus_b(tmp), busnr);
+	list_for_each_entry(tmp, &bus->children, node) {
+		child = pci_do_find_bus(tmp, busnr);
 		if(child)
 			return child;
 	}
@@ -111,7 +111,7 @@ pci_find_next_bus(const struct pci_bus *from)
 	down_read(&pci_bus_sem);
 	n = from ? from->node.next : pci_root_buses.next;
 	if (n != &pci_root_buses)
-		b = pci_bus_b(n);
+		b = list_entry(n, struct pci_bus, node);
 	up_read(&pci_bus_sem);
 	return b;
 }
diff --git a/include/linux/pci.h b/include/linux/pci.h
index fb57c89..e1b5752 100644
--- a/include/linux/pci.h
+++ b/include/linux/pci.h
@@ -461,7 +461,6 @@ struct pci_bus {
 	unsigned int		is_added:1;
 };
 
-#define pci_bus_b(n)	list_entry(n, struct pci_bus, node)
 #define to_pci_bus(n)	container_of(n, struct pci_bus, dev)
 
 /*
-- 
1.7.1

  parent reply	other threads:[~2014-02-13 13:15 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-02-13 13:13 [PATCH 1/6] PCI,acpiphp: Use list_for_each_entry() for bus traversal Yijing Wang
2014-02-13 13:13 ` [PATCH 2/6] PCI/arm: " Yijing Wang
2014-02-13 14:46   ` Russell King - ARM Linux
2014-02-13 13:14 ` [PATCH 3/6] PCI/drm: " Yijing Wang
2014-02-13 13:14 ` [PATCH 4/6] PCI/powerpc: " Yijing Wang
2014-02-13 13:14 ` [PATCH 5/6] PCI/pcmcia: " Yijing Wang
2014-02-13 13:14 ` Yijing Wang [this message]
2014-02-13 23:54 ` [PATCH 1/6] PCI, acpiphp: " Rafael J. Wysocki
2014-02-14  2:19   ` Yijing Wang
2014-02-14 13:39     ` Rafael J. Wysocki
2014-02-15  0:49       ` Yijing Wang
2014-02-14 18:23 ` [PATCH 1/6] PCI,acpiphp: " Bjorn Helgaas
2014-02-15  0:52   ` [PATCH 1/6] PCI, acpiphp: " Yijing Wang

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1392297243-61848-6-git-send-email-wangyijing@huawei.com \
    --to=wangyijing@huawei.com \
    --cc=airlied@linux.ie \
    --cc=bhelgaas@google.com \
    --cc=dri-devel@lists.freedesktop.org \
    --cc=guohanjun@huawei.com \
    --cc=linux-pci@vger.kernel.org \
    --cc=linux-pcmcia@lists.infradead.org \
    --cc=linux@arm.linux.org.uk \
    --cc=linuxppc-dev@lists.ozlabs.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).