diff options
author | 2005-05-22 01:10:23 +0000 | |
---|---|---|
committer | 2005-05-22 01:10:23 +0000 | |
commit | 5d17da0e62e3c77fa215367217c710b45a4e951c (patch) | |
tree | c181720a1ebbf1445ae32908cfcaf97154d30753 | |
parent | sync (diff) | |
download | wireguard-openbsd-5d17da0e62e3c77fa215367217c710b45a4e951c.tar.xz wireguard-openbsd-5d17da0e62e3c77fa215367217c710b45a4e951c.zip |
add power hook
-rw-r--r-- | sys/dev/ic/dc.c | 25 |
1 files changed, 24 insertions, 1 deletions
diff --git a/sys/dev/ic/dc.c b/sys/dev/ic/dc.c index 47cf84cf7ea..a7a60f4c01a 100644 --- a/sys/dev/ic/dc.c +++ b/sys/dev/ic/dc.c @@ -1,4 +1,4 @@ -/* $OpenBSD: dc.c,v 1.84 2005/04/30 21:38:05 brad Exp $ */ +/* $OpenBSD: dc.c,v 1.85 2005/05/22 01:10:23 brad Exp $ */ /* * Copyright (c) 1997, 1998, 1999 @@ -131,6 +131,7 @@ int dc_intr(void *); void dc_shutdown(void *); +void dc_power(int, void *); struct dc_type *dc_devtype(void *); int dc_newbuf(struct dc_softc *, int, struct mbuf *); int dc_encap(struct dc_softc *, struct mbuf *, u_int32_t *); @@ -1846,6 +1847,7 @@ hasmac: ether_ifattach(ifp); sc->sc_dhook = shutdownhook_establish(dc_shutdown, sc); + sc->sc_pwrhook = powerhook_establish(dc_power, sc); fail: return; @@ -1869,6 +1871,7 @@ dc_detach(sc) if_detach(ifp); shutdownhook_disestablish(sc->sc_dhook); + powerhook_disestablish(sc->sc_pwrhook); return (0); } @@ -3246,6 +3249,26 @@ dc_shutdown(v) dc_stop(sc); } +void +dc_power(why, arg) + int why; + void *arg; +{ + struct dc_softc *sc = arg; + struct ifnet *ifp; + int s; + + s = splimp(); + if (why != PWR_RESUME) + dc_stop(sc); + else { + ifp = &sc->sc_arpcom.ac_if; + if (ifp->if_flags & IFF_UP) + dc_init(sc); + } + splx(s); +} + struct cfdriver dc_cd = { 0, "dc", DV_IFNET }; |