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>
This commit is contained in:
Родитель
560698e9d2
Коммит
94e6a9b930
|
@ -108,12 +108,12 @@ static bool pcie_ari_disabled;
|
||||||
*/
|
*/
|
||||||
unsigned char pci_bus_max_busnr(struct pci_bus* bus)
|
unsigned char pci_bus_max_busnr(struct pci_bus* bus)
|
||||||
{
|
{
|
||||||
struct list_head *tmp;
|
struct pci_bus *tmp;
|
||||||
unsigned char max, n;
|
unsigned char max, n;
|
||||||
|
|
||||||
max = bus->busn_res.end;
|
max = bus->busn_res.end;
|
||||||
list_for_each(tmp, &bus->children) {
|
list_for_each_entry(tmp, &bus->children, node) {
|
||||||
n = pci_bus_max_busnr(pci_bus_b(tmp));
|
n = pci_bus_max_busnr(tmp);
|
||||||
if(n > max)
|
if(n > max)
|
||||||
max = n;
|
max = n;
|
||||||
}
|
}
|
||||||
|
|
|
@ -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)
|
static struct pci_bus *pci_do_find_bus(struct pci_bus *bus, unsigned char busnr)
|
||||||
{
|
{
|
||||||
struct pci_bus* child;
|
struct pci_bus *child;
|
||||||
struct list_head *tmp;
|
struct pci_bus *tmp;
|
||||||
|
|
||||||
if(bus->number == busnr)
|
if(bus->number == busnr)
|
||||||
return bus;
|
return bus;
|
||||||
|
|
||||||
list_for_each(tmp, &bus->children) {
|
list_for_each_entry(tmp, &bus->children, node) {
|
||||||
child = pci_do_find_bus(pci_bus_b(tmp), busnr);
|
child = pci_do_find_bus(tmp, busnr);
|
||||||
if(child)
|
if(child)
|
||||||
return child;
|
return child;
|
||||||
}
|
}
|
||||||
|
@ -111,7 +111,7 @@ pci_find_next_bus(const struct pci_bus *from)
|
||||||
down_read(&pci_bus_sem);
|
down_read(&pci_bus_sem);
|
||||||
n = from ? from->node.next : pci_root_buses.next;
|
n = from ? from->node.next : pci_root_buses.next;
|
||||||
if (n != &pci_root_buses)
|
if (n != &pci_root_buses)
|
||||||
b = pci_bus_b(n);
|
b = list_entry(n, struct pci_bus, node);
|
||||||
up_read(&pci_bus_sem);
|
up_read(&pci_bus_sem);
|
||||||
return b;
|
return b;
|
||||||
}
|
}
|
||||||
|
|
|
@ -461,7 +461,6 @@ struct pci_bus {
|
||||||
unsigned int is_added:1;
|
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)
|
#define to_pci_bus(n) container_of(n, struct pci_bus, dev)
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
|
Загрузка…
Ссылка в новой задаче