Home Home > GIT Browse
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPaul Mackerras <paulus@samba.org>2004-08-23 09:39:00 -0700
committerLinus Torvalds <torvalds@ppc970.osdl.org>2004-08-23 09:39:00 -0700
commitfae337c7924acd7949cde0dc857e47a32ab2fbd9 (patch)
tree1cdb6855c70a74ca5047720850538a7498807feb
parentd613adcd449b6035dcec9cf5cea71ec319dedd1e (diff)
[PATCH] ppc64: use struct list_head for hose_list
This patch changes hose_list from a simple linked list to a "list.h"-style list. This is in preparation for the runtime addition/removal of PCI Host Bridges. Signed-off-by: John Rose <johnrose@austin.ibm.com> Signed-off-by: Paul Mackerras <paulus@samba.org> Signed-off-by: Linus Torvalds <torvalds@osdl.org>
-rw-r--r--arch/ppc64/kernel/pSeries_iommu.c6
-rw-r--r--arch/ppc64/kernel/pSeries_pci.c8
-rw-r--r--arch/ppc64/kernel/pci.c14
-rw-r--r--arch/ppc64/kernel/pci.h4
-rw-r--r--arch/ppc64/kernel/pci_dn.c4
-rw-r--r--arch/ppc64/kernel/pmac_pci.c4
-rw-r--r--include/asm-ppc64/pci-bridge.h2
7 files changed, 20 insertions, 22 deletions
diff --git a/arch/ppc64/kernel/pSeries_iommu.c b/arch/ppc64/kernel/pSeries_iommu.c
index 8a5e165d0226..4639edfb5654 100644
--- a/arch/ppc64/kernel/pSeries_iommu.c
+++ b/arch/ppc64/kernel/pSeries_iommu.c
@@ -90,7 +90,7 @@ static void tce_free_pSeries(struct iommu_table *tbl, long index, long npages)
static void iommu_buses_init(void)
{
- struct pci_controller* phb;
+ struct pci_controller *phb, *tmp;
struct device_node *dn, *first_dn;
int num_slots, num_slots_ilog2;
int first_phb = 1;
@@ -106,10 +106,10 @@ static void iommu_buses_init(void)
else
tcetable_ilog2 = 22;
- /* XXX Should we be using pci_root_buses instead? -ojn
+ /* XXX Should we be using pci_root_buses instead? -ojn
*/
- for (phb=hose_head; phb; phb=phb->next) {
+ list_for_each_entry_safe(phb, tmp, &hose_list, list_node) {
first_dn = ((struct device_node *)phb->arch_data)->child;
/* Carve 2GB into the largest dma_window_size possible */
diff --git a/arch/ppc64/kernel/pSeries_pci.c b/arch/ppc64/kernel/pSeries_pci.c
index 9a47205b960f..a42c90b66127 100644
--- a/arch/ppc64/kernel/pSeries_pci.c
+++ b/arch/ppc64/kernel/pSeries_pci.c
@@ -729,9 +729,9 @@ EXPORT_SYMBOL(remap_bus_range);
static void phbs_fixup_io(void)
{
- struct pci_controller *hose;
+ struct pci_controller *hose, *tmp;
- for (hose=hose_head;hose;hose=hose->next)
+ list_for_each_entry_safe(hose, tmp, &hose_list, list_node)
remap_bus_range(hose->bus);
}
@@ -764,8 +764,8 @@ struct pci_controller*
pci_find_hose_for_OF_device(struct device_node *node)
{
while (node) {
- struct pci_controller *hose;
- for (hose=hose_head;hose;hose=hose->next)
+ struct pci_controller *hose, *tmp;
+ list_for_each_entry_safe(hose, tmp, &hose_list, list_node)
if (hose->arch_data == node)
return hose;
node=node->parent;
diff --git a/arch/ppc64/kernel/pci.c b/arch/ppc64/kernel/pci.c
index 537435329a49..456de1942bd8 100644
--- a/arch/ppc64/kernel/pci.c
+++ b/arch/ppc64/kernel/pci.c
@@ -23,6 +23,7 @@
#include <linux/bootmem.h>
#include <linux/module.h>
#include <linux/mm.h>
+#include <linux/list.h>
#include <asm/processor.h>
#include <asm/io.h>
@@ -57,8 +58,7 @@ unsigned long pci_io_base;
void iSeries_pcibios_init(void);
-struct pci_controller *hose_head;
-struct pci_controller **hose_tail = &hose_head;
+LIST_HEAD(hose_list);
struct pci_dma_ops pci_dma_ops;
EXPORT_SYMBOL(pci_dma_ops);
@@ -221,9 +221,9 @@ pci_alloc_pci_controller(enum phb_types controller_type)
memcpy(hose->what,model,7);
hose->type = controller_type;
hose->global_number = global_phb_number++;
-
- *hose_tail = hose;
- hose_tail = &hose->next;
+
+ list_add_tail(&hose->list_node, &hose_list);
+
return hose;
}
@@ -263,7 +263,7 @@ static void __init pcibios_claim_of_setup(void)
static int __init pcibios_init(void)
{
- struct pci_controller *hose;
+ struct pci_controller *hose, *tmp;
struct pci_bus *bus;
#ifdef CONFIG_PPC_ISERIES
@@ -274,7 +274,7 @@ static int __init pcibios_init(void)
printk("PCI: Probing PCI hardware\n");
/* Scan all of the recorded PCI controllers. */
- for (hose = hose_head; hose; hose = hose->next) {
+ list_for_each_entry_safe(hose, tmp, &hose_list, list_node) {
hose->last_busno = 0xff;
bus = pci_scan_bus(hose->first_busno, hose->ops,
hose->arch_data);
diff --git a/arch/ppc64/kernel/pci.h b/arch/ppc64/kernel/pci.h
index 2ca27ccc7795..9e85ebd483cc 100644
--- a/arch/ppc64/kernel/pci.h
+++ b/arch/ppc64/kernel/pci.h
@@ -17,9 +17,7 @@ extern unsigned long isa_io_base;
extern struct pci_controller* pci_alloc_pci_controller(enum phb_types controller_type);
extern struct pci_controller* pci_find_hose_for_OF_device(struct device_node* node);
-extern struct pci_controller* hose_head;
-extern struct pci_controller** hose_tail;
-
+extern struct list_head hose_list;
extern int global_phb_number;
/*******************************************************************
diff --git a/arch/ppc64/kernel/pci_dn.c b/arch/ppc64/kernel/pci_dn.c
index c771bdc644df..2ef21d7dae41 100644
--- a/arch/ppc64/kernel/pci_dn.c
+++ b/arch/ppc64/kernel/pci_dn.c
@@ -129,10 +129,10 @@ void *traverse_pci_devices(struct device_node *start, traverse_func pre,
*/
static void *traverse_all_pci_devices(traverse_func pre)
{
- struct pci_controller *phb;
+ struct pci_controller *phb, *tmp;
void *ret;
- for (phb = hose_head; phb; phb = phb->next)
+ list_for_each_entry_safe(phb, tmp, &hose_list, list_node)
if ((ret = traverse_pci_devices(phb->arch_data, pre, phb))
!= NULL)
return ret;
diff --git a/arch/ppc64/kernel/pmac_pci.c b/arch/ppc64/kernel/pmac_pci.c
index e6926c0ea9a8..ee6dca896469 100644
--- a/arch/ppc64/kernel/pmac_pci.c
+++ b/arch/ppc64/kernel/pmac_pci.c
@@ -672,9 +672,9 @@ void __init pmac_pcibios_fixup(void)
static void __init pmac_fixup_phb_resources(void)
{
- struct pci_controller *hose;
+ struct pci_controller *hose, *tmp;
- for (hose = hose_head; hose; hose = hose->next) {
+ list_for_each_entry_safe(hose, tmp, &hose_list, list_node) {
unsigned long offset = (unsigned long)hose->io_base_virt - pci_io_base;
hose->io_resource.start += offset;
hose->io_resource.end += offset;
diff --git a/include/asm-ppc64/pci-bridge.h b/include/asm-ppc64/pci-bridge.h
index acb6aff2ada9..745307437359 100644
--- a/include/asm-ppc64/pci-bridge.h
+++ b/include/asm-ppc64/pci-bridge.h
@@ -33,9 +33,9 @@ enum phb_types {
struct pci_controller {
char what[8]; /* Eye catcher */
enum phb_types type; /* Type of hardware */
- struct pci_controller *next;
struct pci_bus *bus;
void *arch_data;
+ struct list_head list_node;
int first_busno;
int last_busno;