diff options
Diffstat (limited to 'drivers/acpi/battery.c')
| -rw-r--r-- | drivers/acpi/battery.c | 8 |
1 files changed, 7 insertions, 1 deletions
diff --git a/drivers/acpi/battery.c b/drivers/acpi/battery.c index 3026e3fa83ef..dc58402b0a17 100644 --- a/drivers/acpi/battery.c +++ b/drivers/acpi/battery.c | |||
| @@ -868,9 +868,15 @@ static void acpi_battery_remove_fs(struct acpi_device *device) | |||
| 868 | static void acpi_battery_notify(struct acpi_device *device, u32 event) | 868 | static void acpi_battery_notify(struct acpi_device *device, u32 event) |
| 869 | { | 869 | { |
| 870 | struct acpi_battery *battery = acpi_driver_data(device); | 870 | struct acpi_battery *battery = acpi_driver_data(device); |
| 871 | #ifdef CONFIG_ACPI_SYSFS_POWER | ||
| 872 | struct device *old; | ||
| 873 | #endif | ||
| 871 | 874 | ||
| 872 | if (!battery) | 875 | if (!battery) |
| 873 | return; | 876 | return; |
| 877 | #ifdef CONFIG_ACPI_SYSFS_POWER | ||
| 878 | old = battery->bat.dev; | ||
| 879 | #endif | ||
| 874 | acpi_battery_update(battery); | 880 | acpi_battery_update(battery); |
| 875 | acpi_bus_generate_proc_event(device, event, | 881 | acpi_bus_generate_proc_event(device, event, |
| 876 | acpi_battery_present(battery)); | 882 | acpi_battery_present(battery)); |
| @@ -879,7 +885,7 @@ static void acpi_battery_notify(struct acpi_device *device, u32 event) | |||
| 879 | acpi_battery_present(battery)); | 885 | acpi_battery_present(battery)); |
| 880 | #ifdef CONFIG_ACPI_SYSFS_POWER | 886 | #ifdef CONFIG_ACPI_SYSFS_POWER |
| 881 | /* acpi_battery_update could remove power_supply object */ | 887 | /* acpi_battery_update could remove power_supply object */ |
| 882 | if (battery->bat.dev) | 888 | if (old && battery->bat.dev) |
| 883 | power_supply_changed(&battery->bat); | 889 | power_supply_changed(&battery->bat); |
| 884 | #endif | 890 | #endif |
| 885 | } | 891 | } |
