aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/acpi/pci_bind.c
diff options
context:
space:
mode:
authorAlexander Chiang <achiang@hp.com>2009-06-10 15:55:25 -0400
committerLen Brown <len.brown@intel.com>2009-06-17 23:22:15 -0400
commitc22d7f5a389dad15de448b142f44e4000b3426f0 (patch)
tree84575f621022d5fc4be515ed7ea384383891cef9 /drivers/acpi/pci_bind.c
parent2f7bbceb5b6aa938024bb4dad93c410fa59ed3b9 (diff)
ACPI: rearrange acpi_pci_bind/acpi_pci_unbind in pci_bind.c
This is a pure code movement patch that does $subject in order to make the following patch easier to read and review. No functional change. Signed-off-by: Alex Chiang <achiang@hp.com> Signed-off-by: Len Brown <len.brown@intel.com>
Diffstat (limited to 'drivers/acpi/pci_bind.c')
-rw-r--r--drivers/acpi/pci_bind.c90
1 files changed, 45 insertions, 45 deletions
diff --git a/drivers/acpi/pci_bind.c b/drivers/acpi/pci_bind.c
index 236765c6017b..c283c29662a7 100644
--- a/drivers/acpi/pci_bind.c
+++ b/drivers/acpi/pci_bind.c
@@ -109,6 +109,51 @@ acpi_status acpi_get_pci_id(acpi_handle handle, struct acpi_pci_id *id)
109 109
110EXPORT_SYMBOL(acpi_get_pci_id); 110EXPORT_SYMBOL(acpi_get_pci_id);
111 111
112static int acpi_pci_unbind(struct acpi_device *device)
113{
114 int result = 0;
115 acpi_status status;
116 struct acpi_pci_data *data;
117 struct acpi_buffer buffer = { ACPI_ALLOCATE_BUFFER, NULL };
118
119
120 if (!device || !device->parent)
121 return -EINVAL;
122
123 status = acpi_get_name(device->handle, ACPI_FULL_PATHNAME, &buffer);
124 if (ACPI_FAILURE(status))
125 return -ENODEV;
126
127 ACPI_DEBUG_PRINT((ACPI_DB_INFO, "Unbinding PCI device [%s]...\n",
128 (char *) buffer.pointer));
129 kfree(buffer.pointer);
130
131 status =
132 acpi_get_data(device->handle, acpi_pci_data_handler,
133 (void **)&data);
134 if (ACPI_FAILURE(status)) {
135 result = -ENODEV;
136 goto end;
137 }
138
139 status = acpi_detach_data(device->handle, acpi_pci_data_handler);
140 if (ACPI_FAILURE(status)) {
141 ACPI_EXCEPTION((AE_INFO, status,
142 "Unable to detach data from device %s",
143 acpi_device_bid(device)));
144 result = -ENODEV;
145 goto end;
146 }
147 if (data->dev->subordinate) {
148 acpi_pci_irq_del_prt(data->id.segment, data->bus->number);
149 }
150 pci_dev_put(data->dev);
151 kfree(data);
152
153 end:
154 return result;
155}
156
112static int acpi_pci_bind(struct acpi_device *device) 157static int acpi_pci_bind(struct acpi_device *device)
113{ 158{
114 int result = 0; 159 int result = 0;
@@ -253,51 +298,6 @@ static int acpi_pci_bind(struct acpi_device *device)
253 return result; 298 return result;
254} 299}
255 300
256static int acpi_pci_unbind(struct acpi_device *device)
257{
258 int result = 0;
259 acpi_status status;
260 struct acpi_pci_data *data;
261 struct acpi_buffer buffer = { ACPI_ALLOCATE_BUFFER, NULL };
262
263
264 if (!device || !device->parent)
265 return -EINVAL;
266
267 status = acpi_get_name(device->handle, ACPI_FULL_PATHNAME, &buffer);
268 if (ACPI_FAILURE(status))
269 return -ENODEV;
270
271 ACPI_DEBUG_PRINT((ACPI_DB_INFO, "Unbinding PCI device [%s]...\n",
272 (char *) buffer.pointer));
273 kfree(buffer.pointer);
274
275 status =
276 acpi_get_data(device->handle, acpi_pci_data_handler,
277 (void **)&data);
278 if (ACPI_FAILURE(status)) {
279 result = -ENODEV;
280 goto end;
281 }
282
283 status = acpi_detach_data(device->handle, acpi_pci_data_handler);
284 if (ACPI_FAILURE(status)) {
285 ACPI_EXCEPTION((AE_INFO, status,
286 "Unable to detach data from device %s",
287 acpi_device_bid(device)));
288 result = -ENODEV;
289 goto end;
290 }
291 if (data->dev->subordinate) {
292 acpi_pci_irq_del_prt(data->id.segment, data->bus->number);
293 }
294 pci_dev_put(data->dev);
295 kfree(data);
296
297 end:
298 return result;
299}
300
301int 301int
302acpi_pci_bind_root(struct acpi_device *device, 302acpi_pci_bind_root(struct acpi_device *device,
303 struct acpi_pci_id *id, struct pci_bus *bus) 303 struct acpi_pci_id *id, struct pci_bus *bus)