aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJiang Liu <jiang.liu@linux.intel.com>2014-06-10 02:11:23 -0400
committerThomas Gleixner <tglx@linutronix.de>2014-06-21 17:05:40 -0400
commit2c0a6894df19515baf9d2bf0076a2b57c8b51efb (patch)
treeb2d146eb8491244571b43ade54c35b25f4e173fa
parente819813f5cb98030bab38569abffd9354a1c1a82 (diff)
x86, ACPI, irq: Enhance error handling in function acpi_register_gsi()
Function mp_register_gsi() may return error code when failed to look up or program corresponding IOAPIC pin for GSI, so enhance acpi_register_gsi() to handle possible error cases. Signed-off-by: Jiang Liu <jiang.liu@linux.intel.com> Cc: Konrad Rzeszutek Wilk <konrad.wilk@oracle.com> Cc: Tony Luck <tony.luck@intel.com> Cc: Joerg Roedel <joro@8bytes.org> Cc: Paul Gortmaker <paul.gortmaker@windriver.com> Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org> Cc: Benjamin Herrenschmidt <benh@kernel.crashing.org> Cc: Grant Likely <grant.likely@linaro.org> Cc: Rafael J. Wysocki <rjw@rjwysocki.net> Cc: Bjorn Helgaas <bhelgaas@google.com> Cc: Randy Dunlap <rdunlap@infradead.org> Cc: Yinghai Lu <yinghai@kernel.org> Cc: Len Brown <len.brown@intel.com> Cc: Pavel Machek <pavel@ucw.cz> Link: http://lkml.kernel.org/r/1402380683-32345-1-git-send-email-jiang.liu@linux.intel.com Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
-rw-r--r--arch/x86/kernel/acpi/boot.c14
1 files changed, 8 insertions, 6 deletions
diff --git a/arch/x86/kernel/acpi/boot.c b/arch/x86/kernel/acpi/boot.c
index 392360c607dc..298f79616f1c 100644
--- a/arch/x86/kernel/acpi/boot.c
+++ b/arch/x86/kernel/acpi/boot.c
@@ -97,6 +97,8 @@ static u32 isa_irq_to_gsi[NR_IRQS_LEGACY] __read_mostly = {
97 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15 97 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15
98}; 98};
99 99
100#define ACPI_INVALID_GSI INT_MIN
101
100static unsigned int gsi_to_irq(unsigned int gsi) 102static unsigned int gsi_to_irq(unsigned int gsi)
101{ 103{
102 unsigned int irq = gsi + NR_IRQS_LEGACY; 104 unsigned int irq = gsi + NR_IRQS_LEGACY;
@@ -441,7 +443,7 @@ static int mp_register_gsi(struct device *dev, u32 gsi, int trigger,
441 polarity == ACPI_ACTIVE_HIGH ? 0 : 1); 443 polarity == ACPI_ACTIVE_HIGH ? 0 : 1);
442 ret = io_apic_set_pci_routing(dev, gsi_to_irq(gsi), &irq_attr); 444 ret = io_apic_set_pci_routing(dev, gsi_to_irq(gsi), &irq_attr);
443 if (ret < 0) 445 if (ret < 0)
444 gsi = INT_MIN; 446 gsi = ACPI_INVALID_GSI;
445 447
446 return gsi; 448 return gsi;
447} 449}
@@ -666,13 +668,13 @@ int (*acpi_suspend_lowlevel)(void);
666 */ 668 */
667int acpi_register_gsi(struct device *dev, u32 gsi, int trigger, int polarity) 669int acpi_register_gsi(struct device *dev, u32 gsi, int trigger, int polarity)
668{ 670{
669 unsigned int irq; 671 unsigned int plat_gsi;
670 unsigned int plat_gsi = gsi;
671 672
672 plat_gsi = (*__acpi_register_gsi)(dev, gsi, trigger, polarity); 673 plat_gsi = __acpi_register_gsi(dev, gsi, trigger, polarity);
673 irq = gsi_to_irq(plat_gsi); 674 if (plat_gsi != ACPI_INVALID_GSI)
675 return gsi_to_irq(plat_gsi);
674 676
675 return irq; 677 return -1;
676} 678}
677EXPORT_SYMBOL_GPL(acpi_register_gsi); 679EXPORT_SYMBOL_GPL(acpi_register_gsi);
678 680