Skip to content

Commit eea3d53

Browse files
t-8chrafaeljw
authored andcommitted
ACPI: battery: use driver core managed async probing
In commit 0f66af5 ("ACPI: battery: asynchronous init") the ACPI battery driver switched to a custom async driver probing to avoid delaying the system boot. In the meantime the driver core gained its own async probing logic for "slow devices which probing order is not essential for booting the system". Switch over to the core logic and drop the custom one. Signed-off-by: Thomas Weißschuh <[email protected]> Link: https://patch.msgid.link/[email protected] [ rjw: Changelog edit ] Signed-off-by: Rafael J. Wysocki <[email protected]>
1 parent 3745de7 commit eea3d53

File tree

1 file changed

+7
-24
lines changed

1 file changed

+7
-24
lines changed

drivers/acpi/battery.c

Lines changed: 7 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,6 @@
1010

1111
#define pr_fmt(fmt) "ACPI: battery: " fmt
1212

13-
#include <linux/async.h>
1413
#include <linux/delay.h>
1514
#include <linux/dmi.h>
1615
#include <linux/jiffies.h>
@@ -50,8 +49,6 @@ MODULE_AUTHOR("Alexey Starikovskiy <[email protected]>");
5049
MODULE_DESCRIPTION("ACPI Battery Driver");
5150
MODULE_LICENSE("GPL");
5251

53-
static async_cookie_t async_cookie;
54-
static bool battery_driver_registered;
5552
static int battery_bix_broken_package;
5653
static int battery_notification_delay_ms;
5754
static int battery_ac_is_broken;
@@ -1311,37 +1308,23 @@ static struct acpi_driver acpi_battery_driver = {
13111308
.remove = acpi_battery_remove,
13121309
},
13131310
.drv.pm = &acpi_battery_pm,
1311+
.drv.probe_type = PROBE_PREFER_ASYNCHRONOUS,
13141312
};
13151313

1316-
static void __init acpi_battery_init_async(void *unused, async_cookie_t cookie)
1317-
{
1318-
int result;
1319-
1320-
if (acpi_quirk_skip_acpi_ac_and_battery())
1321-
return;
1322-
1323-
dmi_check_system(bat_dmi_table);
1324-
1325-
result = acpi_bus_register_driver(&acpi_battery_driver);
1326-
battery_driver_registered = (result == 0);
1327-
}
1328-
13291314
static int __init acpi_battery_init(void)
13301315
{
1331-
if (acpi_disabled)
1316+
if (acpi_disabled || acpi_quirk_skip_acpi_ac_and_battery())
13321317
return -ENODEV;
13331318

1334-
async_cookie = async_schedule(acpi_battery_init_async, NULL);
1335-
return 0;
1319+
dmi_check_system(bat_dmi_table);
1320+
1321+
return acpi_bus_register_driver(&acpi_battery_driver);
13361322
}
13371323

13381324
static void __exit acpi_battery_exit(void)
13391325
{
1340-
async_synchronize_cookie(async_cookie + 1);
1341-
if (battery_driver_registered) {
1342-
acpi_bus_unregister_driver(&acpi_battery_driver);
1343-
battery_hook_exit();
1344-
}
1326+
acpi_bus_unregister_driver(&acpi_battery_driver);
1327+
battery_hook_exit();
13451328
}
13461329

13471330
module_init(acpi_battery_init);

0 commit comments

Comments
 (0)