Commit 6e17fb6a authored by Lan Tianyu's avatar Lan Tianyu Committed by Len Brown

ACPI / Battery: Add the check before refresh sysfs in the battery_notify()

In the commit 25be5821, add the refresh sysfs when system resumes
from suspending. But it didn't check that the battery exists. This
will cause battery sysfs files added when the battery doesn't exist.
This patch add the check before refreshing.

	https://bugzilla.kernel.org/show_bug.cgi?id=35642Signed-off-by: default avatarLan Tianyu <tianyu.lan@intel.com>
Signed-off-by: default avatarLen Brown <len.brown@intel.com>
parent d5a5911b
...@@ -949,8 +949,10 @@ static int battery_notify(struct notifier_block *nb, ...@@ -949,8 +949,10 @@ static int battery_notify(struct notifier_block *nb,
switch (mode) { switch (mode) {
case PM_POST_HIBERNATION: case PM_POST_HIBERNATION:
case PM_POST_SUSPEND: case PM_POST_SUSPEND:
sysfs_remove_battery(battery); if (battery->bat.dev) {
sysfs_add_battery(battery); sysfs_remove_battery(battery);
sysfs_add_battery(battery);
}
break; break;
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment