aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--drivers/acpi/ec.c54
1 files changed, 8 insertions, 46 deletions
diff --git a/drivers/acpi/ec.c b/drivers/acpi/ec.c
index adddb2e3466d..e2b8cccd23ab 100644
--- a/drivers/acpi/ec.c
+++ b/drivers/acpi/ec.c
@@ -1541,49 +1541,6 @@ static int acpi_ec_setup(struct acpi_ec *ec, bool handle_events)
1541 return ret; 1541 return ret;
1542} 1542}
1543 1543
1544static int acpi_config_boot_ec(struct acpi_ec *ec, acpi_handle handle,
1545 bool handle_events, bool is_ecdt)
1546{
1547 int ret;
1548
1549 /*
1550 * Changing the ACPI handle results in a re-configuration of the
1551 * boot EC. And if it happens after the namespace initialization,
1552 * it causes _REG evaluations.
1553 */
1554 if (boot_ec && boot_ec->handle != handle)
1555 ec_remove_handlers(boot_ec);
1556
1557 /* Unset old boot EC */
1558 if (boot_ec != ec)
1559 acpi_ec_free(boot_ec);
1560
1561 /*
1562 * ECDT device creation is split into acpi_ec_ecdt_probe() and
1563 * acpi_ec_ecdt_start(). This function takes care of completing the
1564 * ECDT parsing logic as the handle update should be performed
1565 * between the installation/uninstallation of the handlers.
1566 */
1567 if (ec->handle != handle)
1568 ec->handle = handle;
1569
1570 ret = acpi_ec_setup(ec, handle_events);
1571 if (ret)
1572 return ret;
1573
1574 /* Set new boot EC */
1575 if (!boot_ec) {
1576 boot_ec = ec;
1577 boot_ec_is_ecdt = is_ecdt;
1578 }
1579
1580 acpi_handle_info(boot_ec->handle,
1581 "Used as boot %s EC to handle transactions%s\n",
1582 is_ecdt ? "ECDT" : "DSDT",
1583 handle_events ? " and events" : "");
1584 return ret;
1585}
1586
1587static bool acpi_ec_ecdt_get_handle(acpi_handle *phandle) 1544static bool acpi_ec_ecdt_get_handle(acpi_handle *phandle)
1588{ 1545{
1589 struct acpi_table_ecdt *ecdt_ptr; 1546 struct acpi_table_ecdt *ecdt_ptr;
@@ -1651,12 +1608,17 @@ static int acpi_ec_add(struct acpi_device *device)
1651 acpi_ec_free(ec); 1608 acpi_ec_free(ec);
1652 ec = boot_ec; 1609 ec = boot_ec;
1653 } 1610 }
1654 ret = acpi_config_boot_ec(ec, ec->handle, true, is_ecdt); 1611 }
1655 } else 1612
1656 ret = acpi_ec_setup(ec, true); 1613 ret = acpi_ec_setup(ec, true);
1657 if (ret) 1614 if (ret)
1658 goto err_query; 1615 goto err_query;
1659 1616
1617 if (ec == boot_ec)
1618 acpi_handle_info(boot_ec->handle,
1619 "Boot %s EC used to handle transactions and events\n",
1620 is_ecdt ? "ECDT" : "DSDT");
1621
1660 device->driver_data = ec; 1622 device->driver_data = ec;
1661 1623
1662 ret = !!request_region(ec->data_addr, 1, "EC data"); 1624 ret = !!request_region(ec->data_addr, 1, "EC data");