From dde7b00df07d5064317db5ff355091c989d5d684 Mon Sep 17 00:00:00 2001 From: Theo de Raadt Date: Fri, 6 Dec 2013 21:03:06 +0000 Subject: 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 --- sys/kern/subr_autoconf.c | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) (limited to 'sys/kern/subr_autoconf.c') 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; -- cgit v1.2.3