Author: adrian
Date: Sat Nov 15 01:18:49 2014
New Revision: 274535
URL: https://svnweb.freebsd.org/changeset/base/274535

Log:
  Convert the callouts back to using mutexes.
  
  I did this wrong - I should've included a state flag for each callout
  to see if it was supposed to run or not.  I didn't do that.
  Instead, just use mutexes anyway.
  
  Suggested by: jhb

Modified:
  head/sys/dev/ath/if_ath.c

Modified: head/sys/dev/ath/if_ath.c
==============================================================================
--- head/sys/dev/ath/if_ath.c   Fri Nov 14 23:52:06 2014        (r274534)
+++ head/sys/dev/ath/if_ath.c   Sat Nov 15 01:18:49 2014        (r274535)
@@ -669,8 +669,8 @@ ath_attach(u_int16_t devid, struct ath_s
                goto bad;
        }
 
-       callout_init(&sc->sc_cal_ch, 1);        /* MPSAFE */
-       callout_init(&sc->sc_wd_ch, 1);         /* MPSAFE */
+       callout_init_mtx(&sc->sc_cal_ch, &sc->sc_mtx, 0);
+       callout_init_mtx(&sc->sc_wd_ch, &sc->sc_mtx, 0);
 
        ATH_TXBUF_LOCK_INIT(sc);
 
@@ -5602,9 +5602,7 @@ ath_calibrate(void *arg)
        HAL_BOOL aniCal, shortCal = AH_FALSE;
        int nextcal;
 
-       ATH_UNLOCK_ASSERT(sc);
-
-       ATH_LOCK(sc);
+       ATH_LOCK_ASSERT(sc);
 
        /*
         * Force the hardware awake for ANI work.
@@ -5645,7 +5643,6 @@ ath_calibrate(void *arg)
                        taskqueue_enqueue(sc->sc_tq, &sc->sc_resettask);
                        callout_reset(&sc->sc_cal_ch, 1, ath_calibrate, sc);
                        ath_power_restore_power_state(sc);
-                       ATH_UNLOCK(sc);
                        return;
                }
                /*
@@ -5721,7 +5718,6 @@ restart:
         * Restore power state now that we're done.
         */
        ath_power_restore_power_state(sc);
-       ATH_UNLOCK(sc);
 }
 
 static void
@@ -6471,7 +6467,7 @@ ath_watchdog(void *arg)
        struct ath_softc *sc = arg;
        int do_reset = 0;
 
-       ATH_LOCK(sc);
+       ATH_LOCK_ASSERT(sc);
 
        if (sc->sc_wd_timer != 0 && --sc->sc_wd_timer == 0) {
                struct ifnet *ifp = sc->sc_ifp;
@@ -6503,8 +6499,6 @@ ath_watchdog(void *arg)
        }
 
        callout_schedule(&sc->sc_wd_ch, hz);
-
-       ATH_UNLOCK(sc);
 }
 
 /*
_______________________________________________
svn-src-all@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"

Reply via email to