aboutsummaryrefslogtreecommitdiffstats
path: root/drivers
diff options
context:
space:
mode:
Diffstat (limited to 'drivers')
-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)