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=35642

Signed-off-by: Lan Tianyu <tianyu.lan@intel.com>
Signed-off-by: Len Brown <len.brown@intel.com>
This commit is contained in:
Lan Tianyu 2011-06-30 11:33:58 +08:00 committed by Len Brown
parent d5a5911b32
commit 6e17fb6aa1
1 changed files with 4 additions and 2 deletions

View File

@ -949,8 +949,10 @@ static int battery_notify(struct notifier_block *nb,
switch (mode) {
case PM_POST_HIBERNATION:
case PM_POST_SUSPEND:
sysfs_remove_battery(battery);
sysfs_add_battery(battery);
if (battery->bat.dev) {
sysfs_remove_battery(battery);
sysfs_add_battery(battery);
}
break;
}