ACPI: dock: Retry probing battery docks after hotplug

On a ThinkPad T480 booted with the removable battery absent, reinserting
that battery can leave BAT1 missing from /sys/class/power_supply even
after firmware sends an ACPI add notification.

The battery dock platform device already exists, but its driver did not
bind while the battery was absent. During hotplug, acpi_bus_scan()
updates the ACPI device and attempts to attach it on the ACPI bus.
acpi_create_platform_device() does not create another platform device
because the existing physical node is still associated with the ACPI
device. Consequently, the existing platform device remains unbound.

Retry probing the battery dock platform device after hotplug_dock_devices()
has refreshed the ACPI state. Restrict this to battery docks. If the
platform device is already bound, device_initial_probe() leaves that
binding in place.

Signed-off-by: Vibhor Goel <vibhor1102@gmail.com>
[ rjw: Add empty code line after a conditional ]
Link: https://patch.msgid.link/20261003164019.11195-1-vibhor1102@gmail.com
Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
This commit is contained in:
Vibhor Goel 2026-10-03 22:10:19 +05:30 committed by Rafael J. Wysocki
parent 24a19b953e
commit 029d11df81

View File

@ -445,6 +445,15 @@ int dock_notify(struct acpi_device *adev, u32 event)
break;
}
hotplug_dock_devices(ds, event);
/*
* The dock platform device already exists when an empty battery
* bay becomes occupied, but its driver may not have bound while
* the battery was absent. Retry after the ACPI scan updates its
* status, since the scan only attaches the ACPI device.
*/
if (ds->flags & DOCK_IS_BAT)
device_initial_probe(&ds->dock_device->dev);
complete_dock(ds);
dock_event(ds, event, DOCK_EVENT);
acpi_evaluate_lck(ds->handle, 1);