Skip to content

Commit

Permalink
ACPI / Battery: Add the check before refresh sysfs in the battery_not…
Browse files Browse the repository at this point in the history
…ify()

In the commit 25be582, 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>
  • Loading branch information
Lan Tianyu authored and Len Brown committed Jul 14, 2011
1 parent d5a5911 commit 6e17fb6
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions drivers/acpi/battery.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}

Expand Down

0 comments on commit 6e17fb6

Please sign in to comment.