Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/trunk]: src/sys/dev/ic Debounce the "wlan button pressed" event via pmf ...
details: https://anonhg.NetBSD.org/src/rev/1d11c22b75d5
branches: trunk
changeset: 785922:1d11c22b75d5
user: martin <martin%NetBSD.org@localhost>
date: Sat Apr 06 14:57:38 2013 +0000
description:
Debounce the "wlan button pressed" event via pmf PMFE_RADIO_OFF so we
can run the pmf stuff in thread context.
diffstat:
sys/dev/ic/arn5008.c | 12 +++---------
sys/dev/ic/arn9003.c | 12 +++---------
sys/dev/ic/athn.c | 24 ++++++++++++++++++++----
3 files changed, 26 insertions(+), 22 deletions(-)
diffs (139 lines):
diff -r 207e24b11501 -r 1d11c22b75d5 sys/dev/ic/arn5008.c
--- a/sys/dev/ic/arn5008.c Sat Apr 06 14:54:05 2013 +0000
+++ b/sys/dev/ic/arn5008.c Sat Apr 06 14:57:38 2013 +0000
@@ -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 @@
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 -r 207e24b11501 -r 1d11c22b75d5 sys/dev/ic/arn9003.c
--- a/sys/dev/ic/arn9003.c Sat Apr 06 14:54:05 2013 +0000
+++ b/sys/dev/ic/arn9003.c Sat Apr 06 14:57:38 2013 +0000
@@ -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 @@
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 -r 207e24b11501 -r 1d11c22b75d5 sys/dev/ic/athn.c
--- a/sys/dev/ic/athn.c Sat Apr 06 14:54:05 2013 +0000
+++ b/sys/dev/ic/athn.c Sat Apr 06 14:57:38 2013 +0000
@@ -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_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 @@
}
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 @@
((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 @@
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 @@
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)
{
Home |
Main Index |
Thread Index |
Old Index