Skip to content

Commit a507207

Browse files
jwrdegoederafaeljw
authored andcommitted
ACPI: EC: Fix EC address space handler unregistration
When an ECDT table is present the EC address space handler gets registered on the root node. So to unregister it properly the unregister call also must be done on the root node. Store the ACPI handle used for the acpi_install_address_space_handler() call and use te same handle for the acpi_remove_address_space_handler() call. Reported-by: Rafael J. Wysocki <[email protected]> Signed-off-by: Hans de Goede <[email protected]> Signed-off-by: Rafael J. Wysocki <[email protected]>
1 parent 0634033 commit a507207

File tree

2 files changed

+4
-1
lines changed

2 files changed

+4
-1
lines changed

drivers/acpi/ec.c

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1475,6 +1475,7 @@ static int ec_install_handlers(struct acpi_ec *ec, struct acpi_device *device)
14751475
return -ENODEV;
14761476
}
14771477
set_bit(EC_FLAGS_EC_HANDLER_INSTALLED, &ec->flags);
1478+
ec->address_space_handler_holder = ec->handle;
14781479
}
14791480

14801481
if (!device)
@@ -1526,7 +1527,8 @@ static int ec_install_handlers(struct acpi_ec *ec, struct acpi_device *device)
15261527
static void ec_remove_handlers(struct acpi_ec *ec)
15271528
{
15281529
if (test_bit(EC_FLAGS_EC_HANDLER_INSTALLED, &ec->flags)) {
1529-
if (ACPI_FAILURE(acpi_remove_address_space_handler(ec->handle,
1530+
if (ACPI_FAILURE(acpi_remove_address_space_handler(
1531+
ec->address_space_handler_holder,
15301532
ACPI_ADR_SPACE_EC, &acpi_ec_space_handler)))
15311533
pr_err("failed to remove space handler\n");
15321534
clear_bit(EC_FLAGS_EC_HANDLER_INSTALLED, &ec->flags);

drivers/acpi/internal.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -173,6 +173,7 @@ enum acpi_ec_event_state {
173173

174174
struct acpi_ec {
175175
acpi_handle handle;
176+
acpi_handle address_space_handler_holder;
176177
int gpe;
177178
int irq;
178179
unsigned long command_addr;

0 commit comments

Comments
 (0)