diff options
author | linas@austin.ibm.com <linas@austin.ibm.com> | 2005-12-01 19:59:58 -0500 |
---|---|---|
committer | Greg Kroah-Hartman <gregkh@suse.de> | 2006-01-09 15:13:18 -0500 |
commit | cd5b50be8d8e8e6170da3a261fc625fd603f9dc4 (patch) | |
tree | ec3c36ffc5a6e90389ba8bd0ef252bb5a058b0af | |
parent | d681db4aed4453c7d34adfbb64956271186514e9 (diff) |
[PATCH] PCI Hotplug/powerpc: more removal of duplicated code
The RPAPHP code contains two routines that appear to be gratuitous copies
of very similar pci code. In particular,
rpaphp_claim_resource ~~ pci_claim_resource
(there is a minor, non-functional difference)
rpadlpar_claim_one_bus == pcibios_claim_one_bus
(the code is identical)
This patch removes the rpaphp versions of the code.
Signed-off-by: Linas Vepstas <linas@austin.ibm.com>
Acked-by: John Rose <johnrose@austin.ibm.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
-rw-r--r-- | drivers/pci/hotplug/rpadlpar_core.c | 24 | ||||
-rw-r--r-- | drivers/pci/hotplug/rpaphp_pci.c | 24 |
2 files changed, 2 insertions, 46 deletions
diff --git a/drivers/pci/hotplug/rpadlpar_core.c b/drivers/pci/hotplug/rpadlpar_core.c index 0173641c4149..7d93dbaf628d 100644 --- a/drivers/pci/hotplug/rpadlpar_core.c +++ b/drivers/pci/hotplug/rpadlpar_core.c | |||
@@ -112,28 +112,6 @@ static struct slot *find_slot(struct device_node *dn) | |||
112 | return NULL; | 112 | return NULL; |
113 | } | 113 | } |
114 | 114 | ||
115 | static void rpadlpar_claim_one_bus(struct pci_bus *b) | ||
116 | { | ||
117 | struct list_head *ld; | ||
118 | struct pci_bus *child_bus; | ||
119 | |||
120 | for (ld = b->devices.next; ld != &b->devices; ld = ld->next) { | ||
121 | struct pci_dev *dev = pci_dev_b(ld); | ||
122 | int i; | ||
123 | |||
124 | for (i = 0; i < PCI_NUM_RESOURCES; i++) { | ||
125 | struct resource *r = &dev->resource[i]; | ||
126 | |||
127 | if (r->parent || !r->start || !r->flags) | ||
128 | continue; | ||
129 | rpaphp_claim_resource(dev, i); | ||
130 | } | ||
131 | } | ||
132 | |||
133 | list_for_each_entry(child_bus, &b->children, node) | ||
134 | rpadlpar_claim_one_bus(child_bus); | ||
135 | } | ||
136 | |||
137 | static struct pci_dev *dlpar_find_new_dev(struct pci_bus *parent, | 115 | static struct pci_dev *dlpar_find_new_dev(struct pci_bus *parent, |
138 | struct device_node *dev_dn) | 116 | struct device_node *dev_dn) |
139 | { | 117 | { |
@@ -171,7 +149,7 @@ static struct pci_dev *dlpar_pci_add_bus(struct device_node *dn) | |||
171 | rpaphp_init_new_devs(dev->subordinate); | 149 | rpaphp_init_new_devs(dev->subordinate); |
172 | 150 | ||
173 | /* Claim new bus resources */ | 151 | /* Claim new bus resources */ |
174 | rpadlpar_claim_one_bus(dev->bus); | 152 | pcibios_claim_one_bus(dev->bus); |
175 | 153 | ||
176 | /* ioremap() for child bus, which may or may not succeed */ | 154 | /* ioremap() for child bus, which may or may not succeed */ |
177 | (void) remap_bus_range(dev->bus); | 155 | (void) remap_bus_range(dev->bus); |
diff --git a/drivers/pci/hotplug/rpaphp_pci.c b/drivers/pci/hotplug/rpaphp_pci.c index fc2368710cf7..6f21c73be3c0 100644 --- a/drivers/pci/hotplug/rpaphp_pci.c +++ b/drivers/pci/hotplug/rpaphp_pci.c | |||
@@ -62,28 +62,6 @@ struct pci_bus *rpaphp_find_pci_bus(struct device_node *dn) | |||
62 | } | 62 | } |
63 | EXPORT_SYMBOL_GPL(rpaphp_find_pci_bus); | 63 | EXPORT_SYMBOL_GPL(rpaphp_find_pci_bus); |
64 | 64 | ||
65 | int rpaphp_claim_resource(struct pci_dev *dev, int resource) | ||
66 | { | ||
67 | struct resource *res = &dev->resource[resource]; | ||
68 | struct resource *root = pci_find_parent_resource(dev, res); | ||
69 | char *dtype = resource < PCI_BRIDGE_RESOURCES ? "device" : "bridge"; | ||
70 | int err = -EINVAL; | ||
71 | |||
72 | if (root != NULL) { | ||
73 | err = request_resource(root, res); | ||
74 | } | ||
75 | |||
76 | if (err) { | ||
77 | err("PCI: %s region %d of %s %s [%lx:%lx]\n", | ||
78 | root ? "Address space collision on" : | ||
79 | "No parent found for", | ||
80 | resource, dtype, pci_name(dev), res->start, res->end); | ||
81 | } | ||
82 | return err; | ||
83 | } | ||
84 | |||
85 | EXPORT_SYMBOL_GPL(rpaphp_claim_resource); | ||
86 | |||
87 | static int rpaphp_get_sensor_state(struct slot *slot, int *state) | 65 | static int rpaphp_get_sensor_state(struct slot *slot, int *state) |
88 | { | 66 | { |
89 | int rc; | 67 | int rc; |
@@ -177,7 +155,7 @@ void rpaphp_fixup_new_pci_devices(struct pci_bus *bus, int fix_bus) | |||
177 | 155 | ||
178 | if (r->parent || !r->start || !r->flags) | 156 | if (r->parent || !r->start || !r->flags) |
179 | continue; | 157 | continue; |
180 | rpaphp_claim_resource(dev, i); | 158 | pci_claim_resource(dev, i); |
181 | } | 159 | } |
182 | } | 160 | } |
183 | } | 161 | } |