aboutsummaryrefslogtreecommitdiff
path: root/sys/dev/fatm
diff options
context:
space:
mode:
authorMarius Strobl <marius@FreeBSD.org>2011-10-30 01:13:47 +0000
committerMarius Strobl <marius@FreeBSD.org>2011-10-30 01:13:47 +0000
commit7651f160e18fe8587c7fd0cfa1e335d19fd6817b (patch)
treecb7ccb10a7dbcd2bd7ab11322e61d1fd31f71cdd /sys/dev/fatm
parent679dbf129f591ef86b861133e57cef0e02de75d8 (diff)
Notes
Diffstat (limited to 'sys/dev/fatm')
-rw-r--r--sys/dev/fatm/if_fatm.c21
-rw-r--r--sys/dev/fatm/if_fatmvar.h1
2 files changed, 11 insertions, 11 deletions
diff --git a/sys/dev/fatm/if_fatm.c b/sys/dev/fatm/if_fatm.c
index 2138db25b851..5dd0c1ddf233 100644
--- a/sys/dev/fatm/if_fatm.c
+++ b/sys/dev/fatm/if_fatm.c
@@ -391,16 +391,14 @@ fatm_check_heartbeat(struct fatm_softc *sc)
* Ensure that the heart is still beating.
*/
static void
-fatm_watchdog(struct ifnet *ifp)
+fatm_watchdog(void *arg)
{
- struct fatm_softc *sc = ifp->if_softc;
+ struct fatm_softc *sc;
- FATM_LOCK(sc);
- if (ifp->if_drv_flags & IFF_DRV_RUNNING) {
- fatm_check_heartbeat(sc);
- ifp->if_timer = 5;
- }
- FATM_UNLOCK(sc);
+ sc = arg;
+ FATM_CHECKLOCK(sc);
+ fatm_check_heartbeat(sc);
+ callout_reset(&sc->watchdog_timer, hz * 5, fatm_watchdog, sc);
}
/*
@@ -474,7 +472,7 @@ fatm_stop(struct fatm_softc *sc)
(void)fatm_reset(sc);
/* stop watchdog */
- sc->ifp->if_timer = 0;
+ callout_stop(&sc->watchdog_timer);
if (sc->ifp->if_drv_flags & IFF_DRV_RUNNING) {
sc->ifp->if_drv_flags &= ~(IFF_DRV_RUNNING | IFF_DRV_OACTIVE);
@@ -1341,7 +1339,7 @@ fatm_init_locked(struct fatm_softc *sc)
/*
* Start the watchdog timer
*/
- sc->ifp->if_timer = 5;
+ callout_reset(&sc->watchdog_timer, hz * 5, fatm_watchdog, sc);
/* start SUNI */
utopia_start(&sc->utopia);
@@ -2543,6 +2541,7 @@ fatm_detach(device_t dev)
FATM_UNLOCK(sc);
atm_ifdetach(sc->ifp); /* XXX race */
}
+ callout_drain(&sc->watchdog_timer);
if (sc->ih != NULL)
bus_teardown_intr(dev, sc->irqres, sc->ih);
@@ -2784,6 +2783,7 @@ fatm_attach(device_t dev)
cv_init(&sc->cv_regs, "fatm_regs");
sysctl_ctx_init(&sc->sysctl_ctx);
+ callout_init_mtx(&sc->watchdog_timer, &sc->mtx, 0);
/*
* Make the sysctl tree
@@ -2824,7 +2824,6 @@ fatm_attach(device_t dev)
ifp->if_flags = IFF_SIMPLEX;
ifp->if_ioctl = fatm_ioctl;
ifp->if_start = fatm_start;
- ifp->if_watchdog = fatm_watchdog;
ifp->if_init = fatm_init;
ifp->if_linkmib = &IFP2IFATM(sc->ifp)->mib;
ifp->if_linkmiblen = sizeof(IFP2IFATM(sc->ifp)->mib);
diff --git a/sys/dev/fatm/if_fatmvar.h b/sys/dev/fatm/if_fatmvar.h
index 697e91543bd7..bcd87599eaba 100644
--- a/sys/dev/fatm/if_fatmvar.h
+++ b/sys/dev/fatm/if_fatmvar.h
@@ -188,6 +188,7 @@ struct fatm_softc {
struct ifnet *ifp; /* common part */
struct mtx mtx; /* lock this structure */
struct ifmedia media; /* media */
+ struct callout watchdog_timer;
int init_state; /* initialisation step */
int memid; /* resource id for card memory */