@@ -1560,43 +1560,34 @@ static bool acpi_ec_ecdt_get_handle(acpi_handle *phandle)
1560
1560
return true;
1561
1561
}
1562
1562
1563
- static bool acpi_is_boot_ec (struct acpi_ec * ec )
1564
- {
1565
- if (!boot_ec )
1566
- return false;
1567
- if (ec -> command_addr == boot_ec -> command_addr &&
1568
- ec -> data_addr == boot_ec -> data_addr )
1569
- return true;
1570
- return false;
1571
- }
1572
-
1573
1563
static int acpi_ec_add (struct acpi_device * device )
1574
1564
{
1575
1565
struct acpi_ec * ec = NULL ;
1576
- int ret ;
1577
- bool is_ecdt = false;
1566
+ bool dep_update = true;
1578
1567
acpi_status status ;
1568
+ int ret ;
1579
1569
1580
1570
strcpy (acpi_device_name (device ), ACPI_EC_DEVICE_NAME );
1581
1571
strcpy (acpi_device_class (device ), ACPI_EC_CLASS );
1582
1572
1583
1573
if (!strcmp (acpi_device_hid (device ), ACPI_ECDT_HID )) {
1584
- is_ecdt = true;
1574
+ boot_ec_is_ecdt = true;
1585
1575
ec = boot_ec ;
1576
+ dep_update = false;
1586
1577
} else {
1587
1578
ec = acpi_ec_alloc ();
1588
1579
if (!ec )
1589
1580
return - ENOMEM ;
1581
+
1590
1582
status = ec_parse_device (device -> handle , 0 , ec , NULL );
1591
1583
if (status != AE_CTRL_TERMINATE ) {
1592
1584
ret = - EINVAL ;
1593
1585
goto err_alloc ;
1594
1586
}
1595
- }
1596
1587
1597
- if (acpi_is_boot_ec ( ec )) {
1598
- boot_ec_is_ecdt = is_ecdt ;
1599
- if (! is_ecdt ) {
1588
+ if (boot_ec && ec -> command_addr == boot_ec -> command_addr &&
1589
+ ec -> data_addr == boot_ec -> data_addr ) {
1590
+ boot_ec_is_ecdt = false;
1600
1591
/*
1601
1592
* Trust PNP0C09 namespace location rather than
1602
1593
* ECDT ID. But trust ECDT GPE rather than _GPE
@@ -1617,7 +1608,7 @@ static int acpi_ec_add(struct acpi_device *device)
1617
1608
if (ec == boot_ec )
1618
1609
acpi_handle_info (boot_ec -> handle ,
1619
1610
"Boot %s EC used to handle transactions and events\n" ,
1620
- is_ecdt ? "ECDT" : "DSDT" );
1611
+ boot_ec_is_ecdt ? "ECDT" : "DSDT" );
1621
1612
1622
1613
device -> driver_data = ec ;
1623
1614
@@ -1626,7 +1617,7 @@ static int acpi_ec_add(struct acpi_device *device)
1626
1617
ret = !!request_region (ec -> command_addr , 1 , "EC cmd" );
1627
1618
WARN (!ret , "Could not request EC cmd io port 0x%lx" , ec -> command_addr );
1628
1619
1629
- if (! is_ecdt ) {
1620
+ if (dep_update ) {
1630
1621
/* Reprobe devices depending on the EC */
1631
1622
acpi_walk_dep_device_list (ec -> handle );
1632
1623
}
0 commit comments