提交 81df5f91 编写于 作者: H Hans de Goede 提交者: Rafael J. Wysocki

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: NHans de Goede <hdegoede@redhat.com>
Signed-off-by: NRafael J. Wysocki <rafael.j.wysocki@intel.com>
上级 f7090e0e
...@@ -1617,15 +1617,18 @@ static int acpi_ec_add(struct acpi_device *device) ...@@ -1617,15 +1617,18 @@ static int acpi_ec_add(struct acpi_device *device)
} }
if (boot_ec && ec->command_addr == boot_ec->command_addr && if (boot_ec && ec->command_addr == boot_ec->command_addr &&
ec->data_addr == boot_ec->data_addr && ec->data_addr == boot_ec->data_addr) {
!EC_FLAGS_TRUST_DSDT_GPE) {
/* /*
* Trust PNP0C09 namespace location rather than * Trust PNP0C09 namespace location rather than ECDT ID.
* ECDT ID. But trust ECDT GPE rather than _GPE * But trust ECDT GPE rather than _GPE because of ASUS
* because of ASUS quirks, so do not change * quirks. So do not change boot_ec->gpe to ec->gpe,
* boot_ec->gpe to ec->gpe. * except when the TRUST_DSDT_GPE quirk is set.
*/ */
boot_ec->handle = ec->handle; boot_ec->handle = ec->handle;
if (EC_FLAGS_TRUST_DSDT_GPE)
boot_ec->gpe = ec->gpe;
acpi_handle_debug(ec->handle, "duplicated.\n"); acpi_handle_debug(ec->handle, "duplicated.\n");
acpi_ec_free(ec); acpi_ec_free(ec);
ec = boot_ec; ec = boot_ec;
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册