aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/acpi
diff options
context:
space:
mode:
authorLan Tianyu <tianyu.lan@intel.com>2011-06-29 23:33:58 -0400
committerLen Brown <len.brown@intel.com>2011-07-14 00:05:45 -0400
commit6e17fb6aa1a67afa1827ae317c3594040f055730 (patch)
tree6a3874a0331fcd4e4ff9d44df720028ee8165a06 /drivers/acpi
parentd5a5911b3278bad6515a9958f7318f74d534ef64 (diff)
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>
Diffstat (limited to 'drivers/acpi')
-rw-r--r--drivers/acpi/battery.c6
1 files changed, 4 insertions, 2 deletions
diff --git a/drivers/acpi/battery.c b/drivers/acpi/battery.c
index 2fe7cfd95680..4ba339d0ea19 100644
--- a/drivers/acpi/battery.c
+++ b/drivers/acpi/battery.c
@@ -949,8 +949,10 @@ static int battery_notify(struct notifier_block *nb,
949 switch (mode) { 949 switch (mode) {
950 case PM_POST_HIBERNATION: 950 case PM_POST_HIBERNATION:
951 case PM_POST_SUSPEND: 951 case PM_POST_SUSPEND:
952 sysfs_remove_battery(battery); 952 if (battery->bat.dev) {
953 sysfs_add_battery(battery); 953 sysfs_remove_battery(battery);
954 sysfs_add_battery(battery);
955 }
954 break; 956 break;
955 } 957 }
956 958