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 for Android: free password hash cracker in your pocket
[<prev] [next>] [day] [month] [year] [list]
Message-Id: <1247643518.26272.79.camel@rzhang-dt>
Date:	Wed, 15 Jul 2009 15:38:38 +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 6/8] introduce device async shutdown


introduce device async shutdown.

If boot option "dev_async_action" is added,
devices can be shutdown asynchronously.

Signed-off-by: Zhang Rui <rui.zhang@...el.com>
---
 drivers/base/core.c       |    7 +++++--
 include/linux/async_dev.h |    4 +++-
 drivers/base/async_dev.c        |    4 ++++
 3 files changed, 12 insertions(+), 3 deletions(-)

Index: linux-2.6/drivers/base/core.c
===================================================================
--- linux-2.6.orig/drivers/base/core.c
+++ linux-2.6/drivers/base/core.c
@@ -1715,14 +1715,17 @@ void device_shutdown(void)
 				kobj.entry) {
 		if (dev->bus && dev->bus->shutdown) {
 			dev_dbg(dev, "shutdown\n");
-			dev->bus->shutdown(dev);
+			dev_async_schedule(dev, dev->bus->shutdown, NULL,
+							DEV_ASYNC_SHUTDOWN);
 		} else if (dev->driver && dev->driver->shutdown) {
 			dev_dbg(dev, "shutdown\n");
-			dev->driver->shutdown(dev);
+			dev_async_schedule(dev, dev->driver->shutdown, NULL,
+							DEV_ASYNC_SHUTDOWN);
 		}
 	}
 	kobject_put(sysfs_dev_char_kobj);
 	kobject_put(sysfs_dev_block_kobj);
 	kobject_put(dev_kobj);
+	dev_async_synchronization();
 	async_synchronize_full();
 }
Index: linux-2.6/include/linux/async_dev.h
===================================================================
--- linux-2.6.orig/include/linux/async_dev.h
+++ linux-2.6/include/linux/async_dev.h
@@ -30,8 +30,10 @@ struct dev_async_struct {
 
 #define DEV_ASYNC_SUSPEND	1
 #define DEV_ASYNC_RESUME	2
+#define DEV_ASYNC_SHUTDOWN	4
 #define DEV_ASYNC_ACTIONS_ALL	(DEV_ASYNC_SUSPEND |	\
-				DEV_ASYNC_RESUME)
+				DEV_ASYNC_RESUME |	\
+				DEV_ASYNC_SHUTDOWN)
 
 extern int dev_async_schedule(struct device *, void *,
 			void *, int);
Index: linux-2.6/drivers/base/async_dev.c
===================================================================
--- linux-2.6.orig/drivers/base/async_dev.c
+++ linux-2.6/drivers/base/async_dev.c
@@ -18,6 +18,7 @@ static LIST_HEAD(dev_async_list);
 static int dev_async_enabled;
 
 typedef int (*dev_async_suspend)(struct device *, pm_message_t);
+typedef void (*dev_async_shutdown) (struct device *);
 
 struct dev_async_context {
 	struct device *dev;
@@ -39,6 +40,9 @@ static int dev_action(struct device *dev
 	case DEV_ASYNC_RESUME:
 		error = ((dev_async_suspend)func)(dev, *((pm_message_t *)data));
 		break;
+	case DEV_ASYNC_SHUTDOWN:
+		((dev_async_shutdown)func)(dev);
+		break;
 	default:
 		return -EINVAL;
 	}


--
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