From owner-p4-projects@FreeBSD.ORG Fri May 2 01:08:29 2008 Return-Path: Delivered-To: p4-projects@freebsd.org Received: by hub.freebsd.org (Postfix, from userid 32767) id 6391F1065674; Fri, 2 May 2008 01:08:29 +0000 (UTC) Delivered-To: perforce@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 2621D106566B for ; Fri, 2 May 2008 01:08:29 +0000 (UTC) (envelope-from thompsa@freebsd.org) Received: from repoman.freebsd.org (repoman.freebsd.org [IPv6:2001:4f8:fff6::29]) by mx1.freebsd.org (Postfix) with ESMTP id 119578FC20 for ; Fri, 2 May 2008 01:08:29 +0000 (UTC) (envelope-from thompsa@freebsd.org) Received: from repoman.freebsd.org (localhost [127.0.0.1]) by repoman.freebsd.org (8.14.1/8.14.1) with ESMTP id m4218S8a080245 for ; Fri, 2 May 2008 01:08:28 GMT (envelope-from thompsa@freebsd.org) Received: (from perforce@localhost) by repoman.freebsd.org (8.14.1/8.14.1/Submit) id m4218Skd080243 for perforce@freebsd.org; Fri, 2 May 2008 01:08:28 GMT (envelope-from thompsa@freebsd.org) Date: Fri, 2 May 2008 01:08:28 GMT Message-Id: <200805020108.m4218Skd080243@repoman.freebsd.org> X-Authentication-Warning: repoman.freebsd.org: perforce set sender to thompsa@freebsd.org using -f From: Andrew Thompson To: Perforce Change Reviews Cc: Subject: PERFORCE change 141022 for review X-BeenThere: p4-projects@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: p4 projects tree changes List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 02 May 2008 01:08:29 -0000 http://perforce.freebsd.org/chv.cgi?CH=141022 Change 141022 by thompsa@thompsa_burger on 2008/05/02 01:08:28 Move the locking into bwi_init() so we only lock once for SIOCSIFFLAGS Affected files ... .. //depot/projects/vap/sys/dev/bwi/if_bwi.c#15 edit Differences ... ==== //depot/projects/vap/sys/dev/bwi/if_bwi.c#15 (text+ko) ==== @@ -1220,7 +1220,9 @@ static void bwi_init(void *xsc) { + BWI_LOCK(sc); bwi_init_statechg(xsc, 1); + BWI_UNLOCK(sc); } static void @@ -1231,8 +1233,6 @@ struct bwi_mac *mac; int error; - BWI_LOCK(sc); - bwi_stop_locked(sc, statechg); bwi_bbp_power_on(sc, BWI_CLOCK_MODE_FAST); @@ -1296,12 +1296,9 @@ /* Enable intrs */ bwi_enable_intrs(sc, BWI_INIT_INTRS); - - BWI_UNLOCK(sc); return; bad: bwi_stop_locked(sc, 1); - BWI_UNLOCK(sc); } static int @@ -1312,7 +1309,7 @@ struct bwi_softc *sc = ifp->if_softc; struct ieee80211com *ic = ifp->if_l2com; struct ifreq *ifr = (struct ifreq *) data; - int error = 0; + int error = 0, startall = 0; switch (cmd) { case SIOCSIFFLAGS: @@ -1339,17 +1336,19 @@ if (promisc >= 0) bwi_mac_set_promisc(mac, promisc); } - BWI_UNLOCK(sc); if (ifp->if_flags & IFF_UP) { if ((ifp->if_drv_flags & IFF_DRV_RUNNING) == 0) { - bwi_init(sc); - ieee80211_start_all(ic); + bwi_init_statechg(xsc, 1); + startall = 1; } } else { if (ifp->if_drv_flags & IFF_DRV_RUNNING) - bwi_stop(sc, 1); + bwi_stop_locked(sc, 1); } + BWI_UNLOCK(sc); + if (startall) + ieee80211_start_all(ic); break; case SIOCGIFMEDIA: error = ifmedia_ioctl(ifp, ifr, &ic->ic_media, cmd); @@ -4021,7 +4020,9 @@ struct ifnet *ifp = sc->sc_ifp; if_printf(ifp, "%s begin, help!\n", __func__); + BWI_LOCK(sc); bwi_init_statechg(xsc, 0); + BWI_UNLOCK(sc); #if 0 bwi_start_locked(ifp); #endif