diff options
author | Krzysztof Kozlowski <k.kozlowski.k@gmail.com> | 2015-04-14 22:24:13 +0900 |
---|---|---|
committer | Linus Torvalds <torvalds@linux-foundation.org> | 2015-04-14 09:03:33 -0700 |
commit | 31f7dc796998d2967e999a0f9229d8a50c7b348d (patch) | |
tree | 26e931e313defd121912ec256cd4571c0ee33fb8 /drivers/acpi/battery.c | |
parent | b79013b2449c23f1f505bdf39c5a6c330338b244 (diff) | |
download | linux-31f7dc796998d2967e999a0f9229d8a50c7b348d.tar.bz2 |
ACPI / battery: Fix doubly added battery on system suspend
Commit 297d716f6260 ("power_supply: Change ownership from driver to
core") inverted the logic in battery_notify(). As an effect already
present battery was re-added on each system suspend or hibernation.
WARNING: CPU: 0 PID: 303 at ../fs/sysfs/dir.c:31 sysfs_warn_dup+0x68/0x80()
sysfs: cannot create duplicate filename '/devices/LNXSYSTM:00/LNXSYBUS:00/PNP0A03:00/PNP0C0A:00/power_supply/BAT0'
CPU: 0 PID: 303 Comm: rtcwake Not tainted 4.0.0-ARCH-02621-g07e6253af953 #48
Call Trace:
sysfs_create_dir_ns+0x8d/0xa0
kobject_add_internal+0xb6/0x370
kobject_add+0x6f/0xd0
device_add+0x120/0x6c0
__power_supply_register+0x145/0x290
power_supply_register_no_ws+0x10/0x20
sysfs_add_battery+0x84/0xc5 [battery]
battery_notify+0x45/0x6b [battery]
notifier_call_chain+0x4f/0x80
__blocking_notifier_call_chain+0x4b/0x70
blocking_notifier_call_chain+0x16/0x20
pm_notifier_call_chain+0x1a/0x40
pm_suspend+0x3ed/0x4e0
Signed-off-by: Krzysztof Kozlowski <k.kozlowski.k@gmail.com>
Reported-by: Linus Torvalds <torvalds@linux-foundation.org>
Acked-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
Reviewed-By: Sebastian Reichel <sre@kernel.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Diffstat (limited to 'drivers/acpi/battery.c')
-rw-r--r-- | drivers/acpi/battery.c | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/drivers/acpi/battery.c b/drivers/acpi/battery.c index fdc16ce9d272..672263a3832c 100644 --- a/drivers/acpi/battery.c +++ b/drivers/acpi/battery.c @@ -1106,7 +1106,7 @@ static int battery_notify(struct notifier_block *nb, if (!acpi_battery_present(battery)) return 0; - if (battery->bat) { + if (!battery->bat) { result = acpi_battery_get_info(battery); if (result) return result; |