* [PATCH 5/6] ACPI / Battery: Add the check before refresh sysfs in the battery_notify()
@ 2011-06-29 8:24 Lan Tianyu
0 siblings, 0 replies; only message in thread
From: Lan Tianyu @ 2011-06-29 8:24 UTC (permalink / raw)
To: lenb; +Cc: linux-acpi, tianyu.lan, rui.zhang, stable
In the commit 25be5821, add the refresh sysfs when system resumes
from suspend. But it didn't check that the battery exists. This
will cause battery sysfs 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>
---
drivers/acpi/battery.c | 6 ++++--
1 files changed, 4 insertions(+), 2 deletions(-)
diff --git a/drivers/acpi/battery.c b/drivers/acpi/battery.c
index cc35bdc..cb4a554 100644
--- a/drivers/acpi/battery.c
+++ b/drivers/acpi/battery.c
@@ -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;
}
--
1.7.6.rc2.8.g28eb
^ permalink raw reply related [flat|nested] only message in thread
only message in thread, other threads:[~2011-06-29 8:24 UTC | newest]
Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2011-06-29 8:24 [PATCH 5/6] ACPI / Battery: Add the check before refresh sysfs in the battery_notify() Lan Tianyu
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.