diff options
| author | martin <martin@NetBSD.org> | 2013-04-06 14:57:38 +0000 |
|---|---|---|
| committer | martin <martin@NetBSD.org> | 2013-04-06 14:57:38 +0000 |
| commit | 2c07075f4fafbf33708ad9cfadaf2bd2c8710175 (patch) | |
| tree | 8a37ed14352a5344484da49987edc95432c7f04d /sys/dev | |
| parent | 3de540bc31a956c28295ba413d46bb459920aa9d (diff) | |
Debounce the "wlan button pressed" event via pmf PMFE_RADIO_OFF so we
can run the pmf stuff in thread context.
Diffstat (limited to 'sys/dev')
| -rw-r--r-- | sys/dev/ic/arn5008.c | 12 | ||||
| -rw-r--r-- | sys/dev/ic/arn9003.c | 12 | ||||
| -rw-r--r-- | sys/dev/ic/athn.c | 24 |
3 files changed, 26 insertions, 22 deletions
diff --git a/sys/dev/ic/arn5008.c b/sys/dev/ic/arn5008.c index 99f904894bd..da4477c2d93 100644 --- a/sys/dev/ic/arn5008.c +++ b/sys/dev/ic/arn5008.c @@ -1,4 +1,4 @@ -/* $NetBSD: arn5008.c,v 1.2 2013/04/03 14:20:02 christos Exp $ */ +/* $NetBSD: arn5008.c,v 1.3 2013/04/06 14:57:38 martin Exp $ */ /* $OpenBSD: ar5008.c,v 1.21 2012/08/25 12:14:31 kettenis Exp $ */ /*- @@ -24,7 +24,7 @@ */ #include <sys/cdefs.h> -__KERNEL_RCSID(0, "$NetBSD: arn5008.c,v 1.2 2013/04/03 14:20:02 christos Exp $"); +__KERNEL_RCSID(0, "$NetBSD: arn5008.c,v 1.3 2013/04/06 14:57:38 martin Exp $"); #include <sys/param.h> #include <sys/sockio.h> @@ -1256,13 +1256,7 @@ ar5008_intr(struct athn_softc *sc) if ((sc->sc_flags & ATHN_FLAG_RFSILENT) && (sync & AR_INTR_SYNC_GPIO_PIN(sc->sc_rfsilent_pin))) { - struct ifnet *ifp = &sc->sc_if; - - printf("%s: radio switch turned off\n", - device_xname(sc->sc_dev)); - /* Turn the interface down. */ - ifp->if_flags &= ~IFF_UP; - athn_stop(ifp, 1); + pmf_event_inject(sc->sc_dev, PMFE_RADIO_OFF); return 1; } diff --git a/sys/dev/ic/arn9003.c b/sys/dev/ic/arn9003.c index af413c01276..6fcbea4fbbc 100644 --- a/sys/dev/ic/arn9003.c +++ b/sys/dev/ic/arn9003.c @@ -1,4 +1,4 @@ -/* $NetBSD: arn9003.c,v 1.2 2013/04/03 14:20:02 christos Exp $ */ +/* $NetBSD: arn9003.c,v 1.3 2013/04/06 14:57:38 martin Exp $ */ /* $OpenBSD: ar9003.c,v 1.25 2012/10/20 09:53:32 stsp Exp $ */ /*- @@ -24,7 +24,7 @@ */ #include <sys/cdefs.h> -__KERNEL_RCSID(0, "$NetBSD: arn9003.c,v 1.2 2013/04/03 14:20:02 christos Exp $"); +__KERNEL_RCSID(0, "$NetBSD: arn9003.c,v 1.3 2013/04/06 14:57:38 martin Exp $"); #include <sys/param.h> #include <sys/sockio.h> @@ -1406,13 +1406,7 @@ ar9003_intr(struct athn_softc *sc) if ((sc->sc_flags & ATHN_FLAG_RFSILENT) && (sync & AR_INTR_SYNC_GPIO_PIN(sc->sc_rfsilent_pin))) { - struct ifnet *ifp = &sc->sc_if; - - printf("%s: radio switch turned off\n", - device_xname(sc->sc_dev)); - /* Turn the interface down. */ - ifp->if_flags &= ~IFF_UP; - athn_stop(ifp, 1); + pmf_event_inject(sc->sc_dev, PMFE_RADIO_OFF); return 1; } diff --git a/sys/dev/ic/athn.c b/sys/dev/ic/athn.c index 0fb517359a0..41fab5f8863 100644 --- a/sys/dev/ic/athn.c +++ b/sys/dev/ic/athn.c @@ -1,4 +1,4 @@ -/* $NetBSD: athn.c,v 1.2 2013/04/05 19:14:31 martin Exp $ */ +/* $NetBSD: athn.c,v 1.3 2013/04/06 14:57:38 martin Exp $ */ /* $OpenBSD: athn.c,v 1.75 2013/01/14 09:50:31 jsing Exp $ */ /*- @@ -23,7 +23,7 @@ */ #include <sys/cdefs.h> -__KERNEL_RCSID(0, "$NetBSD: athn.c,v 1.2 2013/04/05 19:14:31 martin Exp $"); +__KERNEL_RCSID(0, "$NetBSD: athn.c,v 1.3 2013/04/06 14:57:38 martin Exp $"); #ifndef _MODULE #include "athn_usb.h" /* for NATHN_USB */ @@ -136,6 +136,9 @@ Static void athn_ani_restart(struct athn_softc *); Static void athn_set_multi(struct athn_softc *); #endif /* notyet */ +Static void athn_pmf_wlan_off(device_t self); + + PUBLIC int athn_attach(struct athn_softc *sc) { @@ -179,6 +182,8 @@ athn_attach(struct athn_softc *sc) } pmf_self_suspensor_init(sc->sc_dev, &sc->sc_suspensor, &sc->sc_qual); + pmf_event_register(sc->sc_dev, PMFE_RADIO_OFF, athn_pmf_wlan_off, + false); /* We can put the chip in sleep state now. */ athn_set_power_sleep(sc); @@ -230,7 +235,7 @@ athn_attach(struct athn_softc *sc) ((sc->sc_rxchainmask >> 0) & 1); if (AR_SINGLE_CHIP(sc)) { - aprint_normal("%s\n", athn_get_mac_name(sc)); + aprint_normal(": Atheros %s\n", athn_get_mac_name(sc)); aprint_verbose_dev(sc->sc_dev, "rev %d (%dT%dR), ROM rev %d, address %s\n", sc->sc_mac_rev, @@ -238,7 +243,7 @@ athn_attach(struct athn_softc *sc) ether_sprintf(ic->ic_myaddr)); } else { - aprint_normal("%s, RF %s\n", athn_get_mac_name(sc), + aprint_normal(": Atheros %s, RF %s\n", athn_get_mac_name(sc), athn_get_rf_name(sc)); aprint_verbose_dev(sc->sc_dev, "rev %d (%dT%dR), ROM rev %d, address %s\n", @@ -2952,6 +2957,17 @@ athn_stop(struct ifnet *ifp, int disable) pmf_device_recursive_suspend(sc->sc_dev, &sc->sc_qual); } +Static void +athn_pmf_wlan_off(device_t self) +{ + struct athn_softc *sc = device_private(self); + struct ifnet *ifp = &sc->sc_if; + + /* Turn the interface down. */ + ifp->if_flags &= ~IFF_UP; + athn_stop(ifp, 1); +} + PUBLIC void athn_suspend(struct athn_softc *sc) { |
