Skip to content

Commit

Permalink
ACPI: EC: Use fast path in acpi_ec_add() for DSDT boot EC
Browse files Browse the repository at this point in the history
If the boot EC comes from the DSDT, its ACPI handle is equal to the
handle of a device object with the PNP0C09 device ID.  If that
device object is passed to acpi_ec_add(), it is not necessary to
allocate a new EC structure for it and parse it, because that has
been done already, so change the function to use the fast path in
that case.

Signed-off-by: Rafael J. Wysocki <[email protected]>
  • Loading branch information
rafaeljw committed Mar 2, 2020
1 parent e3cfabc commit 3d9b8dd
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion drivers/acpi/ec.c
Original file line number Diff line number Diff line change
Expand Up @@ -1611,7 +1611,8 @@ static int acpi_ec_add(struct acpi_device *device)
strcpy(acpi_device_name(device), ACPI_EC_DEVICE_NAME);
strcpy(acpi_device_class(device), ACPI_EC_CLASS);

if (!strcmp(acpi_device_hid(device), ACPI_ECDT_HID)) {
if ((boot_ec && boot_ec->handle == device->handle) ||
!strcmp(acpi_device_hid(device), ACPI_ECDT_HID)) {
/* Fast path: this device corresponds to the boot EC. */
ec = boot_ec;
} else {
Expand Down

0 comments on commit 3d9b8dd

Please sign in to comment.