Hi, On Tue, Apr 14, 2015 at 10:24:13PM +0900, Krzysztof Kozlowski wrote: > The 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. > > Dmesg: > [ 107.999370] WARNING: CPU: 0 PID: 303 at ../fs/sysfs/dir.c:31 sysfs_warn_dup+0x68/0x80() > [ 107.999374] sysfs: cannot create duplicate filename '/devices/LNXSYSTM:00/LNXSYBUS:00/PNP0A03:00/PNP0C0A:00/power_supply/BAT0' > [ 107.999418] CPU: 0 PID: 303 Comm: rtcwake Not tainted 4.0.0-ARCH-02621-g07e6253af953 #48 > [ 107.999421] Hardware name: innotek GmbH VirtualBox/VirtualBox, BIOS VirtualBox 12/01/2006 > [ 107.999425] 0000000000000000 000000008600f41a ffff88001cf3f9f8 ffffffff8156c77d > [ 107.999430] 0000000000000000 ffff88001cf3fa50 ffff88001cf3fa38 ffffffff81074cea > [ 107.999434] 000029b71cf3fa38 ffff88001e387000 ffff88001cc3bfb8 ffff88001ce1e258 > [ 107.999439] Call Trace: > [ 107.999446] [] dump_stack+0x4c/0x6e > [ 107.999453] [] warn_slowpath_common+0x8a/0xc0 > [ 107.999458] [] warn_slowpath_fmt+0x55/0x70 > [ 107.999464] [] ? kernfs_path+0x48/0x60 > [ 107.999468] [] sysfs_warn_dup+0x68/0x80 > [ 107.999472] [] sysfs_create_dir_ns+0x8d/0xa0 > [ 107.999478] [] kobject_add_internal+0xb6/0x370 > [ 107.999483] [] kobject_add+0x6f/0xd0 > [ 107.999489] [] device_add+0x120/0x6c0 > [ 107.999494] [] ? dev_set_name+0x50/0x70 > [ 107.999500] [] __power_supply_register+0x145/0x290 > [ 107.999506] [] ? extract_package+0x73/0xc5 [battery] > [ 107.999511] [] power_supply_register_no_ws+0x10/0x20 > [ 107.999517] [] sysfs_add_battery+0x84/0xc5 [battery] > [ 107.999522] [] battery_notify+0x45/0x6b [battery] > [ 107.999527] [] notifier_call_chain+0x4f/0x80 > [ 107.999532] [] __blocking_notifier_call_chain+0x4b/0x70 > [ 107.999537] [] blocking_notifier_call_chain+0x16/0x20 > [ 107.999543] [] pm_notifier_call_chain+0x1a/0x40 > [ 107.999548] [] pm_suspend+0x3ed/0x4e0 > [ 107.999552] [] state_store+0xa7/0xb0 > [ 107.999557] [] kobj_attr_store+0xf/0x20 > [ 107.999561] [] sysfs_kf_write+0x3a/0x50 > [ 107.999565] [] kernfs_fop_write+0x127/0x180 > [ 107.999571] [] vfs_write+0xb7/0x200 > [ 107.999576] [] SyS_write+0x59/0xd0 > [ 107.999581] [] system_call_fastpath+0x12/0x71 > [ 107.999586] ---[ end trace 3977e3a58591fca2 ]--- > > Signed-off-by: Krzysztof Kozlowski > Reported-by: Linus Torvalds Reviewed-By: Sebastian Reichel -- Sebastian