Skip to content

Commit 49e4b84

Browse files
yu-chen-surfrafaeljw
authored andcommitted
ACPI: Use correct IRQ when uninstalling ACPI interrupt handler
Currently when the system is trying to uninstall the ACPI interrupt handler, it uses acpi_gbl_FADT.sci_interrupt as the IRQ number. However, the IRQ number that the ACPI interrupt handled is installed for comes from acpi_gsi_to_irq() and that is the number that should be used for the handler removal. Fix this problem by using the mapped IRQ returned from acpi_gsi_to_irq() as appropriate. Cc: All applicable <[email protected]> Acked-by: Lv Zheng <[email protected]> Signed-off-by: Chen Yu <[email protected]> Signed-off-by: Rafael J. Wysocki <[email protected]>
1 parent 32b8819 commit 49e4b84

File tree

2 files changed

+12
-3
lines changed

2 files changed

+12
-3
lines changed

drivers/acpi/osl.c

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -81,6 +81,7 @@ static struct workqueue_struct *kacpid_wq;
8181
static struct workqueue_struct *kacpi_notify_wq;
8282
static struct workqueue_struct *kacpi_hotplug_wq;
8383
static bool acpi_os_initialized;
84+
unsigned int acpi_sci_irq = INVALID_ACPI_IRQ;
8485

8586
/*
8687
* This list of permanent mappings is for memory that may be accessed from
@@ -856,17 +857,19 @@ acpi_os_install_interrupt_handler(u32 gsi, acpi_osd_handler handler,
856857
acpi_irq_handler = NULL;
857858
return AE_NOT_ACQUIRED;
858859
}
860+
acpi_sci_irq = irq;
859861

860862
return AE_OK;
861863
}
862864

863-
acpi_status acpi_os_remove_interrupt_handler(u32 irq, acpi_osd_handler handler)
865+
acpi_status acpi_os_remove_interrupt_handler(u32 gsi, acpi_osd_handler handler)
864866
{
865-
if (irq != acpi_gbl_FADT.sci_interrupt)
867+
if (gsi != acpi_gbl_FADT.sci_interrupt || !acpi_sci_irq_valid())
866868
return AE_BAD_PARAMETER;
867869

868-
free_irq(irq, acpi_irq);
870+
free_irq(acpi_sci_irq, acpi_irq);
869871
acpi_irq_handler = NULL;
872+
acpi_sci_irq = INVALID_ACPI_IRQ;
870873

871874
return AE_OK;
872875
}

include/linux/acpi.h

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -193,6 +193,12 @@ int acpi_ioapic_registered(acpi_handle handle, u32 gsi_base);
193193
void acpi_irq_stats_init(void);
194194
extern u32 acpi_irq_handled;
195195
extern u32 acpi_irq_not_handled;
196+
extern unsigned int acpi_sci_irq;
197+
#define INVALID_ACPI_IRQ ((unsigned)-1)
198+
static inline bool acpi_sci_irq_valid(void)
199+
{
200+
return acpi_sci_irq != INVALID_ACPI_IRQ;
201+
}
196202

197203
extern int sbf_port;
198204
extern unsigned long acpi_realmode_flags;

0 commit comments

Comments
 (0)