summaryrefslogtreecommitdiff
path: root/sys/kern/subr_autoconf.c
diff options
context:
space:
mode:
authorTheo de Raadt <deraadt@cvs.openbsd.org>2013-12-06 21:03:06 +0000
committerTheo de Raadt <deraadt@cvs.openbsd.org>2013-12-06 21:03:06 +0000
commitdde7b00df07d5064317db5ff355091c989d5d684 (patch)
tree7ea38e550451394317b7581ff5f8914bd269ec95 /sys/kern/subr_autoconf.c
parent236f5968eef75c8e14b0b020bb15cc2f53b5041e (diff)
Add a DVACT_WAKEUP op to the *_activate() API. This is called after the
kernel resumes normal (non-cold, able to run processes, etc) operation. Previously we were relying on specific DVACT_RESUME op's in drivers creating callback/threads themselves, but that has become too common, indicating the need for a built-in mechanism. ok dlg kettenis, tested by a sufficient amount of people
Diffstat (limited to 'sys/kern/subr_autoconf.c')
-rw-r--r--sys/kern/subr_autoconf.c13
1 files changed, 9 insertions, 4 deletions
diff --git a/sys/kern/subr_autoconf.c b/sys/kern/subr_autoconf.c
index 8041eb80ba9..7696b15693b 100644
--- a/sys/kern/subr_autoconf.c
+++ b/sys/kern/subr_autoconf.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: subr_autoconf.c,v 1.71 2013/11/29 05:05:13 deraadt Exp $ */
+/* $OpenBSD: subr_autoconf.c,v 1.72 2013/12/06 21:03:02 deraadt Exp $ */
/* $NetBSD: subr_autoconf.c,v 1.21 1996/04/04 06:06:18 cgd Exp $ */
/*
@@ -760,11 +760,15 @@ int
config_suspend(struct device *dev, int act)
{
struct cfattach *ca = dev->dv_cfdata->cf_attach;
+ int r;
+ device_ref(dev);
if (ca->ca_activate)
- return (*ca->ca_activate)(dev, act);
+ r = (*ca->ca_activate)(dev, act);
else
- return config_activate_children(dev, act);
+ r = config_activate_children(dev, act);
+ device_unref(dev);
+ return (r);
}
/*
@@ -783,9 +787,10 @@ config_activate_children(struct device *parent, int act)
if (d->dv_parent != parent)
continue;
switch (act) {
+ case DVACT_QUIESCE:
case DVACT_SUSPEND:
case DVACT_RESUME:
- case DVACT_QUIESCE:
+ case DVACT_WAKEUP:
case DVACT_POWERDOWN:
rv = config_suspend(d, act);
break;