From owner-svn-src-all@FreeBSD.ORG Sun Mar 15 21:07:44 2015 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 481DD7FD; Sun, 15 Mar 2015 21:07:44 +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 1EA8475C; Sun, 15 Mar 2015 21:07:44 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.9/8.14.9) with ESMTP id t2FL7hZ2080385; Sun, 15 Mar 2015 21:07:43 GMT (envelope-from adrian@FreeBSD.org) Received: (from adrian@localhost) by svn.freebsd.org (8.14.9/8.14.9/Submit) id t2FL7hn8080384; Sun, 15 Mar 2015 21:07:43 GMT (envelope-from adrian@FreeBSD.org) Message-Id: <201503152107.t2FL7hn8080384@svn.freebsd.org> X-Authentication-Warning: svn.freebsd.org: adrian set sender to adrian@FreeBSD.org using -f From: Adrian Chadd Date: Sun, 15 Mar 2015 21:07:43 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r280096 - head/sys/dev/wpi X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.18-1 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 15 Mar 2015 21:07:44 -0000 Author: adrian Date: Sun Mar 15 21:07:43 2015 New Revision: 280096 URL: https://svnweb.freebsd.org/changeset/base/280096 Log: Merge wpi_init() and wpi_init_locked(). PR: kern/197143 Submitted by: Andriy Voskoboinyk Modified: head/sys/dev/wpi/if_wpi.c Modified: head/sys/dev/wpi/if_wpi.c ============================================================================== --- head/sys/dev/wpi/if_wpi.c Sun Mar 15 21:06:36 2015 (r280095) +++ head/sys/dev/wpi/if_wpi.c Sun Mar 15 21:07:43 2015 (r280096) @@ -263,7 +263,6 @@ static int wpi_hw_init(struct wpi_softc static void wpi_hw_stop(struct wpi_softc *); static void wpi_radio_on(void *, int); static void wpi_radio_off(void *, int); -static void wpi_init_locked(struct wpi_softc *); static void wpi_init(void *); static void wpi_stop_locked(struct wpi_softc *); static void wpi_stop(struct wpi_softc *); @@ -2972,13 +2971,11 @@ wpi_ioctl(struct ifnet *ifp, u_long cmd, break; case SIOCSIFFLAGS: if (ifp->if_flags & IFF_UP) { - if ((ifp->if_drv_flags & IFF_DRV_RUNNING) == 0) { - wpi_init(sc); + wpi_init(sc); - if ((ifp->if_drv_flags & IFF_DRV_RUNNING) == 0 && - vap != NULL) - ieee80211_stop(vap); - } + if ((ifp->if_drv_flags & IFF_DRV_RUNNING) == 0 && + vap != NULL) + ieee80211_stop(vap); } else if ((ifp->if_drv_flags & IFF_DRV_RUNNING) != 0) wpi_stop(sc); break; @@ -5175,14 +5172,19 @@ wpi_radio_off(void *arg0, int pending) } static void -wpi_init_locked(struct wpi_softc *sc) +wpi_init(void *arg) { + struct wpi_softc *sc = arg; struct ifnet *ifp = sc->sc_ifp; + struct ieee80211com *ic = ifp->if_l2com; int error; + WPI_LOCK(sc); + DPRINTF(sc, WPI_DEBUG_TRACE, TRACE_STR_BEGIN, __func__); - WPI_LOCK_ASSERT(sc); + if ((ifp->if_drv_flags & IFF_DRV_RUNNING) != 0) + goto end; /* Check that the radio is not disabled by hardware switch. */ if (!(WPI_READ(sc, WPI_GP_CNTRL) & WPI_GP_CNTRL_RFKILL)) { @@ -5190,7 +5192,7 @@ wpi_init_locked(struct wpi_softc *sc) "RF switch: radio disabled (%s)\n", __func__); callout_reset(&sc->watchdog_rfkill, hz, wpi_watchdog_rfkill, sc); - return; + goto end; } /* Read firmware images from the filesystem. */ @@ -5227,25 +5229,15 @@ wpi_init_locked(struct wpi_softc *sc) DPRINTF(sc, WPI_DEBUG_TRACE, TRACE_STR_END, __func__); - return; + WPI_UNLOCK(sc); -fail: wpi_stop_locked(sc); - DPRINTF(sc, WPI_DEBUG_TRACE, TRACE_STR_END_ERR, __func__); -} + ieee80211_start_all(ic); -static void -wpi_init(void *arg) -{ - struct wpi_softc *sc = arg; - struct ifnet *ifp = sc->sc_ifp; - struct ieee80211com *ic = ifp->if_l2com; + return; - WPI_LOCK(sc); - wpi_init_locked(sc); +fail: wpi_stop_locked(sc); +end: DPRINTF(sc, WPI_DEBUG_TRACE, TRACE_STR_END_ERR, __func__); WPI_UNLOCK(sc); - - if (ifp->if_drv_flags & IFF_DRV_RUNNING) - ieee80211_start_all(ic); } static void