Commit 23dac14d authored by Paul Burton's avatar Paul Burton Committed by Ralf Baechle

MIPS: PCI: Use struct list_head lists

Rather than open-coding a linked list implementation, make use of the
one in linux/list.h.
Signed-off-by: default avatarPaul Burton <paul.burton@imgtec.com>
Cc: linux-mips@linux-mips.org
Patchwork: https://patchwork.linux-mips.org/patch/14340/Signed-off-by: default avatarRalf Baechle <ralf@linux-mips.org>
parent d05c5130
...@@ -17,6 +17,7 @@ ...@@ -17,6 +17,7 @@
*/ */
#include <linux/ioport.h> #include <linux/ioport.h>
#include <linux/list.h>
#include <linux/of.h> #include <linux/of.h>
/* /*
...@@ -25,7 +26,7 @@ ...@@ -25,7 +26,7 @@
* single controller supporting multiple channels. * single controller supporting multiple channels.
*/ */
struct pci_controller { struct pci_controller {
struct pci_controller *next; struct list_head list;
struct pci_bus *bus; struct pci_bus *bus;
struct device_node *of_node; struct device_node *of_node;
......
...@@ -28,8 +28,7 @@ ...@@ -28,8 +28,7 @@
/* /*
* The PCI controller list. * The PCI controller list.
*/ */
static LIST_HEAD(controllers);
static struct pci_controller *hose_head, **hose_tail = &hose_head;
unsigned long PCIBIOS_MIN_IO; unsigned long PCIBIOS_MIN_IO;
unsigned long PCIBIOS_MIN_MEM; unsigned long PCIBIOS_MIN_MEM;
...@@ -193,8 +192,8 @@ void register_pci_controller(struct pci_controller *hose) ...@@ -193,8 +192,8 @@ void register_pci_controller(struct pci_controller *hose)
goto out; goto out;
} }
*hose_tail = hose; INIT_LIST_HEAD(&hose->list);
hose_tail = &hose->next; list_add(&hose->list, &controllers);
/* /*
* Do not panic here but later - this might happen before console init. * Do not panic here but later - this might happen before console init.
...@@ -248,7 +247,7 @@ static int __init pcibios_init(void) ...@@ -248,7 +247,7 @@ static int __init pcibios_init(void)
pcibios_set_cache_line_size(); pcibios_set_cache_line_size();
/* Scan all of the recorded PCI controllers. */ /* Scan all of the recorded PCI controllers. */
for (hose = hose_head; hose; hose = hose->next) list_for_each_entry(hose, &controllers, list)
pcibios_scanbus(hose); pcibios_scanbus(hose);
pci_fixup_irqs(pci_common_swizzle, pcibios_map_irq); pci_fixup_irqs(pci_common_swizzle, pcibios_map_irq);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment