lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [day] [month] [year] [list]
Message-Id: <1247643522.26272.82.camel@rzhang-dt>
Date:	Wed, 15 Jul 2009 15:38:42 +0800
From:	Zhang Rui <rui.zhang@...el.com>
To:	Linux Kernel Mailing List <linux-kernel@...r.kernel.org>,
	linux-pm <linux-pm@...ts.linux-foundation.org>,
	linux-acpi <linux-acpi@...r.kernel.org>
Cc:	Len Brown <lenb@...nel.org>, Pavel Machek <pavel@...e.cz>,
	"Rafael J. Wysocki" <rjw@...k.pl>,
	"Van De Ven, Arjan" <arjan.van.de.ven@...el.com>,
	"Zhang, Rui" <rui.zhang@...el.com>
Subject: [PATCH 7/8] ACPI battery: support device async resume


ACPI battery supports device async actions.

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

Signed-off-by: Zhang Rui <rui.zhang@...el.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;


--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ