Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

powerpc/PCI: Use list_for_each_entry() for bus traversal

Replace list_for_each() + pci_bus_b() with list_for_each_entry().

Signed-off-by: Yijing Wang <wangyijing@huawei.com>
Signed-off-by: Bjorn Helgaas <bhelgaas@google.com>

authored by

Yijing Wang and committed by
Bjorn Helgaas
3bc95598 59c1ad3b

+4 -6
+1 -3
arch/powerpc/kernel/pci_64.c
··· 208 208 unsigned long in_devfn) 209 209 { 210 210 struct pci_controller* hose; 211 - struct list_head *ln; 212 211 struct pci_bus *bus = NULL; 213 212 struct device_node *hose_node; 214 213 ··· 229 230 * used on pre-domains setup. We return the first match 230 231 */ 231 232 232 - for (ln = pci_root_buses.next; ln != &pci_root_buses; ln = ln->next) { 233 - bus = pci_bus_b(ln); 233 + list_for_each_entry(bus, &pci_root_buses, node) { 234 234 if (in_bus >= bus->number && in_bus <= bus->busn_res.end) 235 235 break; 236 236 bus = NULL;
+3 -3
arch/powerpc/platforms/pseries/pci_dlpar.c
··· 37 37 struct device_node *dn) 38 38 { 39 39 struct pci_bus *child = NULL; 40 - struct list_head *tmp; 40 + struct pci_bus *tmp; 41 41 struct device_node *busdn; 42 42 43 43 busdn = pci_bus_to_OF_node(bus); 44 44 if (busdn == dn) 45 45 return bus; 46 46 47 - list_for_each(tmp, &bus->children) { 48 - child = find_bus_among_children(pci_bus_b(tmp), dn); 47 + list_for_each_entry(tmp, &bus->children, node) { 48 + child = find_bus_among_children(tmp, dn); 49 49 if (child) 50 50 break; 51 51 };