]> git.proxmox.com Git - mirror_ubuntu-zesty-kernel.git/blame - drivers/acpi/pci_irq.c
ACPI: PCI: remove unnecessary null pointer checks
[mirror_ubuntu-zesty-kernel.git] / drivers / acpi / pci_irq.c
CommitLineData
1da177e4
LT
1/*
2 * pci_irq.c - ACPI PCI Interrupt Routing ($Revision: 11 $)
3 *
4 * Copyright (C) 2001, 2002 Andy Grover <andrew.grover@intel.com>
5 * Copyright (C) 2001, 2002 Paul Diefenbaugh <paul.s.diefenbaugh@intel.com>
6 * Copyright (C) 2002 Dominik Brodowski <devel@brodo.de>
7 *
8 * ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
9 *
10 * This program is free software; you can redistribute it and/or modify
11 * it under the terms of the GNU General Public License as published by
12 * the Free Software Foundation; either version 2 of the License, or (at
13 * your option) any later version.
14 *
15 * This program is distributed in the hope that it will be useful, but
16 * WITHOUT ANY WARRANTY; without even the implied warranty of
17 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
18 * General Public License for more details.
19 *
20 * You should have received a copy of the GNU General Public License along
21 * with this program; if not, write to the Free Software Foundation, Inc.,
22 * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA.
23 *
24 * ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
25 */
26
1da177e4 27
391df5dc 28#include <linux/dmi.h>
1da177e4
LT
29#include <linux/kernel.h>
30#include <linux/module.h>
31#include <linux/init.h>
32#include <linux/types.h>
33#include <linux/proc_fs.h>
34#include <linux/spinlock.h>
35#include <linux/pm.h>
36#include <linux/pci.h>
37#include <linux/acpi.h>
38#include <acpi/acpi_bus.h>
39#include <acpi/acpi_drivers.h>
40
1da177e4 41#define _COMPONENT ACPI_PCI_COMPONENT
f52fd66d 42ACPI_MODULE_NAME("pci_irq");
1da177e4 43
4be44fcd 44static struct acpi_prt_list acpi_prt;
1da177e4
LT
45static DEFINE_SPINLOCK(acpi_prt_lock);
46
47/* --------------------------------------------------------------------------
48 PCI IRQ Routing Table (PRT) Support
49 -------------------------------------------------------------------------- */
50
4be44fcd
LB
51static struct acpi_prt_entry *acpi_pci_irq_find_prt_entry(int segment,
52 int bus,
53 int device, int pin)
1da177e4 54{
4be44fcd 55 struct acpi_prt_entry *entry = NULL;
1da177e4 56
1da177e4 57 if (!acpi_prt.count)
d550d98d 58 return NULL;
1da177e4
LT
59
60 /*
61 * Parse through all PRT entries looking for a match on the specified
62 * PCI device's segment, bus, device, and pin (don't care about func).
63 *
64 */
65 spin_lock(&acpi_prt_lock);
1a3b77ae 66 list_for_each_entry(entry, &acpi_prt.entries, node) {
4be44fcd
LB
67 if ((segment == entry->id.segment)
68 && (bus == entry->id.bus)
69 && (device == entry->id.device)
70 && (pin == entry->pin)) {
1da177e4 71 spin_unlock(&acpi_prt_lock);
d550d98d 72 return entry;
1da177e4
LT
73 }
74 }
75
76 spin_unlock(&acpi_prt_lock);
d550d98d 77 return NULL;
1da177e4
LT
78}
79
391df5dc
BH
80/* http://bugzilla.kernel.org/show_bug.cgi?id=4773 */
81static struct dmi_system_id medion_md9580[] = {
82 {
83 .ident = "Medion MD9580-F laptop",
84 .matches = {
85 DMI_MATCH(DMI_SYS_VENDOR, "MEDIONNB"),
86 DMI_MATCH(DMI_PRODUCT_NAME, "A555"),
87 },
88 },
89 { }
90};
91
92/* http://bugzilla.kernel.org/show_bug.cgi?id=5044 */
93static struct dmi_system_id dell_optiplex[] = {
94 {
95 .ident = "Dell Optiplex GX1",
96 .matches = {
97 DMI_MATCH(DMI_SYS_VENDOR, "Dell Computer Corporation"),
98 DMI_MATCH(DMI_PRODUCT_NAME, "OptiPlex GX1 600S+"),
99 },
100 },
101 { }
102};
103
104/* http://bugzilla.kernel.org/show_bug.cgi?id=10138 */
105static struct dmi_system_id hp_t5710[] = {
106 {
107 .ident = "HP t5710",
108 .matches = {
109 DMI_MATCH(DMI_SYS_VENDOR, "Hewlett-Packard"),
110 DMI_MATCH(DMI_PRODUCT_NAME, "hp t5000 series"),
111 DMI_MATCH(DMI_BOARD_NAME, "098Ch"),
112 },
113 },
114 { }
115};
116
117struct prt_quirk {
118 struct dmi_system_id *system;
119 unsigned int segment;
120 unsigned int bus;
121 unsigned int device;
122 unsigned char pin;
123 char *source; /* according to BIOS */
124 char *actual_source;
125};
126
127/*
128 * These systems have incorrect _PRT entries. The BIOS claims the PCI
129 * interrupt at the listed segment/bus/device/pin is connected to the first
130 * link device, but it is actually connected to the second.
131 */
132static struct prt_quirk prt_quirks[] = {
133 { medion_md9580, 0, 0, 9, 'A',
b97d4803
BH
134 "\\_SB_.PCI0.ISA_.LNKA",
135 "\\_SB_.PCI0.ISA_.LNKB"},
391df5dc
BH
136 { dell_optiplex, 0, 0, 0xd, 'A',
137 "\\_SB_.LNKB",
138 "\\_SB_.LNKA"},
139 { hp_t5710, 0, 0, 1, 'A',
140 "\\_SB_.PCI0.LNK1",
141 "\\_SB_.PCI0.LNK3"},
142};
143
144static void
145do_prt_fixups(struct acpi_prt_entry *entry, struct acpi_pci_routing_table *prt)
146{
147 int i;
148 struct prt_quirk *quirk;
149
150 for (i = 0; i < ARRAY_SIZE(prt_quirks); i++) {
151 quirk = &prt_quirks[i];
152
153 /* All current quirks involve link devices, not GSIs */
154 if (!prt->source)
155 continue;
156
157 if (dmi_check_system(quirk->system) &&
158 entry->id.segment == quirk->segment &&
159 entry->id.bus == quirk->bus &&
160 entry->id.device == quirk->device &&
161 entry->pin + 'A' == quirk->pin &&
162 !strcmp(prt->source, quirk->source) &&
163 strlen(prt->source) >= strlen(quirk->actual_source)) {
164 printk(KERN_WARNING PREFIX "firmware reports "
c83642d5 165 "%04x:%02x:%02x PCI INT %c connected to %s; "
391df5dc
BH
166 "changing to %s\n",
167 entry->id.segment, entry->id.bus,
168 entry->id.device, 'A' + entry->pin,
169 prt->source, quirk->actual_source);
170 strcpy(prt->source, quirk->actual_source);
171 }
172 }
173}
174
1da177e4 175static int
4be44fcd
LB
176acpi_pci_irq_add_entry(acpi_handle handle,
177 int segment, int bus, struct acpi_pci_routing_table *prt)
1da177e4 178{
4be44fcd 179 struct acpi_prt_entry *entry = NULL;
1da177e4 180
36bcbec7 181 entry = kzalloc(sizeof(struct acpi_prt_entry), GFP_KERNEL);
1da177e4 182 if (!entry)
d550d98d 183 return -ENOMEM;
1da177e4
LT
184
185 entry->id.segment = segment;
186 entry->id.bus = bus;
187 entry->id.device = (prt->address >> 16) & 0xFFFF;
188 entry->id.function = prt->address & 0xFFFF;
189 entry->pin = prt->pin;
190
391df5dc
BH
191 do_prt_fixups(entry, prt);
192
1da177e4
LT
193 /*
194 * Type 1: Dynamic
195 * ---------------
196 * The 'source' field specifies the PCI interrupt link device used to
197 * configure the IRQ assigned to this slot|dev|pin. The 'source_index'
198 * indicates which resource descriptor in the resource template (of
199 * the link device) this interrupt is allocated from.
200 *
201 * NOTE: Don't query the Link Device for IRQ information at this time
202 * because Link Device enumeration may not have occurred yet
203 * (e.g. exists somewhere 'below' this _PRT entry in the ACPI
204 * namespace).
205 */
206 if (prt->source[0]) {
207 acpi_get_handle(handle, prt->source, &entry->link.handle);
208 entry->link.index = prt->source_index;
209 }
210 /*
211 * Type 2: Static
212 * --------------
213 * The 'source' field is NULL, and the 'source_index' field specifies
214 * the IRQ value, which is hardwired to specific interrupt inputs on
215 * the interrupt controller.
216 */
217 else
218 entry->link.index = prt->source_index;
219
220 ACPI_DEBUG_PRINT_RAW((ACPI_DB_INFO,
21a53283 221 " %04x:%02x:%02x[%c] -> %s[%d]\n",
4be44fcd
LB
222 entry->id.segment, entry->id.bus,
223 entry->id.device, ('A' + entry->pin), prt->source,
224 entry->link.index));
1da177e4
LT
225
226 spin_lock(&acpi_prt_lock);
227 list_add_tail(&entry->node, &acpi_prt.entries);
228 acpi_prt.count++;
229 spin_unlock(&acpi_prt_lock);
230
d550d98d 231 return 0;
1da177e4
LT
232}
233
1da177e4 234static void
4be44fcd 235acpi_pci_irq_del_entry(int segment, int bus, struct acpi_prt_entry *entry)
1da177e4 236{
4be44fcd 237 if (segment == entry->id.segment && bus == entry->id.bus) {
1da177e4
LT
238 acpi_prt.count--;
239 list_del(&entry->node);
240 kfree(entry);
241 }
242}
243
4be44fcd 244int acpi_pci_irq_add_prt(acpi_handle handle, int segment, int bus)
1da177e4 245{
4be44fcd
LB
246 acpi_status status = AE_OK;
247 char *pathname = NULL;
248 struct acpi_buffer buffer = { 0, NULL };
249 struct acpi_pci_routing_table *prt = NULL;
250 struct acpi_pci_routing_table *entry = NULL;
251 static int first_time = 1;
1da177e4 252
1da177e4 253
36bcbec7 254 pathname = kzalloc(ACPI_PATHNAME_MAX, GFP_KERNEL);
4be44fcd 255 if (!pathname)
d550d98d 256 return -ENOMEM;
1da177e4
LT
257
258 if (first_time) {
259 acpi_prt.count = 0;
260 INIT_LIST_HEAD(&acpi_prt.entries);
261 first_time = 0;
262 }
263
264 /*
265 * NOTE: We're given a 'handle' to the _PRT object's parent device
266 * (either a PCI root bridge or PCI-PCI bridge).
267 */
268
269 buffer.length = ACPI_PATHNAME_MAX;
270 buffer.pointer = pathname;
271 acpi_get_name(handle, ACPI_FULL_PATHNAME, &buffer);
272
273 printk(KERN_DEBUG "ACPI: PCI Interrupt Routing Table [%s._PRT]\n",
4be44fcd 274 pathname);
1da177e4
LT
275
276 /*
277 * Evaluate this _PRT and add its entries to our global list (acpi_prt).
278 */
279
280 buffer.length = 0;
281 buffer.pointer = NULL;
282 kfree(pathname);
283 status = acpi_get_irq_routing_table(handle, &buffer);
284 if (status != AE_BUFFER_OVERFLOW) {
a6fc6720
TR
285 ACPI_EXCEPTION((AE_INFO, status, "Evaluating _PRT [%s]",
286 acpi_format_exception(status)));
d550d98d 287 return -ENODEV;
1da177e4
LT
288 }
289
36bcbec7 290 prt = kzalloc(buffer.length, GFP_KERNEL);
4be44fcd 291 if (!prt) {
d550d98d 292 return -ENOMEM;
1da177e4 293 }
1da177e4
LT
294 buffer.pointer = prt;
295
296 status = acpi_get_irq_routing_table(handle, &buffer);
297 if (ACPI_FAILURE(status)) {
a6fc6720
TR
298 ACPI_EXCEPTION((AE_INFO, status, "Evaluating _PRT [%s]",
299 acpi_format_exception(status)));
1da177e4 300 kfree(buffer.pointer);
d550d98d 301 return -ENODEV;
1da177e4
LT
302 }
303
304 entry = prt;
305
306 while (entry && (entry->length > 0)) {
307 acpi_pci_irq_add_entry(handle, segment, bus, entry);
308 entry = (struct acpi_pci_routing_table *)
4be44fcd 309 ((unsigned long)entry + entry->length);
1da177e4
LT
310 }
311
312 kfree(prt);
313
d550d98d 314 return 0;
1da177e4
LT
315}
316
4be44fcd 317void acpi_pci_irq_del_prt(int segment, int bus)
1da177e4 318{
4be44fcd
LB
319 struct list_head *node = NULL, *n = NULL;
320 struct acpi_prt_entry *entry = NULL;
1da177e4 321
4be44fcd 322 if (!acpi_prt.count) {
1da177e4
LT
323 return;
324 }
325
4be44fcd 326 printk(KERN_DEBUG
21a53283
BH
327 "ACPI: Delete PCI Interrupt Routing Table for %04x:%02x\n",
328 segment, bus);
1da177e4
LT
329 spin_lock(&acpi_prt_lock);
330 list_for_each_safe(node, n, &acpi_prt.entries) {
331 entry = list_entry(node, struct acpi_prt_entry, node);
332
333 acpi_pci_irq_del_entry(segment, bus, entry);
334 }
335 spin_unlock(&acpi_prt_lock);
336}
4be44fcd 337
1da177e4
LT
338/* --------------------------------------------------------------------------
339 PCI Interrupt Routing Support
340 -------------------------------------------------------------------------- */
4be44fcd 341typedef int (*irq_lookup_func) (struct acpi_prt_entry *, int *, int *, char **);
1da177e4 342
87bec66b
DSL
343static int
344acpi_pci_allocate_irq(struct acpi_prt_entry *entry,
50eca3eb 345 int *triggering, int *polarity, char **link)
87bec66b 346{
4be44fcd 347 int irq;
87bec66b 348
87bec66b
DSL
349
350 if (entry->link.handle) {
351 irq = acpi_pci_link_allocate_irq(entry->link.handle,
50eca3eb
BM
352 entry->link.index, triggering,
353 polarity, link);
87bec66b 354 if (irq < 0) {
cece9296
LB
355 printk(KERN_WARNING PREFIX
356 "Invalid IRQ link routing entry\n");
d550d98d 357 return -1;
87bec66b
DSL
358 }
359 } else {
360 irq = entry->link.index;
50eca3eb
BM
361 *triggering = ACPI_LEVEL_SENSITIVE;
362 *polarity = ACPI_ACTIVE_LOW;
87bec66b
DSL
363 }
364
365 ACPI_DEBUG_PRINT((ACPI_DB_INFO, "Found IRQ %d\n", irq));
d550d98d 366 return irq;
87bec66b
DSL
367}
368
369static int
370acpi_pci_free_irq(struct acpi_prt_entry *entry,
50eca3eb 371 int *triggering, int *polarity, char **link)
87bec66b 372{
4be44fcd 373 int irq;
87bec66b 374
87bec66b
DSL
375 if (entry->link.handle) {
376 irq = acpi_pci_link_free_irq(entry->link.handle);
377 } else {
378 irq = entry->link.index;
379 }
d550d98d 380 return irq;
87bec66b 381}
4be44fcd 382
1da177e4
LT
383/*
384 * acpi_pci_irq_lookup
385 * success: return IRQ >= 0
386 * failure: return -1
387 */
388static int
4be44fcd
LB
389acpi_pci_irq_lookup(struct pci_bus *bus,
390 int device,
391 int pin,
50eca3eb
BM
392 int *triggering,
393 int *polarity, char **link, irq_lookup_func func)
1da177e4 394{
4be44fcd 395 struct acpi_prt_entry *entry = NULL;
1da177e4
LT
396 int segment = pci_domain_nr(bus);
397 int bus_nr = bus->number;
87bec66b 398 int ret;
1da177e4 399
1da177e4 400
4be44fcd 401 ACPI_DEBUG_PRINT((ACPI_DB_INFO,
21a53283 402 "Searching for _PRT entry for %04x:%02x:%02x[%c]\n",
4be44fcd 403 segment, bus_nr, device, ('A' + pin)));
1da177e4 404
4be44fcd 405 entry = acpi_pci_irq_find_prt_entry(segment, bus_nr, device, pin);
1da177e4 406 if (!entry) {
21a53283 407 ACPI_DEBUG_PRINT((ACPI_DB_INFO, "_PRT entry not found\n"));
d550d98d 408 return -1;
1da177e4 409 }
4be44fcd 410
50eca3eb 411 ret = func(entry, triggering, polarity, link);
d550d98d 412 return ret;
1da177e4
LT
413}
414
415/*
416 * acpi_pci_irq_derive
417 * success: return IRQ >= 0
418 * failure: return < 0
419 */
420static int
4be44fcd
LB
421acpi_pci_irq_derive(struct pci_dev *dev,
422 int pin,
50eca3eb
BM
423 int *triggering,
424 int *polarity, char **link, irq_lookup_func func)
1da177e4 425{
4be44fcd
LB
426 struct pci_dev *bridge = dev;
427 int irq = -1;
c83642d5 428 u8 bridge_pin = 0, orig_pin = pin;
1da177e4 429
1da177e4 430
1da177e4
LT
431 /*
432 * Attempt to derive an IRQ for this device from a parent bridge's
433 * PCI interrupt routing entry (eg. yenta bridge and add-in card bridge).
434 */
435 while (irq < 0 && bridge->bus->self) {
436 pin = (pin + PCI_SLOT(bridge->devfn)) % 4;
437 bridge = bridge->bus->self;
438
439 if ((bridge->class >> 8) == PCI_CLASS_BRIDGE_CARDBUS) {
440 /* PC card has the same IRQ as its cardbridge */
8015a014 441 bridge_pin = bridge->pin;
1da177e4 442 if (!bridge_pin) {
4be44fcd
LB
443 ACPI_DEBUG_PRINT((ACPI_DB_INFO,
444 "No interrupt pin configured for device %s\n",
445 pci_name(bridge)));
d550d98d 446 return -1;
1da177e4
LT
447 }
448 /* Pin is from 0 to 3 */
4be44fcd 449 bridge_pin--;
1da177e4
LT
450 pin = bridge_pin;
451 }
452
453 irq = acpi_pci_irq_lookup(bridge->bus, PCI_SLOT(bridge->devfn),
50eca3eb 454 pin, triggering, polarity,
4be44fcd 455 link, func);
1da177e4
LT
456 }
457
458 if (irq < 0) {
c83642d5
BH
459 dev_warn(&dev->dev, "can't derive routing for PCI INT %c\n",
460 'A' + orig_pin);
d550d98d 461 return -1;
1da177e4
LT
462 }
463
464 ACPI_DEBUG_PRINT((ACPI_DB_INFO, "Derive IRQ %d for device %s from %s\n",
4be44fcd 465 irq, pci_name(dev), pci_name(bridge)));
1da177e4 466
d550d98d 467 return irq;
1da177e4
LT
468}
469
470/*
471 * acpi_pci_irq_enable
472 * success: return 0
473 * failure: return < 0
474 */
475
4be44fcd 476int acpi_pci_irq_enable(struct pci_dev *dev)
1da177e4 477{
4be44fcd
LB
478 int irq = 0;
479 u8 pin = 0;
50eca3eb
BM
480 int triggering = ACPI_LEVEL_SENSITIVE;
481 int polarity = ACPI_ACTIVE_LOW;
4be44fcd 482 char *link = NULL;
c83642d5 483 char link_desc[16];
4be44fcd 484 int rc;
1da177e4 485
1da177e4 486
8015a014 487 pin = dev->pin;
1da177e4 488 if (!pin) {
4be44fcd
LB
489 ACPI_DEBUG_PRINT((ACPI_DB_INFO,
490 "No interrupt pin configured for device %s\n",
491 pci_name(dev)));
d550d98d 492 return 0;
1da177e4
LT
493 }
494 pin--;
495
1da177e4
LT
496 /*
497 * First we check the PCI IRQ routing table (PRT) for an IRQ. PRT
498 * values override any BIOS-assigned IRQs set during boot.
499 */
4be44fcd 500 irq = acpi_pci_irq_lookup(dev->bus, PCI_SLOT(dev->devfn), pin,
50eca3eb 501 &triggering, &polarity, &link,
4be44fcd 502 acpi_pci_allocate_irq);
1da177e4
LT
503
504 /*
505 * If no PRT entry was found, we'll try to derive an IRQ from the
506 * device's parent bridge.
507 */
508 if (irq < 0)
50eca3eb
BM
509 irq = acpi_pci_irq_derive(dev, pin, &triggering,
510 &polarity, &link,
4be44fcd
LB
511 acpi_pci_allocate_irq);
512
96c2a876
AC
513 if (irq < 0) {
514 /*
515 * IDE legacy mode controller IRQs are magic. Why do compat
516 * extensions always make such a nasty mess.
517 */
518 if (dev->class >> 8 == PCI_CLASS_STORAGE_IDE &&
519 (dev->class & 0x05) == 0)
520 return 0;
521 }
1da177e4
LT
522 /*
523 * No IRQ known to the ACPI subsystem - maybe the BIOS /
524 * driver reported one, then use it. Exit in any case.
525 */
526 if (irq < 0) {
c83642d5 527 dev_warn(&dev->dev, "PCI INT %c: no GSI", 'A' + pin);
1da177e4 528 /* Interrupt Line values above 0xF are forbidden */
44f8e1a2 529 if (dev->irq > 0 && (dev->irq <= 0xF)) {
1da177e4 530 printk(" - using IRQ %d\n", dev->irq);
4be44fcd
LB
531 acpi_register_gsi(dev->irq, ACPI_LEVEL_SENSITIVE,
532 ACPI_ACTIVE_LOW);
d550d98d 533 return 0;
4be44fcd 534 } else {
1da177e4 535 printk("\n");
d550d98d 536 return 0;
1da177e4 537 }
4be44fcd 538 }
1da177e4 539
50eca3eb 540 rc = acpi_register_gsi(irq, triggering, polarity);
349f0d56 541 if (rc < 0) {
c83642d5
BH
542 dev_warn(&dev->dev, "PCI INT %c: failed to register GSI\n",
543 'A' + pin);
d550d98d 544 return rc;
349f0d56
KK
545 }
546 dev->irq = rc;
1da177e4 547
1da177e4 548 if (link)
c83642d5
BH
549 snprintf(link_desc, sizeof(link_desc), " -> Link[%s]", link);
550 else
551 link_desc[0] = '\0';
1da177e4 552
c83642d5
BH
553 dev_info(&dev->dev, "PCI INT %c%s -> GSI %u (%s, %s) -> IRQ %d\n",
554 'A' + pin, link_desc, irq,
555 (triggering == ACPI_LEVEL_SENSITIVE) ? "level" : "edge",
556 (polarity == ACPI_ACTIVE_LOW) ? "low" : "high", dev->irq);
1da177e4 557
d550d98d 558 return 0;
1da177e4 559}
1da177e4 560
87bec66b 561/* FIXME: implement x86/x86_64 version */
4be44fcd
LB
562void __attribute__ ((weak)) acpi_unregister_gsi(u32 i)
563{
564}
87bec66b 565
4be44fcd 566void acpi_pci_irq_disable(struct pci_dev *dev)
1da177e4 567{
4be44fcd
LB
568 int gsi = 0;
569 u8 pin = 0;
50eca3eb
BM
570 int triggering = ACPI_LEVEL_SENSITIVE;
571 int polarity = ACPI_ACTIVE_LOW;
1da177e4 572
1da177e4 573
8015a014 574 pin = dev->pin;
1da177e4 575 if (!pin)
d550d98d 576 return;
1da177e4
LT
577 pin--;
578
1da177e4
LT
579 /*
580 * First we check the PCI IRQ routing table (PRT) for an IRQ.
581 */
4be44fcd 582 gsi = acpi_pci_irq_lookup(dev->bus, PCI_SLOT(dev->devfn), pin,
50eca3eb 583 &triggering, &polarity, NULL,
4be44fcd 584 acpi_pci_free_irq);
1da177e4
LT
585 /*
586 * If no PRT entry was found, we'll try to derive an IRQ from the
587 * device's parent bridge.
588 */
589 if (gsi < 0)
4be44fcd 590 gsi = acpi_pci_irq_derive(dev, pin,
50eca3eb 591 &triggering, &polarity, NULL,
4be44fcd 592 acpi_pci_free_irq);
1da177e4 593 if (gsi < 0)
d550d98d 594 return;
1da177e4
LT
595
596 /*
597 * TBD: It might be worth clearing dev->irq by magic constant
598 * (e.g. PCI_UNDEFINED_IRQ).
599 */
600
c83642d5 601 dev_info(&dev->dev, "PCI INT %c disabled\n", 'A' + pin);
1da177e4 602 acpi_unregister_gsi(gsi);
1da177e4 603}