diff options
Diffstat (limited to 'drivers/acpi/battery.c')
-rw-r--r-- | drivers/acpi/battery.c | 16 |
1 files changed, 16 insertions, 0 deletions
diff --git a/drivers/acpi/battery.c b/drivers/acpi/battery.c index 95649d373071..68bc227e7c4c 100644 --- a/drivers/acpi/battery.c +++ b/drivers/acpi/battery.c | |||
@@ -631,6 +631,17 @@ static int acpi_battery_update(struct acpi_battery *battery) | |||
631 | return result; | 631 | return result; |
632 | } | 632 | } |
633 | 633 | ||
634 | static void acpi_battery_refresh(struct acpi_battery *battery) | ||
635 | { | ||
636 | if (!battery->bat.dev) | ||
637 | return; | ||
638 | |||
639 | acpi_battery_get_info(battery); | ||
640 | /* The battery may have changed its reporting units. */ | ||
641 | sysfs_remove_battery(battery); | ||
642 | sysfs_add_battery(battery); | ||
643 | } | ||
644 | |||
634 | /* -------------------------------------------------------------------------- | 645 | /* -------------------------------------------------------------------------- |
635 | FS Interface (/proc) | 646 | FS Interface (/proc) |
636 | -------------------------------------------------------------------------- */ | 647 | -------------------------------------------------------------------------- */ |
@@ -868,6 +879,8 @@ static int acpi_battery_add_fs(struct acpi_device *device) | |||
868 | struct proc_dir_entry *entry = NULL; | 879 | struct proc_dir_entry *entry = NULL; |
869 | int i; | 880 | int i; |
870 | 881 | ||
882 | printk(KERN_WARNING PREFIX "Deprecated procfs I/F for battery is loaded," | ||
883 | " please retry with CONFIG_ACPI_PROCFS_POWER cleared\n"); | ||
871 | if (!acpi_device_dir(device)) { | 884 | if (!acpi_device_dir(device)) { |
872 | acpi_device_dir(device) = proc_mkdir(acpi_device_bid(device), | 885 | acpi_device_dir(device) = proc_mkdir(acpi_device_bid(device), |
873 | acpi_battery_dir); | 886 | acpi_battery_dir); |
@@ -914,6 +927,8 @@ static void acpi_battery_notify(struct acpi_device *device, u32 event) | |||
914 | if (!battery) | 927 | if (!battery) |
915 | return; | 928 | return; |
916 | old = battery->bat.dev; | 929 | old = battery->bat.dev; |
930 | if (event == ACPI_BATTERY_NOTIFY_INFO) | ||
931 | acpi_battery_refresh(battery); | ||
917 | acpi_battery_update(battery); | 932 | acpi_battery_update(battery); |
918 | acpi_bus_generate_proc_event(device, event, | 933 | acpi_bus_generate_proc_event(device, event, |
919 | acpi_battery_present(battery)); | 934 | acpi_battery_present(battery)); |
@@ -983,6 +998,7 @@ static int acpi_battery_resume(struct acpi_device *device) | |||
983 | if (!device) | 998 | if (!device) |
984 | return -EINVAL; | 999 | return -EINVAL; |
985 | battery = acpi_driver_data(device); | 1000 | battery = acpi_driver_data(device); |
1001 | acpi_battery_refresh(battery); | ||
986 | battery->update_time = 0; | 1002 | battery->update_time = 0; |
987 | acpi_battery_update(battery); | 1003 | acpi_battery_update(battery); |
988 | return 0; | 1004 | return 0; |