[PATCH 10/21] PCI: Conver register_pci_controller() to use a loop

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Conver register_pci_controller() to use a loop. No functional change
intended.

Signed-off-by: Andrey Smirnov <andrew.smirnov@xxxxxxxxx>
---
 drivers/pci/pci.c | 17 +++--------------
 1 file changed, 3 insertions(+), 14 deletions(-)

diff --git a/drivers/pci/pci.c b/drivers/pci/pci.c
index 3e249abe4f..e1c059f2a9 100644
--- a/drivers/pci/pci.c
+++ b/drivers/pci/pci.c
@@ -42,6 +42,7 @@ static void pci_bus_register_devices(struct pci_bus *bus)
 void register_pci_controller(struct pci_controller *hose)
 {
 	struct pci_bus *bus;
+	int r;
 
 	*hose_tail = hose;
 	hose_tail = &hose->next;
@@ -59,20 +60,8 @@ void register_pci_controller(struct pci_controller *hose)
 	if (hose->set_busno)
 		hose->set_busno(hose, bus->number);
 
-	if (bus->resource[PCI_BUS_RESOURCE_MEM])
-		last[PCI_BUS_RESOURCE_MEM] = bus->resource[PCI_BUS_RESOURCE_MEM]->start;
-	else
-		last[PCI_BUS_RESOURCE_MEM] = 0;
-
-	if (bus->resource[PCI_BUS_RESOURCE_MEM_PREF])
-		last[PCI_BUS_RESOURCE_MEM_PREF] = bus->resource[PCI_BUS_RESOURCE_MEM_PREF]->start;
-	else
-		last[PCI_BUS_RESOURCE_MEM_PREF] = 0;
-
-	if (bus->resource[PCI_BUS_RESOURCE_IO])
-		last[PCI_BUS_RESOURCE_IO] = bus->resource[PCI_BUS_RESOURCE_IO]->start;
-	else
-		last[PCI_BUS_RESOURCE_IO] = 0;
+	for (r = PCI_BUS_RESOURCE_IO; r <= PCI_BUS_RESOURCE_MEM_PREF; r++)
+		last[r] = bus->resource[r] ? bus->resource[r]->start : 0;
 
 	pci_scan_bus(bus);
 	pci_bus_register_devices(bus);
-- 
2.20.1


_______________________________________________
barebox mailing list
barebox@xxxxxxxxxxxxxxxxxxx
http://lists.infradead.org/mailman/listinfo/barebox



[Index of Archives]     [Linux Embedded]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]     [XFree86]

  Powered by Linux