Merge branches 'battery', 'bugzilla-14667', 'bugzilla-15096', 'bugzilla-15480', ...
[sfrench/cifs-2.6.git] / drivers / acpi / battery.c
index 75f39f2c166d88b3b186a0bb2633fac77165753b..3026e3fa83efc82923daf64e1f00fd2b59f23848 100644 (file)
@@ -32,6 +32,7 @@
 #include <linux/jiffies.h>
 #include <linux/async.h>
 #include <linux/dmi.h>
+#include <linux/slab.h>
 
 #ifdef CONFIG_ACPI_PROCFS_POWER
 #include <linux/proc_fs.h>
@@ -567,13 +568,13 @@ static int acpi_battery_update(struct acpi_battery *battery)
        result = acpi_battery_get_status(battery);
        if (result)
                return result;
-#ifdef CONFIG_ACPI_SYSFS_POWER
        if (!acpi_battery_present(battery)) {
+#ifdef CONFIG_ACPI_SYSFS_POWER
                sysfs_remove_battery(battery);
+#endif
                battery->update_time = 0;
                return 0;
        }
-#endif
        if (!battery->update_time ||
            old_present != acpi_battery_present(battery)) {
                result = acpi_battery_get_info(battery);
@@ -879,7 +880,7 @@ static void acpi_battery_notify(struct acpi_device *device, u32 event)
 #ifdef CONFIG_ACPI_SYSFS_POWER
        /* acpi_battery_update could remove power_supply object */
        if (battery->bat.dev)
-               kobject_uevent(&battery->bat.dev->kobj, KOBJ_CHANGE);
+               power_supply_changed(&battery->bat);
 #endif
 }