aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/acpi/battery.c
diff options
context:
space:
mode:
authorJiri Kosina <jikos@jikos.cz>2006-10-10 17:20:41 -0400
committerLen Brown <len.brown@intel.com>2006-10-14 02:22:51 -0400
commit34c4415ab857dc6d51db08d62bcd45d4b8513bb6 (patch)
tree310a568ec57a1eaceba762e6d2db8c8b9fe066d9 /drivers/acpi/battery.c
parent3cd5b87d96db503f69a5892b8f5350d356d18969 (diff)
ACPI: check battery status on resume for un/plug events during sleep
Add ->resume method to the ACPI battery handler to check if the battery state has changed during sleep. If yes, update the ACPI internal data structures for benefit of /proc/acpi/battery/. Signed-off-by: Jiri Kosina <jikos@jikos.cz> Cc: Stefan Seyfried <seife@suse.de> Acked-by: Pavel Machek <pavel@ucw.cz> Signed-off-by: Andrew Morton <akpm@osdl.org> Signed-off-by: Len Brown <len.brown@intel.com>
Diffstat (limited to 'drivers/acpi/battery.c')
-rw-r--r--drivers/acpi/battery.c14
1 files changed, 14 insertions, 0 deletions
diff --git a/drivers/acpi/battery.c b/drivers/acpi/battery.c
index 9810e2a55d0a..026e40755cdd 100644
--- a/drivers/acpi/battery.c
+++ b/drivers/acpi/battery.c
@@ -64,6 +64,7 @@ extern void *acpi_unlock_battery_dir(struct proc_dir_entry *acpi_battery_dir);
64 64
65static int acpi_battery_add(struct acpi_device *device); 65static int acpi_battery_add(struct acpi_device *device);
66static int acpi_battery_remove(struct acpi_device *device, int type); 66static int acpi_battery_remove(struct acpi_device *device, int type);
67static int acpi_battery_resume(struct acpi_device *device, int status);
67 68
68static struct acpi_driver acpi_battery_driver = { 69static struct acpi_driver acpi_battery_driver = {
69 .name = ACPI_BATTERY_DRIVER_NAME, 70 .name = ACPI_BATTERY_DRIVER_NAME,
@@ -71,6 +72,7 @@ static struct acpi_driver acpi_battery_driver = {
71 .ids = ACPI_BATTERY_HID, 72 .ids = ACPI_BATTERY_HID,
72 .ops = { 73 .ops = {
73 .add = acpi_battery_add, 74 .add = acpi_battery_add,
75 .resume = acpi_battery_resume,
74 .remove = acpi_battery_remove, 76 .remove = acpi_battery_remove,
75 }, 77 },
76}; 78};
@@ -753,6 +755,18 @@ static int acpi_battery_remove(struct acpi_device *device, int type)
753 return 0; 755 return 0;
754} 756}
755 757
758/* this is needed to learn about changes made in suspended state */
759static int acpi_battery_resume(struct acpi_device *device, int state)
760{
761 struct acpi_battery *battery;
762
763 if (!device)
764 return -EINVAL;
765
766 battery = device->driver_data;
767 return acpi_battery_check(battery);
768}
769
756static int __init acpi_battery_init(void) 770static int __init acpi_battery_init(void)
757{ 771{
758 int result; 772 int result;