diff options
author | Tomasz Nowicki <tomasz.nowicki@linaro.org> | 2014-02-20 08:27:46 -0500 |
---|---|---|
committer | Rafael J. Wysocki <rafael.j.wysocki@intel.com> | 2014-02-20 15:37:42 -0500 |
commit | c1aaae673f68448253905bd9af6c6f9d31a7769a (patch) | |
tree | 604a2ec76184ddbf7f9021698bd21136b11603a3 /drivers | |
parent | b685f3b1744061aa9ad822548ba9c674de5be7c6 (diff) |
ACPI / PCI: Do not call ISA-specific code if ISA is not supported
This commit moves ISA-specific code to separate function and makes that
function depend on CONFIG_{E}ISA so that we do not have to maintain
acpi_isa_irq_to_gsi() function for architectures which do not support ISA.
Signed-off-by: Tomasz Nowicki <tomasz.nowicki@linaro.org>
Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
Diffstat (limited to 'drivers')
-rw-r--r-- | drivers/acpi/pci_irq.c | 36 |
1 files changed, 25 insertions, 11 deletions
diff --git a/drivers/acpi/pci_irq.c b/drivers/acpi/pci_irq.c index 361b40c10c3f..9c62340c2360 100644 --- a/drivers/acpi/pci_irq.c +++ b/drivers/acpi/pci_irq.c | |||
@@ -370,6 +370,30 @@ static struct acpi_prt_entry *acpi_pci_irq_lookup(struct pci_dev *dev, int pin) | |||
370 | return NULL; | 370 | return NULL; |
371 | } | 371 | } |
372 | 372 | ||
373 | #if IS_ENABLED(CONFIG_ISA) || IS_ENABLED(CONFIG_EISA) | ||
374 | static int acpi_isa_register_gsi(struct pci_dev *dev) | ||
375 | { | ||
376 | u32 dev_gsi; | ||
377 | |||
378 | /* Interrupt Line values above 0xF are forbidden */ | ||
379 | if (dev->irq > 0 && (dev->irq <= 0xF) && | ||
380 | (acpi_isa_irq_to_gsi(dev->irq, &dev_gsi) == 0)) { | ||
381 | dev_warn(&dev->dev, "PCI INT %c: no GSI - using ISA IRQ %d\n", | ||
382 | pin_name(dev->pin), dev->irq); | ||
383 | acpi_register_gsi(&dev->dev, dev_gsi, | ||
384 | ACPI_LEVEL_SENSITIVE, | ||
385 | ACPI_ACTIVE_LOW); | ||
386 | return 0; | ||
387 | } | ||
388 | return -EINVAL; | ||
389 | } | ||
390 | #else | ||
391 | static inline int acpi_isa_register_gsi(struct pci_dev *dev) | ||
392 | { | ||
393 | return -ENODEV; | ||
394 | } | ||
395 | #endif | ||
396 | |||
373 | int acpi_pci_irq_enable(struct pci_dev *dev) | 397 | int acpi_pci_irq_enable(struct pci_dev *dev) |
374 | { | 398 | { |
375 | struct acpi_prt_entry *entry; | 399 | struct acpi_prt_entry *entry; |
@@ -416,19 +440,9 @@ int acpi_pci_irq_enable(struct pci_dev *dev) | |||
416 | * driver reported one, then use it. Exit in any case. | 440 | * driver reported one, then use it. Exit in any case. |
417 | */ | 441 | */ |
418 | if (gsi < 0) { | 442 | if (gsi < 0) { |
419 | u32 dev_gsi; | 443 | if (acpi_isa_register_gsi(dev)) |
420 | /* Interrupt Line values above 0xF are forbidden */ | ||
421 | if (dev->irq > 0 && (dev->irq <= 0xF) && | ||
422 | (acpi_isa_irq_to_gsi(dev->irq, &dev_gsi) == 0)) { | ||
423 | dev_warn(&dev->dev, "PCI INT %c: no GSI - using ISA IRQ %d\n", | ||
424 | pin_name(pin), dev->irq); | ||
425 | acpi_register_gsi(&dev->dev, dev_gsi, | ||
426 | ACPI_LEVEL_SENSITIVE, | ||
427 | ACPI_ACTIVE_LOW); | ||
428 | } else { | ||
429 | dev_warn(&dev->dev, "PCI INT %c: no GSI\n", | 444 | dev_warn(&dev->dev, "PCI INT %c: no GSI\n", |
430 | pin_name(pin)); | 445 | pin_name(pin)); |
431 | } | ||
432 | 446 | ||
433 | kfree(entry); | 447 | kfree(entry); |
434 | return 0; | 448 | return 0; |