diff options
author | Bjorn Helgaas <bhelgaas@google.com> | 2012-10-30 02:24:06 -0400 |
---|---|---|
committer | Bjorn Helgaas <bhelgaas@google.com> | 2012-11-05 17:54:22 -0500 |
commit | 79c4412298771b8996302806abc8a11e760da9b3 (patch) | |
tree | c2c43b5ddc39a749ec4d48cff023c3d20eb78c28 | |
parent | f426cef3bc58806284e0fee55d29262b10279f9c (diff) |
ACPI: Pass segment/bus to _PRT add/del so they don't depend on pci_bus
This effectively reverts 859a3f86ca8 ("ACPI: simplify
acpi_pci_irq_add_prt() API") and d9efae3688a ("ACPI: simplify
acpi_pci_irq_del_prt() API").
The reason is to disentangle these routines from the struct pci_bus.
We want to be able to add the _PRT before the struct pci_bus
exists, and delete the _PRT after we've removed the pci_bus.
Signed-off-by: Bjorn Helgaas <bhelgaas@google.com>
Signed-off-by: Taku Izumi <izumi.taku@jp.fujitsu.com>
-rw-r--r-- | drivers/acpi/pci_bind.c | 10 | ||||
-rw-r--r-- | drivers/acpi/pci_irq.c | 17 | ||||
-rw-r--r-- | drivers/acpi/pci_root.c | 5 | ||||
-rw-r--r-- | include/acpi/acpi_drivers.h | 4 |
4 files changed, 18 insertions, 18 deletions
diff --git a/drivers/acpi/pci_bind.c b/drivers/acpi/pci_bind.c index 2ef04098cc1d..911144b22c89 100644 --- a/drivers/acpi/pci_bind.c +++ b/drivers/acpi/pci_bind.c | |||
@@ -49,7 +49,7 @@ static int acpi_pci_unbind(struct acpi_device *device) | |||
49 | if (!dev->subordinate) | 49 | if (!dev->subordinate) |
50 | goto out; | 50 | goto out; |
51 | 51 | ||
52 | acpi_pci_irq_del_prt(dev->subordinate); | 52 | acpi_pci_irq_del_prt(pci_domain_nr(dev->bus), dev->subordinate->number); |
53 | 53 | ||
54 | device->ops.bind = NULL; | 54 | device->ops.bind = NULL; |
55 | device->ops.unbind = NULL; | 55 | device->ops.unbind = NULL; |
@@ -63,7 +63,7 @@ static int acpi_pci_bind(struct acpi_device *device) | |||
63 | { | 63 | { |
64 | acpi_status status; | 64 | acpi_status status; |
65 | acpi_handle handle; | 65 | acpi_handle handle; |
66 | struct pci_bus *bus; | 66 | unsigned char bus; |
67 | struct pci_dev *dev; | 67 | struct pci_dev *dev; |
68 | 68 | ||
69 | dev = acpi_get_pci_dev(device->handle); | 69 | dev = acpi_get_pci_dev(device->handle); |
@@ -100,11 +100,11 @@ static int acpi_pci_bind(struct acpi_device *device) | |||
100 | goto out; | 100 | goto out; |
101 | 101 | ||
102 | if (dev->subordinate) | 102 | if (dev->subordinate) |
103 | bus = dev->subordinate; | 103 | bus = dev->subordinate->number; |
104 | else | 104 | else |
105 | bus = dev->bus; | 105 | bus = dev->bus->number; |
106 | 106 | ||
107 | acpi_pci_irq_add_prt(device->handle, bus); | 107 | acpi_pci_irq_add_prt(device->handle, pci_domain_nr(dev->bus), bus); |
108 | 108 | ||
109 | out: | 109 | out: |
110 | pci_dev_put(dev); | 110 | pci_dev_put(dev); |
diff --git a/drivers/acpi/pci_irq.c b/drivers/acpi/pci_irq.c index 0eefa12e648c..8835cc38aa30 100644 --- a/drivers/acpi/pci_irq.c +++ b/drivers/acpi/pci_irq.c | |||
@@ -184,7 +184,7 @@ static void do_prt_fixups(struct acpi_prt_entry *entry, | |||
184 | } | 184 | } |
185 | } | 185 | } |
186 | 186 | ||
187 | static int acpi_pci_irq_add_entry(acpi_handle handle, struct pci_bus *bus, | 187 | static int acpi_pci_irq_add_entry(acpi_handle handle, int segment, int bus, |
188 | struct acpi_pci_routing_table *prt) | 188 | struct acpi_pci_routing_table *prt) |
189 | { | 189 | { |
190 | struct acpi_prt_entry *entry; | 190 | struct acpi_prt_entry *entry; |
@@ -198,8 +198,8 @@ static int acpi_pci_irq_add_entry(acpi_handle handle, struct pci_bus *bus, | |||
198 | * 1=INTA, 2=INTB. We use the PCI encoding throughout, so convert | 198 | * 1=INTA, 2=INTB. We use the PCI encoding throughout, so convert |
199 | * it here. | 199 | * it here. |
200 | */ | 200 | */ |
201 | entry->id.segment = pci_domain_nr(bus); | 201 | entry->id.segment = segment; |
202 | entry->id.bus = bus->number; | 202 | entry->id.bus = bus; |
203 | entry->id.device = (prt->address >> 16) & 0xFFFF; | 203 | entry->id.device = (prt->address >> 16) & 0xFFFF; |
204 | entry->pin = prt->pin + 1; | 204 | entry->pin = prt->pin + 1; |
205 | 205 | ||
@@ -244,7 +244,7 @@ static int acpi_pci_irq_add_entry(acpi_handle handle, struct pci_bus *bus, | |||
244 | return 0; | 244 | return 0; |
245 | } | 245 | } |
246 | 246 | ||
247 | int acpi_pci_irq_add_prt(acpi_handle handle, struct pci_bus *bus) | 247 | int acpi_pci_irq_add_prt(acpi_handle handle, int segment, int bus) |
248 | { | 248 | { |
249 | acpi_status status; | 249 | acpi_status status; |
250 | struct acpi_buffer buffer = { ACPI_ALLOCATE_BUFFER, NULL }; | 250 | struct acpi_buffer buffer = { ACPI_ALLOCATE_BUFFER, NULL }; |
@@ -273,7 +273,7 @@ int acpi_pci_irq_add_prt(acpi_handle handle, struct pci_bus *bus) | |||
273 | 273 | ||
274 | entry = buffer.pointer; | 274 | entry = buffer.pointer; |
275 | while (entry && (entry->length > 0)) { | 275 | while (entry && (entry->length > 0)) { |
276 | acpi_pci_irq_add_entry(handle, bus, entry); | 276 | acpi_pci_irq_add_entry(handle, segment, bus, entry); |
277 | entry = (struct acpi_pci_routing_table *) | 277 | entry = (struct acpi_pci_routing_table *) |
278 | ((unsigned long)entry + entry->length); | 278 | ((unsigned long)entry + entry->length); |
279 | } | 279 | } |
@@ -282,17 +282,16 @@ int acpi_pci_irq_add_prt(acpi_handle handle, struct pci_bus *bus) | |||
282 | return 0; | 282 | return 0; |
283 | } | 283 | } |
284 | 284 | ||
285 | void acpi_pci_irq_del_prt(struct pci_bus *bus) | 285 | void acpi_pci_irq_del_prt(int segment, int bus) |
286 | { | 286 | { |
287 | struct acpi_prt_entry *entry, *tmp; | 287 | struct acpi_prt_entry *entry, *tmp; |
288 | 288 | ||
289 | printk(KERN_DEBUG | 289 | printk(KERN_DEBUG |
290 | "ACPI: Delete PCI Interrupt Routing Table for %04x:%02x\n", | 290 | "ACPI: Delete PCI Interrupt Routing Table for %04x:%02x\n", |
291 | pci_domain_nr(bus), bus->number); | 291 | segment, bus); |
292 | spin_lock(&acpi_prt_lock); | 292 | spin_lock(&acpi_prt_lock); |
293 | list_for_each_entry_safe(entry, tmp, &acpi_prt_list, list) { | 293 | list_for_each_entry_safe(entry, tmp, &acpi_prt_list, list) { |
294 | if (pci_domain_nr(bus) == entry->id.segment | 294 | if (segment == entry->id.segment && bus == entry->id.bus) { |
295 | && bus->number == entry->id.bus) { | ||
296 | list_del(&entry->list); | 295 | list_del(&entry->list); |
297 | kfree(entry); | 296 | kfree(entry); |
298 | } | 297 | } |
diff --git a/drivers/acpi/pci_root.c b/drivers/acpi/pci_root.c index 012f40d1d75d..db31edaab9ce 100644 --- a/drivers/acpi/pci_root.c +++ b/drivers/acpi/pci_root.c | |||
@@ -554,7 +554,8 @@ static int __devinit acpi_pci_root_add(struct acpi_device *device) | |||
554 | */ | 554 | */ |
555 | status = acpi_get_handle(device->handle, METHOD_NAME__PRT, &handle); | 555 | status = acpi_get_handle(device->handle, METHOD_NAME__PRT, &handle); |
556 | if (ACPI_SUCCESS(status)) | 556 | if (ACPI_SUCCESS(status)) |
557 | result = acpi_pci_irq_add_prt(device->handle, root->bus); | 557 | result = acpi_pci_irq_add_prt(device->handle, root->segment, |
558 | root->secondary.start); | ||
558 | 559 | ||
559 | /* | 560 | /* |
560 | * Scan and bind all _ADR-Based Devices | 561 | * Scan and bind all _ADR-Based Devices |
@@ -682,7 +683,7 @@ static int acpi_pci_root_remove(struct acpi_device *device, int type) | |||
682 | 683 | ||
683 | status = acpi_get_handle(device->handle, METHOD_NAME__PRT, &handle); | 684 | status = acpi_get_handle(device->handle, METHOD_NAME__PRT, &handle); |
684 | if (ACPI_SUCCESS(status)) | 685 | if (ACPI_SUCCESS(status)) |
685 | acpi_pci_irq_del_prt(root->bus); | 686 | acpi_pci_irq_del_prt(root->segment, root->secondary.start); |
686 | 687 | ||
687 | pci_remove_root_bus(root->bus); | 688 | pci_remove_root_bus(root->bus); |
688 | 689 | ||
diff --git a/include/acpi/acpi_drivers.h b/include/acpi/acpi_drivers.h index bb145e4b935e..8b1d7a6a9695 100644 --- a/include/acpi/acpi_drivers.h +++ b/include/acpi/acpi_drivers.h | |||
@@ -92,8 +92,8 @@ int acpi_pci_link_free_irq(acpi_handle handle); | |||
92 | 92 | ||
93 | /* ACPI PCI Interrupt Routing (pci_irq.c) */ | 93 | /* ACPI PCI Interrupt Routing (pci_irq.c) */ |
94 | 94 | ||
95 | int acpi_pci_irq_add_prt(acpi_handle handle, struct pci_bus *bus); | 95 | int acpi_pci_irq_add_prt(acpi_handle handle, int segment, int bus); |
96 | void acpi_pci_irq_del_prt(struct pci_bus *bus); | 96 | void acpi_pci_irq_del_prt(int segment, int bus); |
97 | 97 | ||
98 | /* ACPI PCI Device Binding (pci_bind.c) */ | 98 | /* ACPI PCI Device Binding (pci_bind.c) */ |
99 | 99 | ||