summaryrefslogtreecommitdiffstats
path: root/sys/dev/ral/rt2661.c
diff options
context:
space:
mode:
authorbms <bms@FreeBSD.org>2006-12-19 17:37:41 +0000
committerbms <bms@FreeBSD.org>2006-12-19 17:37:41 +0000
commit67bf87cf4e1119299b1ac70dc9c3c4a7392a3849 (patch)
treea080a5cabbf3615f2a1f98fc907276cba559bd2c /sys/dev/ral/rt2661.c
parent40229d31245e432abbbe2605e3916dfa1ddaa17e (diff)
downloadFreeBSD-src-67bf87cf4e1119299b1ac70dc9c3c4a7392a3849.zip
FreeBSD-src-67bf87cf4e1119299b1ac70dc9c3c4a7392a3849.tar.gz
Remove dependency on deprecated if_watchdog ABI.
Tested with a Sitecom RT2661 based card.
Diffstat (limited to 'sys/dev/ral/rt2661.c')
-rw-r--r--sys/dev/ral/rt2661.c23
1 files changed, 8 insertions, 15 deletions
diff --git a/sys/dev/ral/rt2661.c b/sys/dev/ral/rt2661.c
index ae2af21..c780edb 100644
--- a/sys/dev/ral/rt2661.c
+++ b/sys/dev/ral/rt2661.c
@@ -117,7 +117,7 @@ static int rt2661_tx_data(struct rt2661_softc *, struct mbuf *,
static int rt2661_tx_mgt(struct rt2661_softc *, struct mbuf *,
struct ieee80211_node *);
static void rt2661_start(struct ifnet *);
-static void rt2661_watchdog(struct ifnet *);
+static void rt2661_watchdog(void *);
static int rt2661_reset(struct ifnet *);
static int rt2661_ioctl(struct ifnet *, u_long, caddr_t);
static void rt2661_bbp_write(struct rt2661_softc *, uint8_t,
@@ -209,6 +209,7 @@ rt2661_attach(device_t dev, int id)
mtx_init(&sc->sc_mtx, device_get_nameunit(dev), MTX_NETWORK_LOCK,
MTX_DEF | MTX_RECURSE);
+ callout_init_mtx(&sc->watchdog_ch, &sc->sc_mtx, 0);
callout_init(&sc->scan_ch, debug_mpsafenet ? CALLOUT_MPSAFE : 0);
callout_init(&sc->rssadapt_ch, CALLOUT_MPSAFE);
@@ -293,7 +294,6 @@ rt2661_attach(device_t dev, int id)
ifp->if_init = rt2661_init;
ifp->if_ioctl = rt2661_ioctl;
ifp->if_start = rt2661_start;
- ifp->if_watchdog = rt2661_watchdog;
IFQ_SET_MAXLEN(&ifp->if_snd, IFQ_MAXLEN);
ifp->if_snd.ifq_drv_maxlen = IFQ_MAXLEN;
IFQ_SET_READY(&ifp->if_snd);
@@ -407,6 +407,7 @@ rt2661_detach(void *xsc)
struct ifnet *ifp = ic->ic_ifp;
rt2661_stop(sc);
+ callout_stop(&sc->watchdog_ch);
callout_stop(&sc->scan_ch);
callout_stop(&sc->rssadapt_ch);
@@ -1853,36 +1854,29 @@ rt2661_start(struct ifnet *ifp)
}
sc->sc_tx_timer = 5;
- ifp->if_timer = 1;
+ callout_reset(&sc->watchdog_ch, hz, rt2661_watchdog, sc);
}
RAL_UNLOCK(sc);
}
static void
-rt2661_watchdog(struct ifnet *ifp)
+rt2661_watchdog(void *arg)
{
- struct rt2661_softc *sc = ifp->if_softc;
+ struct rt2661_softc *sc = (struct rt2661_softc *)arg;
struct ieee80211com *ic = &sc->sc_ic;
- RAL_LOCK(sc);
-
- ifp->if_timer = 0;
-
if (sc->sc_tx_timer > 0) {
if (--sc->sc_tx_timer == 0) {
device_printf(sc->sc_dev, "device timeout\n");
rt2661_init(sc);
- ifp->if_oerrors++;
- RAL_UNLOCK(sc);
+ sc->sc_ifp->if_oerrors++;
return;
}
- ifp->if_timer = 1;
+ callout_reset(&sc->watchdog_ch, hz, rt2661_watchdog, sc);
}
ieee80211_watchdog(ic);
-
- RAL_UNLOCK(sc);
}
/*
@@ -2619,7 +2613,6 @@ rt2661_stop(void *priv)
uint32_t tmp;
sc->sc_tx_timer = 0;
- ifp->if_timer = 0;
ifp->if_drv_flags &= ~(IFF_DRV_RUNNING | IFF_DRV_OACTIVE);
ieee80211_new_state(ic, IEEE80211_S_INIT, -1);
OpenPOWER on IntegriCloud