diff options
author | Damien Bergamini <damien@cvs.openbsd.org> | 2010-08-04 19:49:50 +0000 |
---|---|---|
committer | Damien Bergamini <damien@cvs.openbsd.org> | 2010-08-04 19:49:50 +0000 |
commit | d91b36821a04cee6059a7cb0890d7cf69e86635d (patch) | |
tree | f42432c85e8d4c3482d990b5dc432b490fd4374d | |
parent | 0126dd6fb799c4d32dff3b0e343b89e8ee793fbf (diff) |
use a workq for resume.
ok deraadt@
-rw-r--r-- | sys/dev/pci/if_athn_pci.c | 23 |
1 files changed, 20 insertions, 3 deletions
diff --git a/sys/dev/pci/if_athn_pci.c b/sys/dev/pci/if_athn_pci.c index d8aad078748..e219d848f74 100644 --- a/sys/dev/pci/if_athn_pci.c +++ b/sys/dev/pci/if_athn_pci.c @@ -1,4 +1,4 @@ -/* $OpenBSD: if_athn_pci.c,v 1.7 2010/07/21 14:01:58 kettenis Exp $ */ +/* $OpenBSD: if_athn_pci.c,v 1.8 2010/08/04 19:49:49 damien Exp $ */ /*- * Copyright (c) 2009 Damien Bergamini <damien.bergamini@free.fr> @@ -31,6 +31,7 @@ #include <sys/malloc.h> #include <sys/timeout.h> #include <sys/device.h> +#include <sys/workq.h> #include <machine/bus.h> #include <machine/intr.h> @@ -66,12 +67,14 @@ struct athn_pci_softc { void *sc_ih; bus_size_t sc_mapsize; int sc_cap_off; + struct workq_task sc_resume_wqt; }; int athn_pci_match(struct device *, void *, void *); void athn_pci_attach(struct device *, struct device *, void *); int athn_pci_detach(struct device *, int); int athn_pci_activate(struct device *, int); +void athn_pci_resume(void *, void *); void athn_pci_disable_aspm(struct athn_softc *); struct cfattach athn_pci_ca = { @@ -199,14 +202,16 @@ athn_pci_detach(struct device *self, int flags) int athn_pci_activate(struct device *self, int act) { - struct athn_softc *sc = (struct athn_softc *)self; + struct athn_pci_softc *psc = (struct athn_pci_softc *)self; + struct athn_softc *sc = &psc->sc_sc; switch (act) { case DVACT_SUSPEND: athn_suspend(sc); break; case DVACT_RESUME: - athn_resume(sc); + workq_queue_task(NULL, &psc->sc_resume_wqt, 0, + athn_pci_resume, psc, NULL); break; } @@ -214,6 +219,18 @@ athn_pci_activate(struct device *self, int act) } void +athn_pci_resume(void *arg1, void *arg2) +{ + struct athn_pci_softc *psc = arg1; + struct athn_softc *sc = &psc->sc_sc; + int s; + + s = splnet(); + athn_resume(sc); + splx(s); +} + +void athn_pci_disable_aspm(struct athn_softc *sc) { struct athn_pci_softc *psc = (struct athn_pci_softc *)sc; |