Skip to content

Commit 27568d8

Browse files
committed
Merge branch 'bugzilla-16244' into release
2 parents 855977e + 153e500 commit 27568d8

File tree

1 file changed

+7
-1
lines changed

1 file changed

+7
-1
lines changed

drivers/acpi/battery.c

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -868,9 +868,15 @@ static void acpi_battery_remove_fs(struct acpi_device *device)
868868
static void acpi_battery_notify(struct acpi_device *device, u32 event)
869869
{
870870
struct acpi_battery *battery = acpi_driver_data(device);
871+
#ifdef CONFIG_ACPI_SYSFS_POWER
872+
struct device *old;
873+
#endif
871874

872875
if (!battery)
873876
return;
877+
#ifdef CONFIG_ACPI_SYSFS_POWER
878+
old = battery->bat.dev;
879+
#endif
874880
acpi_battery_update(battery);
875881
acpi_bus_generate_proc_event(device, event,
876882
acpi_battery_present(battery));
@@ -879,7 +885,7 @@ static void acpi_battery_notify(struct acpi_device *device, u32 event)
879885
acpi_battery_present(battery));
880886
#ifdef CONFIG_ACPI_SYSFS_POWER
881887
/* acpi_battery_update could remove power_supply object */
882-
if (battery->bat.dev)
888+
if (old && battery->bat.dev)
883889
power_supply_changed(&battery->bat);
884890
#endif
885891
}

0 commit comments

Comments
 (0)