aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorBjorn Helgaas <bhelgaas@google.com>2014-02-18 16:33:46 -0500
committerBjorn Helgaas <bhelgaas@google.com>2014-02-18 16:33:46 -0500
commit6354647f55b9848dc9aaa091e2f762ca1a3eb085 (patch)
treecec2c643c1635d92d903444f2e6586eda75110dc
parentc128856b48b1a7132166c6b37a53b086d549fbde (diff)
parent94e6a9b93064b49024b8701d2d81fcb4a821fa09 (diff)
Merge branch 'pci/list-for-each-entry' into next
* pci/list-for-each-entry: PCI: Remove pci_bus_b() and use list_for_each_entry() directly pcmcia: Use list_for_each_entry() for bus traversal powerpc/PCI: Use list_for_each_entry() for bus traversal drm: Use list_for_each_entry() for bus traversal ARM/PCI: Use list_for_each_entry() for bus traversal ACPI / hotplug / PCI: Use list_for_each_entry() for bus traversal
-rw-r--r--arch/arm/kernel/bios32.c7
-rw-r--r--arch/powerpc/kernel/pci_64.c4
-rw-r--r--arch/powerpc/platforms/pseries/pci_dlpar.c6
-rw-r--r--drivers/gpu/drm/drm_fops.c3
-rw-r--r--drivers/pci/hotplug/acpiphp_glue.c6
-rw-r--r--drivers/pci/pci.c6
-rw-r--r--drivers/pci/search.c10
-rw-r--r--drivers/pcmcia/yenta_socket.c18
-rw-r--r--include/linux/pci.h1
9 files changed, 28 insertions, 33 deletions
diff --git a/arch/arm/kernel/bios32.c b/arch/arm/kernel/bios32.c
index 317da88ae65b..004670e97ca8 100644
--- a/arch/arm/kernel/bios32.c
+++ b/arch/arm/kernel/bios32.c
@@ -57,13 +57,10 @@ static void pcibios_bus_report_status(struct pci_bus *bus, u_int status_mask, in
57 57
58void pcibios_report_status(u_int status_mask, int warn) 58void pcibios_report_status(u_int status_mask, int warn)
59{ 59{
60 struct list_head *l; 60 struct pci_bus *bus;
61
62 list_for_each(l, &pci_root_buses) {
63 struct pci_bus *bus = pci_bus_b(l);
64 61
62 list_for_each_entry(bus, &pci_root_buses, node)
65 pcibios_bus_report_status(bus, status_mask, warn); 63 pcibios_bus_report_status(bus, status_mask, warn);
66 }
67} 64}
68 65
69/* 66/*
diff --git a/arch/powerpc/kernel/pci_64.c b/arch/powerpc/kernel/pci_64.c
index a9e311f7a9dd..2a4779091a58 100644
--- a/arch/powerpc/kernel/pci_64.c
+++ b/arch/powerpc/kernel/pci_64.c
@@ -208,7 +208,6 @@ long sys_pciconfig_iobase(long which, unsigned long in_bus,
208 unsigned long in_devfn) 208 unsigned long in_devfn)
209{ 209{
210 struct pci_controller* hose; 210 struct pci_controller* hose;
211 struct list_head *ln;
212 struct pci_bus *bus = NULL; 211 struct pci_bus *bus = NULL;
213 struct device_node *hose_node; 212 struct device_node *hose_node;
214 213
@@ -230,8 +229,7 @@ long sys_pciconfig_iobase(long which, unsigned long in_bus,
230 * used on pre-domains setup. We return the first match 229 * used on pre-domains setup. We return the first match
231 */ 230 */
232 231
233 for (ln = pci_root_buses.next; ln != &pci_root_buses; ln = ln->next) { 232 list_for_each_entry(bus, &pci_root_buses, node) {
234 bus = pci_bus_b(ln);
235 if (in_bus >= bus->number && in_bus <= bus->busn_res.end) 233 if (in_bus >= bus->number && in_bus <= bus->busn_res.end)
236 break; 234 break;
237 bus = NULL; 235 bus = NULL;
diff --git a/arch/powerpc/platforms/pseries/pci_dlpar.c b/arch/powerpc/platforms/pseries/pci_dlpar.c
index efe61374f6ea..203cbf0dc101 100644
--- a/arch/powerpc/platforms/pseries/pci_dlpar.c
+++ b/arch/powerpc/platforms/pseries/pci_dlpar.c
@@ -37,15 +37,15 @@ find_bus_among_children(struct pci_bus *bus,
37 struct device_node *dn) 37 struct device_node *dn)
38{ 38{
39 struct pci_bus *child = NULL; 39 struct pci_bus *child = NULL;
40 struct list_head *tmp; 40 struct pci_bus *tmp;
41 struct device_node *busdn; 41 struct device_node *busdn;
42 42
43 busdn = pci_bus_to_OF_node(bus); 43 busdn = pci_bus_to_OF_node(bus);
44 if (busdn == dn) 44 if (busdn == dn)
45 return bus; 45 return bus;
46 46
47 list_for_each(tmp, &bus->children) { 47 list_for_each_entry(tmp, &bus->children, node) {
48 child = find_bus_among_children(pci_bus_b(tmp), dn); 48 child = find_bus_among_children(tmp, dn);
49 if (child) 49 if (child)
50 break; 50 break;
51 }; 51 };
diff --git a/drivers/gpu/drm/drm_fops.c b/drivers/gpu/drm/drm_fops.c
index 7f2af9aca038..309023f12d7f 100644
--- a/drivers/gpu/drm/drm_fops.c
+++ b/drivers/gpu/drm/drm_fops.c
@@ -319,7 +319,8 @@ static int drm_open_helper(struct inode *inode, struct file *filp,
319 pci_dev_put(pci_dev); 319 pci_dev_put(pci_dev);
320 } 320 }
321 if (!dev->hose) { 321 if (!dev->hose) {
322 struct pci_bus *b = pci_bus_b(pci_root_buses.next); 322 struct pci_bus *b = list_entry(pci_root_buses.next,
323 struct pci_bus, node);
323 if (b) 324 if (b)
324 dev->hose = b->sysdata; 325 dev->hose = b->sysdata;
325 } 326 }
diff --git a/drivers/pci/hotplug/acpiphp_glue.c b/drivers/pci/hotplug/acpiphp_glue.c
index cd929aed3613..aee6a0acbbe9 100644
--- a/drivers/pci/hotplug/acpiphp_glue.c
+++ b/drivers/pci/hotplug/acpiphp_glue.c
@@ -450,7 +450,7 @@ static void cleanup_bridge(struct acpiphp_bridge *bridge)
450 */ 450 */
451static unsigned char acpiphp_max_busnr(struct pci_bus *bus) 451static unsigned char acpiphp_max_busnr(struct pci_bus *bus)
452{ 452{
453 struct list_head *tmp; 453 struct pci_bus *tmp;
454 unsigned char max, n; 454 unsigned char max, n;
455 455
456 /* 456 /*
@@ -463,8 +463,8 @@ static unsigned char acpiphp_max_busnr(struct pci_bus *bus)
463 */ 463 */
464 max = bus->busn_res.start; 464 max = bus->busn_res.start;
465 465
466 list_for_each(tmp, &bus->children) { 466 list_for_each_entry(tmp, &bus->children, node) {
467 n = pci_bus_max_busnr(pci_bus_b(tmp)); 467 n = pci_bus_max_busnr(tmp);
468 if (n > max) 468 if (n > max)
469 max = n; 469 max = n;
470 } 470 }
diff --git a/drivers/pci/pci.c b/drivers/pci/pci.c
index b89502ff3139..e4d45d27f288 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/drivers/pcmcia/yenta_socket.c b/drivers/pcmcia/yenta_socket.c
index 8485761e76af..946f90ef6020 100644
--- a/drivers/pcmcia/yenta_socket.c
+++ b/drivers/pcmcia/yenta_socket.c
@@ -1076,7 +1076,7 @@ static void yenta_config_init(struct yenta_socket *socket)
1076 */ 1076 */
1077static void yenta_fixup_parent_bridge(struct pci_bus *cardbus_bridge) 1077static void yenta_fixup_parent_bridge(struct pci_bus *cardbus_bridge)
1078{ 1078{
1079 struct list_head *tmp; 1079 struct pci_bus *sibling;
1080 unsigned char upper_limit; 1080 unsigned char upper_limit;
1081 /* 1081 /*
1082 * We only check and fix the parent bridge: All systems which need 1082 * We only check and fix the parent bridge: All systems which need
@@ -1095,18 +1095,18 @@ static void yenta_fixup_parent_bridge(struct pci_bus *cardbus_bridge)
1095 /* stay within the limits of the bus range of the parent: */ 1095 /* stay within the limits of the bus range of the parent: */
1096 upper_limit = bridge_to_fix->parent->busn_res.end; 1096 upper_limit = bridge_to_fix->parent->busn_res.end;
1097 1097
1098 /* check the bus ranges of all silbling bridges to prevent overlap */ 1098 /* check the bus ranges of all sibling bridges to prevent overlap */
1099 list_for_each(tmp, &bridge_to_fix->parent->children) { 1099 list_for_each_entry(sibling, &bridge_to_fix->parent->children,
1100 struct pci_bus *silbling = pci_bus_b(tmp); 1100 node) {
1101 /* 1101 /*
1102 * If the silbling has a higher secondary bus number 1102 * If the sibling has a higher secondary bus number
1103 * and it's secondary is equal or smaller than our 1103 * and it's secondary is equal or smaller than our
1104 * current upper limit, set the new upper limit to 1104 * current upper limit, set the new upper limit to
1105 * the bus number below the silbling's range: 1105 * the bus number below the sibling's range:
1106 */ 1106 */
1107 if (silbling->busn_res.start > bridge_to_fix->busn_res.end 1107 if (sibling->busn_res.start > bridge_to_fix->busn_res.end
1108 && silbling->busn_res.start <= upper_limit) 1108 && sibling->busn_res.start <= upper_limit)
1109 upper_limit = silbling->busn_res.start - 1; 1109 upper_limit = sibling->busn_res.start - 1;
1110 } 1110 }
1111 1111
1112 /* Show that the wanted subordinate number is not possible: */ 1112 /* Show that the wanted subordinate number is not possible: */
diff --git a/include/linux/pci.h b/include/linux/pci.h
index 1e26fc602adc..27b1b9b6dba5 100644
--- a/include/linux/pci.h
+++ b/include/linux/pci.h
@@ -463,7 +463,6 @@ struct pci_bus {
463 unsigned int is_added:1; 463 unsigned int is_added:1;
464}; 464};
465 465
466#define pci_bus_b(n) list_entry(n, struct pci_bus, node)
467#define to_pci_bus(n) container_of(n, struct pci_bus, dev) 466#define to_pci_bus(n) container_of(n, struct pci_bus, dev)
468 467
469/* 468/*