From owner-svn-src-head@FreeBSD.ORG Sat Nov 15 01:18:50 2014 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 38791C75; Sat, 15 Nov 2014 01:18:50 +0000 (UTC) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 0B6C7D56; Sat, 15 Nov 2014 01:18:50 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.9/8.14.9) with ESMTP id sAF1InUs074396; Sat, 15 Nov 2014 01:18:49 GMT (envelope-from adrian@FreeBSD.org) Received: (from adrian@localhost) by svn.freebsd.org (8.14.9/8.14.9/Submit) id sAF1InDS074395; Sat, 15 Nov 2014 01:18:49 GMT (envelope-from adrian@FreeBSD.org) Message-Id: <201411150118.sAF1InDS074395@svn.freebsd.org> X-Authentication-Warning: svn.freebsd.org: adrian set sender to adrian@FreeBSD.org using -f From: Adrian Chadd Date: Sat, 15 Nov 2014 01:18:49 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r274535 - head/sys/dev/ath X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.18-1 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 15 Nov 2014 01:18:50 -0000 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); } /*