aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorYijing Wang <wangyijing@huawei.com>2014-02-13 08:14:03 -0500
committerBjorn Helgaas <bhelgaas@google.com>2014-02-14 14:32:26 -0500
commit94e6a9b93064b49024b8701d2d81fcb4a821fa09 (patch)
treeb37fc0e841611cdd529c092184857e303e8aee66
parent560698e9d2ca77d0adb07f3cf0ebfe519859c528 (diff)
PCI: Remove pci_bus_b() and use list_for_each_entry() directly
Replace list_for_each() with list_for_each_entry(), which means we no longer need pci_bus_b() and can remove it. Signed-off-by: Yijing Wang <wangyijing@huawei.com> Signed-off-by: Bjorn Helgaas <bhelgaas@google.com>
-rw-r--r--drivers/pci/pci.c6
-rw-r--r--drivers/pci/search.c10
-rw-r--r--include/linux/pci.h1
3 files changed, 8 insertions, 9 deletions
diff --git a/drivers/pci/pci.c b/drivers/pci/pci.c
index 1febe90831b4..6f5ed88ca126 100644
--- a/drivers/pci/pci.c
+++ b/drivers/pci/pci.c
@@ -108,12 +108,12 @@ static bool pcie_ari_disabled;
108 */ 108 */
109unsigned char pci_bus_max_busnr(struct pci_bus* bus) 109unsigned char pci_bus_max_busnr(struct pci_bus* bus)
110{ 110{
111 struct list_head *tmp; 111 struct pci_bus *tmp;
112 unsigned char max, n; 112 unsigned char max, n;
113 113
114 max = bus->busn_res.end; 114 max = bus->busn_res.end;
115 list_for_each(tmp, &bus->children) { 115 list_for_each_entry(tmp, &bus->children, node) {
116 n = pci_bus_max_busnr(pci_bus_b(tmp)); 116 n = pci_bus_max_busnr(tmp);
117 if(n > max) 117 if(n > max)
118 max = n; 118 max = n;
119 } 119 }
diff --git a/drivers/pci/search.c b/drivers/pci/search.c
index 3ff2ac7c14e2..4a1b972efe7f 100644
--- a/drivers/pci/search.c
+++ b/drivers/pci/search.c
@@ -54,14 +54,14 @@ pci_find_upstream_pcie_bridge(struct pci_dev *pdev)
54 54
55static struct pci_bus *pci_do_find_bus(struct pci_bus *bus, unsigned char busnr) 55static struct pci_bus *pci_do_find_bus(struct pci_bus *bus, unsigned char busnr)
56{ 56{
57 struct pci_bus* child; 57 struct pci_bus *child;
58 struct list_head *tmp; 58 struct pci_bus *tmp;
59 59
60 if(bus->number == busnr) 60 if(bus->number == busnr)
61 return bus; 61 return bus;
62 62
63 list_for_each(tmp, &bus->children) { 63 list_for_each_entry(tmp, &bus->children, node) {
64 child = pci_do_find_bus(pci_bus_b(tmp), busnr); 64 child = pci_do_find_bus(tmp, busnr);
65 if(child) 65 if(child)
66 return child; 66 return child;
67 } 67 }
@@ -111,7 +111,7 @@ pci_find_next_bus(const struct pci_bus *from)
111 down_read(&pci_bus_sem); 111 down_read(&pci_bus_sem);
112 n = from ? from->node.next : pci_root_buses.next; 112 n = from ? from->node.next : pci_root_buses.next;
113 if (n != &pci_root_buses) 113 if (n != &pci_root_buses)
114 b = pci_bus_b(n); 114 b = list_entry(n, struct pci_bus, node);
115 up_read(&pci_bus_sem); 115 up_read(&pci_bus_sem);
116 return b; 116 return b;
117} 117}
diff --git a/include/linux/pci.h b/include/linux/pci.h
index fb57c892b214..e1b5752f3b1b 100644
--- a/include/linux/pci.h
+++ b/include/linux/pci.h
@@ -461,7 +461,6 @@ struct pci_bus {
461 unsigned int is_added:1; 461 unsigned int is_added:1;
462}; 462};
463 463
464#define pci_bus_b(n) list_entry(n, struct pci_bus, node)
465#define to_pci_bus(n) container_of(n, struct pci_bus, dev) 464#define to_pci_bus(n) container_of(n, struct pci_bus, dev)
466 465
467/* 466/*