diff options
author | Theo de Raadt <deraadt@cvs.openbsd.org> | 2010-08-29 16:47:01 +0000 |
---|---|---|
committer | Theo de Raadt <deraadt@cvs.openbsd.org> | 2010-08-29 16:47:01 +0000 |
commit | 443ca83eb31088cd95697f0322e7497eff777fd5 (patch) | |
tree | bcab7a141cf31c5040cd85519e506cb5c6651117 /sys/dev/ic/rtw.c | |
parent | c6233fdc1f94e3a7d288d2e1d0e2b7ceea3e9070 (diff) |
Massage the powerhook functions into activate functions, and then call
them from the powerhook. Fix a few quibbles about the things done for
the IFF_RUNNING and IFF_UP cases
ok kettenis
Diffstat (limited to 'sys/dev/ic/rtw.c')
-rw-r--r-- | sys/dev/ic/rtw.c | 39 |
1 files changed, 21 insertions, 18 deletions
diff --git a/sys/dev/ic/rtw.c b/sys/dev/ic/rtw.c index 6b4961366c0..a94ec7e9f5c 100644 --- a/sys/dev/ic/rtw.c +++ b/sys/dev/ic/rtw.c @@ -1,4 +1,4 @@ -/* $OpenBSD: rtw.c,v 1.79 2010/08/27 04:09:19 deraadt Exp $ */ +/* $OpenBSD: rtw.c,v 1.80 2010/08/29 16:46:58 deraadt Exp $ */ /* $NetBSD: rtw.c,v 1.29 2004/12/27 19:49:16 dyoung Exp $ */ /*- @@ -3593,32 +3593,35 @@ rtw_media_status(struct ifnet *ifp, struct ifmediareq *imr) ieee80211_media_status(ifp, imr); } -void -rtw_power(int why, void *arg) +int +rtw_activate(struct device *self, int act) { - struct rtw_softc *sc = arg; + struct rtw_softc *sc = (struct rtw_softc *)self; struct ifnet *ifp = &sc->sc_ic.ic_if; - int s; - DPRINTF(sc, RTW_DEBUG_PWR, - ("%s: rtw_power(%d,)\n", sc->sc_dev.dv_xname, why)); - - s = splnet(); - switch (why) { - case PWR_SUSPEND: - rtw_stop(ifp, 1); - if (sc->sc_power != NULL) - (*sc->sc_power)(sc, why); + switch (act) { + case DVACT_SUSPEND: + if (ifp->if_flags & IFF_RUNNING) { + rtw_stop(ifp, 1); + if (sc->sc_power != NULL) + (*sc->sc_power)(sc, act); + } break; - case PWR_RESUME: + case DVACT_RESUME: if (ifp->if_flags & IFF_UP) { if (sc->sc_power != NULL) - (*sc->sc_power)(sc, why); + (*sc->sc_power)(sc, act); rtw_init(ifp); } break; } - splx(s); + return 0; +} + +void +rtw_powerhook(int why, void *arg) +{ + rtw_activate(arg, why); } void @@ -3629,7 +3632,7 @@ rtw_establish_hooks(struct rtw_hooks *hooks, const char *dvname, * Add a suspend hook to make sure we come back up after a * resume. */ - hooks->rh_power = powerhook_establish(rtw_power, arg); + hooks->rh_power = powerhook_establish(rtw_powerhook, arg); if (hooks->rh_power == NULL) printf("%s: WARNING: unable to establish power hook\n", dvname); |