diff options
Diffstat (limited to 'sys/dev')
-rw-r--r-- | sys/dev/ic/ath.c | 71 | ||||
-rw-r--r-- | sys/dev/ic/athvar.h | 7 | ||||
-rw-r--r-- | sys/dev/pci/if_ath_pci.c | 23 |
3 files changed, 23 insertions, 78 deletions
diff --git a/sys/dev/ic/ath.c b/sys/dev/ic/ath.c index e3c148a0227..6973d94ae51 100644 --- a/sys/dev/ic/ath.c +++ b/sys/dev/ic/ath.c @@ -1,4 +1,4 @@ -/* $OpenBSD: ath.c,v 1.89 2010/08/27 17:08:00 jsg Exp $ */ +/* $OpenBSD: ath.c,v 1.90 2010/08/27 19:44:43 deraadt Exp $ */ /* $NetBSD: ath.c,v 1.37 2004/08/18 21:59:39 dyoung Exp $ */ /*- @@ -162,25 +162,30 @@ struct cfdriver ath_cd = { NULL, "ath", DV_IFNET }; -#if 0 int ath_activate(struct device *self, int act) { struct ath_softc *sc = (struct ath_softc *)self; - int rv = 0, s; + struct ifnet *ifp = &sc->sc_ic.ic_if; - s = splnet(); switch (act) { - case DVACT_ACTIVATE: + case DVACT_SUSPEND: + if (ifp->if_flags & IFF_RUNNING) { + ath_stop(ifp); + if (sc->sc_power != NULL) + (*sc->sc_power)(sc, act); + } break; - case DVACT_DEACTIVATE: - if_deactivate(&sc->sc_ic.ic_if); + case DVACT_RESUME: + if (ifp->if_flags & IFF_UP) { + ath_init(ifp); + if (ifp->if_flags & IFF_RUNNING) + ath_start(ifp); + } break; } - splx(s); - return rv; + return 0; } -#endif int ath_enable(struct ath_softc *sc) @@ -424,7 +429,7 @@ ath_attach(u_int16_t devid, struct ath_softc *sc) /* * Make sure the interface is shutdown during reboot. */ - sc->sc_powerhook = powerhook_establish(ath_power, sc); + sc->sc_powerhook = powerhook_establish(ath_powerhook, sc); if (sc->sc_powerhook == NULL) printf(": WARNING: unable to establish power hook\n"); @@ -487,49 +492,9 @@ ath_detach(struct ath_softc *sc, int flags) } void -ath_power(int why, void *arg) +ath_powerhook(int why, void *arg) { - struct ath_softc *sc = arg; - int s; - - DPRINTF(ATH_DEBUG_ANY, ("ath_power(%d)\n", why)); - - s = splnet(); - switch (why) { - case PWR_SUSPEND: - ath_suspend(sc, why); - break; - case PWR_RESUME: - ath_resume(sc, why); - break; - } - splx(s); -} - -void -ath_suspend(struct ath_softc *sc, int why) -{ - struct ifnet *ifp = &sc->sc_ic.ic_if; - - DPRINTF(ATH_DEBUG_ANY, ("%s: if_flags %x\n", __func__, ifp->if_flags)); - - ath_stop(ifp); - if (sc->sc_power != NULL) - (*sc->sc_power)(sc, why); -} - -void -ath_resume(struct ath_softc *sc, int why) -{ - struct ifnet *ifp = &sc->sc_ic.ic_if; - - DPRINTF(ATH_DEBUG_ANY, ("%s: if_flags %x\n", __func__, ifp->if_flags)); - - if (ifp->if_flags & IFF_UP) { - ath_init(ifp); - if (ifp->if_flags & IFF_RUNNING) - ath_start(ifp); - } + ath_activate(arg, why); } int diff --git a/sys/dev/ic/athvar.h b/sys/dev/ic/athvar.h index f8283475189..2d90c12c8e3 100644 --- a/sys/dev/ic/athvar.h +++ b/sys/dev/ic/athvar.h @@ -1,4 +1,4 @@ -/* $OpenBSD: athvar.h,v 1.29 2010/07/02 06:06:30 reyk Exp $ */ +/* $OpenBSD: athvar.h,v 1.30 2010/08/27 19:44:43 deraadt Exp $ */ /* $NetBSD: athvar.h,v 1.10 2004/08/10 01:03:53 dyoung Exp $ */ /*- @@ -407,9 +407,8 @@ typedef unsigned long u_intptr_t; int ath_attach(u_int16_t, struct ath_softc *); int ath_detach(struct ath_softc *, int); int ath_enable(struct ath_softc *); -void ath_resume(struct ath_softc *, int); -void ath_suspend(struct ath_softc *, int); -void ath_power(int, void *); +int ath_activate(struct device *, int); +void ath_powerhook(int, void *); int ath_intr(void *); int ath_enable(struct ath_softc *); diff --git a/sys/dev/pci/if_ath_pci.c b/sys/dev/pci/if_ath_pci.c index 74334a7eb6e..a7cef1e0171 100644 --- a/sys/dev/pci/if_ath_pci.c +++ b/sys/dev/pci/if_ath_pci.c @@ -1,4 +1,4 @@ -/* $OpenBSD: if_ath_pci.c,v 1.21 2010/07/02 06:08:38 reyk Exp $ */ +/* $OpenBSD: if_ath_pci.c,v 1.22 2010/08/27 19:44:44 deraadt Exp $ */ /* $NetBSD: if_ath_pci.c,v 1.7 2004/06/30 05:58:17 mycroft Exp $ */ /*- @@ -91,14 +91,13 @@ struct ath_pci_softc { int ath_pci_match(struct device *, void *, void *); void ath_pci_attach(struct device *, struct device *, void *); int ath_pci_detach(struct device *, int); -int ath_pci_activate(struct device *, int); struct cfattach ath_pci_ca = { sizeof(struct ath_pci_softc), ath_pci_match, ath_pci_attach, ath_pci_detach, - ath_pci_activate + ath_activate }; int @@ -207,21 +206,3 @@ ath_pci_detach(struct device *self, int flags) return (0); } - -int -ath_pci_activate(struct device *self, int act) -{ - struct ath_pci_softc *psc = (struct ath_pci_softc *)self; - struct ath_softc *sc = &psc->sc_sc; - - switch (act) { - case DVACT_SUSPEND: - /* It is safe to call ath's power hooks */ - ath_power(PWR_SUSPEND, sc); - break; - case DVACT_RESUME: - ath_power(PWR_RESUME, sc); - break; - } - return (0); -} |