From: Zhang Rui Date: Wed, 7 Jul 2010 01:11:57 +0000 (+0800) Subject: ACPI battery: don't invoke power_supply_changed twice when battery is hot-added X-Git-Tag: v2.6.35~38^2~4^2 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=153e500f516329f439856f52ccbf61d1fd1a946a;p=platform%2Fkernel%2Flinux-3.10.git ACPI battery: don't invoke power_supply_changed twice when battery is hot-added When battery is hot-added, we should not invoke power_supply_changed in acpi_battery_notify, because it has been invoked in acpi_battery_update, and battery->bat.changed_work is queued in keventd already. https://bugzilla.kernel.org/show_bug.cgi?id=16244 Signed-off-by: Zhang Rui Acked-by: Alexey Starikovskiy Signed-off-by: Len Brown --- diff --git a/drivers/acpi/battery.c b/drivers/acpi/battery.c index 3026e3f..dc58402 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) static void acpi_battery_notify(struct acpi_device *device, u32 event) { struct acpi_battery *battery = acpi_driver_data(device); +#ifdef CONFIG_ACPI_SYSFS_POWER + struct device *old; +#endif if (!battery) return; +#ifdef CONFIG_ACPI_SYSFS_POWER + old = battery->bat.dev; +#endif acpi_battery_update(battery); acpi_bus_generate_proc_event(device, event, acpi_battery_present(battery)); @@ -879,7 +885,7 @@ static void acpi_battery_notify(struct acpi_device *device, u32 event) acpi_battery_present(battery)); #ifdef CONFIG_ACPI_SYSFS_POWER /* acpi_battery_update could remove power_supply object */ - if (battery->bat.dev) + if (old && battery->bat.dev) power_supply_changed(&battery->bat); #endif }