ACPI: EC: Re-use boot_ec when possible even when EC_FLAGS_TRUST_DSDT_GPE is set
authorHans de Goede <hdegoede@redhat.com>
Mon, 20 Jun 2022 09:25:45 +0000 (11:25 +0200)
committerRafael J. Wysocki <rafael.j.wysocki@intel.com>
Wed, 29 Jun 2022 17:40:46 +0000 (19:40 +0200)
commit81df5f91974347b9d95de06953b839101fec4a5e
tree8963f974cbb168f41ba58d811d2b2cb34d8f01c6
parentf7090e0ef360d674f08a22fab90e4e209fb1f658
ACPI: EC: Re-use boot_ec when possible even when EC_FLAGS_TRUST_DSDT_GPE is set

EC_FLAGS_TRUST_DSDT_GPE only does anything when the:

if (boot_ec && ec->command_addr == boot_ec->command_addr &&
    ec->data_addr == boot_ec->data_addr)

conditions are all true. Normally acpi_ec_add() would re-use the boot_ec
struct acpi_ec in this case. But when the EC_FLAGS_TRUST_DSDT_GPE flag was
set the code would continue with a newly allocated (second) struct acpi_ec.

There is no reason to use a second struct acpi_ec if all the above checks
match. Instead just change boot_ec->gpe to ec->gpe, when the flag is set,
similar to how this is already one done for boot_ec->handle.

Signed-off-by: Hans de Goede <hdegoede@redhat.com>
Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
drivers/acpi/ec.c