diff options
author | Theo de Raadt <deraadt@cvs.openbsd.org> | 2010-08-08 16:36:34 +0000 |
---|---|---|
committer | Theo de Raadt <deraadt@cvs.openbsd.org> | 2010-08-08 16:36:34 +0000 |
commit | 0946234057183a7e0e4ac733ceb4983302b53f3d (patch) | |
tree | 27b575d8b4abae09793e38138acbbcbb5dbe9c4f | |
parent | 00c733b04cefd26163743557b97145c37d376439 (diff) |
activate function for suspend/restore; from mglocker
-rw-r--r-- | sys/dev/cardbus/if_malo_cardbus.c | 3 | ||||
-rw-r--r-- | sys/dev/ic/malo.c | 5 | ||||
-rw-r--r-- | sys/dev/ic/malo.h | 5 | ||||
-rw-r--r-- | sys/dev/pci/if_malo_pci.c | 38 |
4 files changed, 44 insertions, 7 deletions
diff --git a/sys/dev/cardbus/if_malo_cardbus.c b/sys/dev/cardbus/if_malo_cardbus.c index 230fc56ccb4..f548b425d45 100644 --- a/sys/dev/cardbus/if_malo_cardbus.c +++ b/sys/dev/cardbus/if_malo_cardbus.c @@ -1,4 +1,4 @@ -/* $OpenBSD: if_malo_cardbus.c,v 1.9 2010/03/27 21:40:13 jsg Exp $ */ +/* $OpenBSD: if_malo_cardbus.c,v 1.10 2010/08/08 16:36:33 deraadt Exp $ */ /* * Copyright (c) 2006 Claudio Jeker <claudio@openbsd.org> @@ -19,6 +19,7 @@ #include "bpfilter.h" #include <sys/param.h> +#include <sys/workq.h> #include <sys/mbuf.h> #include <sys/socket.h> #include <sys/systm.h> diff --git a/sys/dev/ic/malo.c b/sys/dev/ic/malo.c index c87afadadcc..3dd897f25f9 100644 --- a/sys/dev/ic/malo.c +++ b/sys/dev/ic/malo.c @@ -1,4 +1,4 @@ -/* $OpenBSD: malo.c,v 1.90 2010/05/19 15:27:35 oga Exp $ */ +/* $OpenBSD: malo.c,v 1.91 2010/08/08 16:36:33 deraadt Exp $ */ /* * Copyright (c) 2006 Claudio Jeker <claudio@openbsd.org> @@ -26,6 +26,7 @@ #include <sys/device.h> #include <sys/kernel.h> #include <sys/malloc.h> +#include <sys/workq.h> #include <sys/mbuf.h> #include <sys/proc.h> #include <sys/socket.h> @@ -248,10 +249,8 @@ int malo_alloc_tx_ring(struct malo_softc *sc, struct malo_tx_ring *ring, int count); void malo_reset_tx_ring(struct malo_softc *sc, struct malo_tx_ring *ring); void malo_free_tx_ring(struct malo_softc *sc, struct malo_tx_ring *ring); -int malo_init(struct ifnet *ifp); int malo_ioctl(struct ifnet *ifp, u_long cmd, caddr_t data); void malo_start(struct ifnet *ifp); -void malo_stop(struct malo_softc *sc); void malo_watchdog(struct ifnet *ifp); int malo_newstate(struct ieee80211com *ic, enum ieee80211_state nstate, int arg); diff --git a/sys/dev/ic/malo.h b/sys/dev/ic/malo.h index 91634cf1ec8..c0969d71d24 100644 --- a/sys/dev/ic/malo.h +++ b/sys/dev/ic/malo.h @@ -1,4 +1,4 @@ -/* $OpenBSD: malo.h,v 1.9 2006/11/24 20:45:33 mglocker Exp $ */ +/* $OpenBSD: malo.h,v 1.10 2010/08/08 16:36:33 deraadt Exp $ */ /* * Copyright (c) 2006 Claudio Jeker <claudio@openbsd.org> @@ -124,8 +124,11 @@ struct malo_softc { #define sc_txtap sc_txtapu.th int sc_txtap_len; #endif + struct workq_task sc_resume_wqt; }; int malo_intr(void *arg); int malo_attach(struct malo_softc *sc); int malo_detach(void *arg); +int malo_init(struct ifnet *); +void malo_stop(struct malo_softc *); diff --git a/sys/dev/pci/if_malo_pci.c b/sys/dev/pci/if_malo_pci.c index 0cdde5510b1..71dd98e96ad 100644 --- a/sys/dev/pci/if_malo_pci.c +++ b/sys/dev/pci/if_malo_pci.c @@ -1,4 +1,4 @@ -/* $OpenBSD: if_malo_pci.c,v 1.4 2009/03/29 21:53:52 sthen Exp $ */ +/* $OpenBSD: if_malo_pci.c,v 1.5 2010/08/08 16:36:33 deraadt Exp $ */ /* * Copyright (c) 2006 Marcus Glocker <mglocker@openbsd.org> @@ -24,6 +24,7 @@ #include <sys/param.h> #include <sys/sockio.h> +#include <sys/workq.h> #include <sys/mbuf.h> #include <sys/kernel.h> #include <sys/socket.h> @@ -58,6 +59,8 @@ int malo_pci_match(struct device *, void *, void *); void malo_pci_attach(struct device *, struct device *, void *); int malo_pci_detach(struct device *, int); +int malo_pci_activate(struct device *, int); +void malo_pci_resume(void *, void *); struct malo_pci_softc { struct malo_softc sc_malo; @@ -71,7 +74,7 @@ struct malo_pci_softc { struct cfattach malo_pci_ca = { sizeof(struct malo_pci_softc), malo_pci_match, malo_pci_attach, - malo_pci_detach + malo_pci_detach, malo_pci_activate }; const struct pci_matchid malo_pci_devices[] = { @@ -151,3 +154,34 @@ malo_pci_detach(struct device *self, int flags) return (0); } + +int +malo_pci_activate(struct device *self, int act) +{ + struct malo_pci_softc *psc = (struct malo_pci_softc *)self; + struct malo_softc *sc = &psc->sc_malo; + struct ifnet *ifp = &sc->sc_ic.ic_if; + + switch (act) { + case DVACT_SUSPEND: + if (ifp->if_flags & IFF_RUNNING) + malo_stop(sc); + break; + case DVACT_RESUME: + workq_queue_task(NULL, &sc->sc_resume_wqt, 0, + malo_pci_resume, sc, NULL); + break; +} + + return (0); +} + +void +malo_pci_resume(void *arg1, void *arg2) +{ + struct malo_softc *sc = arg1; + struct ifnet *ifp = &sc->sc_ic.ic_if; + + if (ifp->if_flags & IFF_UP) + malo_init(ifp); +} |