@@ -1594,25 +1594,6 @@ static int acpi_ec_setup(struct acpi_ec *ec, struct acpi_device *device)
1594
1594
return ret ;
1595
1595
}
1596
1596
1597
- static bool acpi_ec_ecdt_get_handle (acpi_handle * phandle )
1598
- {
1599
- struct acpi_table_ecdt * ecdt_ptr ;
1600
- acpi_status status ;
1601
- acpi_handle handle ;
1602
-
1603
- status = acpi_get_table (ACPI_SIG_ECDT , 1 ,
1604
- (struct acpi_table_header * * )& ecdt_ptr );
1605
- if (ACPI_FAILURE (status ))
1606
- return false;
1607
-
1608
- status = acpi_get_handle (NULL , ecdt_ptr -> id , & handle );
1609
- if (ACPI_FAILURE (status ))
1610
- return false;
1611
-
1612
- * phandle = handle ;
1613
- return true;
1614
- }
1615
-
1616
1597
static int acpi_ec_add (struct acpi_device * device )
1617
1598
{
1618
1599
struct acpi_ec * ec ;
@@ -1784,35 +1765,42 @@ void __init acpi_ec_dsdt_probe(void)
1784
1765
}
1785
1766
1786
1767
/*
1787
- * If the DSDT EC is not functioning, we still need to prepare a fully
1788
- * functioning ECDT EC first in order to handle the events.
1789
- * https://bugzilla.kernel.org/show_bug.cgi?id=115021
1768
+ * acpi_ec_ecdt_start - Finalize the boot ECDT EC initialization.
1769
+ *
1770
+ * First, look for an ACPI handle for the boot ECDT EC if acpi_ec_add() has not
1771
+ * found a matching object in the namespace.
1772
+ *
1773
+ * Next, in case the DSDT EC is not functioning, it is still necessary to
1774
+ * provide a functional ECDT EC to handle events, so add an extra device object
1775
+ * to represent it (see https://bugzilla.kernel.org/show_bug.cgi?id=115021).
1776
+ *
1777
+ * This is useful on platforms with valid ECDT and invalid DSDT EC settings,
1778
+ * like ASUS X550ZE (see https://bugzilla.kernel.org/show_bug.cgi?id=196847).
1790
1779
*/
1791
- static int __init acpi_ec_ecdt_start (void )
1780
+ static void __init acpi_ec_ecdt_start (void )
1792
1781
{
1782
+ struct acpi_table_ecdt * ecdt_ptr ;
1793
1783
acpi_handle handle ;
1784
+ acpi_status status ;
1794
1785
1795
- if (!boot_ec )
1796
- return - ENODEV ;
1797
- /* In case acpi_ec_ecdt_start() is called after acpi_ec_add() */
1798
- if (!boot_ec_is_ecdt )
1799
- return - ENODEV ;
1786
+ /* Bail out if a matching EC has been found in the namespace. */
1787
+ if (!boot_ec || boot_ec -> handle != ACPI_ROOT_OBJECT )
1788
+ return ;
1800
1789
1801
- /*
1802
- * At this point, the namespace and the GPE is initialized, so
1803
- * start to find the namespace objects and handle the events.
1804
- *
1805
- * Note: ec->handle can be valid if this function is called after
1806
- * acpi_ec_add(), hence the fast path.
1807
- */
1808
- if (boot_ec -> handle == ACPI_ROOT_OBJECT ) {
1809
- if (!acpi_ec_ecdt_get_handle (& handle ))
1810
- return - ENODEV ;
1811
- boot_ec -> handle = handle ;
1812
- }
1790
+ /* Look up the object pointed to from the ECDT in the namespace. */
1791
+ status = acpi_get_table (ACPI_SIG_ECDT , 1 ,
1792
+ (struct acpi_table_header * * )& ecdt_ptr );
1793
+ if (ACPI_FAILURE (status ))
1794
+ return ;
1795
+
1796
+ status = acpi_get_handle (NULL , ecdt_ptr -> id , & handle );
1797
+ if (ACPI_FAILURE (status ))
1798
+ return ;
1813
1799
1814
- /* Register to ACPI bus with PM ops attached */
1815
- return acpi_bus_register_early_device (ACPI_BUS_TYPE_ECDT_EC );
1800
+ boot_ec -> handle = handle ;
1801
+
1802
+ /* Add a special ACPI device object to represent the boot EC. */
1803
+ acpi_bus_register_early_device (ACPI_BUS_TYPE_ECDT_EC );
1816
1804
}
1817
1805
1818
1806
#if 0
@@ -2156,14 +2144,13 @@ static const struct dmi_system_id acpi_ec_no_wakeup[] = {
2156
2144
{ },
2157
2145
};
2158
2146
2159
- int __init acpi_ec_init (void )
2147
+ void __init acpi_ec_init (void )
2160
2148
{
2161
2149
int result ;
2162
- int ecdt_fail , dsdt_fail ;
2163
2150
2164
2151
result = acpi_ec_init_workqueues ();
2165
2152
if (result )
2166
- return result ;
2153
+ return ;
2167
2154
2168
2155
/*
2169
2156
* Disable EC wakeup on following systems to prevent periodic
@@ -2174,16 +2161,10 @@ int __init acpi_ec_init(void)
2174
2161
pr_debug ("Disabling EC wakeup on suspend-to-idle\n" );
2175
2162
}
2176
2163
2177
- /* Drivers must be started after acpi_ec_query_init() */
2178
- dsdt_fail = acpi_bus_register_driver (& acpi_ec_driver );
2179
- /*
2180
- * Register ECDT to ACPI bus only when PNP0C09 probe fails. This is
2181
- * useful for platforms (confirmed on ASUS X550ZE) with valid ECDT
2182
- * settings but invalid DSDT settings.
2183
- * https://bugzilla.kernel.org/show_bug.cgi?id=196847
2184
- */
2185
- ecdt_fail = acpi_ec_ecdt_start ();
2186
- return ecdt_fail && dsdt_fail ? - ENODEV : 0 ;
2164
+ /* Driver must be registered after acpi_ec_init_workqueues(). */
2165
+ acpi_bus_register_driver (& acpi_ec_driver );
2166
+
2167
+ acpi_ec_ecdt_start ();
2187
2168
}
2188
2169
2189
2170
/* EC driver currently not unloadable */
0 commit comments