Linux ACPI
 help / color / mirror / Atom feed
* [PATCH V2 3/4] ACPI battery: support async resume
@ 2009-07-24  3:02 Zhang Rui
  0 siblings, 0 replies; only message in thread
From: Zhang Rui @ 2009-07-24  3:02 UTC (permalink / raw)
  To: Linux Kernel Mailing List, linux-pm, linux-acpi; +Cc: Arjan van de Ven


ACPI battery supports device async actions.

Create an async domain for every ACPI battery device,
so that ACPI battery can be resumed asynchronously.

Signed-off-by: Zhang Rui <rui.zhang@intel.com>
---
 drivers/acpi/battery.c |   13 +++++++++++++
 1 file changed, 13 insertions(+)

Index: linux-2.6/drivers/acpi/battery.c
===================================================================
--- linux-2.6.orig/drivers/acpi/battery.c
+++ linux-2.6/drivers/acpi/battery.c
@@ -829,6 +829,17 @@ static int acpi_battery_add(struct acpi_
 	strcpy(acpi_device_class(device), ACPI_BATTERY_CLASS);
 	device->driver_data = battery;
 	mutex_init(&battery->lock);
+
+	/*
+	 * dev_async_register must be called before any of its child
+	 * device being registered, i.e. power supply sysfs class device.
+	 */
+	result = dev_async_register(&device->dev, DEV_ASYNC_RESUME);
+	if (result) {
+		kfree(battery);
+		return result;
+	}
+
 	acpi_battery_update(battery);
 #ifdef CONFIG_ACPI_PROCFS_POWER
 	result = acpi_battery_add_fs(device);
@@ -841,6 +852,7 @@ static int acpi_battery_add(struct acpi_
 #ifdef CONFIG_ACPI_PROCFS_POWER
 		acpi_battery_remove_fs(device);
 #endif
+		dev_async_unregister(&device->dev);
 		kfree(battery);
 	}
 	return result;
@@ -859,6 +871,7 @@ static int acpi_battery_remove(struct ac
 #ifdef CONFIG_ACPI_SYSFS_POWER
 	sysfs_remove_battery(battery);
 #endif
+	dev_async_unregister(&device->dev);
 	mutex_destroy(&battery->lock);
 	kfree(battery);
 	return 0;

^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2009-07-24  3:02 UTC | newest]

Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2009-07-24  3:02 [PATCH V2 3/4] ACPI battery: support async resume Zhang Rui

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox