From: damien Date: Wed, 4 Aug 2010 19:49:49 +0000 (+0000) Subject: use a workq for resume. X-Git-Url: http://artulab.com/gitweb/?a=commitdiff_plain;h=0ac915e4f0db4d1975ea557e2ff0dfd2a8efc45a;p=openbsd use a workq for resume. ok deraadt@ --- 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 @@ -31,6 +31,7 @@ #include #include #include +#include #include #include @@ -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,20 +202,34 @@ 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; } return (0); } +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) {