If a battery hook is added to a battery, userspace software
is not informed that the available properties of the battery
might have changed. This for example causes upower to react
slowly if a new battery hook is added during runtime.
Fix this by calling power_supply_changed() if a battery hook
was successfully added/removed.
Tested on a Dell Inspiron 3505.
Signed-off-by: Armin Wolf <W_Armin@gmx.de>
Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
        if (lock)
                mutex_lock(&hook_mutex);
        list_for_each_entry(battery, &acpi_battery_list, list) {
-               hook->remove_battery(battery->bat);
+               if (!hook->remove_battery(battery->bat))
+                       power_supply_changed(battery->bat);
        }
        list_del(&hook->list);
        if (lock)
                        __battery_hook_unregister(hook, 0);
                        goto end;
                }
+
+               power_supply_changed(battery->bat);
        }
        pr_info("new extension: %s\n", hook->name);
 end: