From owner-svn-src-head@FreeBSD.ORG Wed May 27 22:30:22 2015 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 BC82C5F9; Wed, 27 May 2015 22:30:22 +0000 (UTC) (envelope-from glebius@FreeBSD.org) 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 9024FD3C; Wed, 27 May 2015 22:30:22 +0000 (UTC) (envelope-from glebius@FreeBSD.org) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.9/8.14.9) with ESMTP id t4RMUMVq078002; Wed, 27 May 2015 22:30:22 GMT (envelope-from glebius@FreeBSD.org) Received: (from glebius@localhost) by svn.freebsd.org (8.14.9/8.14.9/Submit) id t4RMULAA077998; Wed, 27 May 2015 22:30:21 GMT (envelope-from glebius@FreeBSD.org) Message-Id: <201505272230.t4RMULAA077998@svn.freebsd.org> X-Authentication-Warning: svn.freebsd.org: glebius set sender to glebius@FreeBSD.org using -f From: Gleb Smirnoff Date: Wed, 27 May 2015 22:30:21 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r283639 - head/sys/dev/bwi 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.20 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: Wed, 27 May 2015 22:30:22 -0000 Author: glebius Date: Wed May 27 22:30:21 2015 New Revision: 283639 URL: https://svnweb.freebsd.org/changeset/base/283639 Log: To avoid sleeping in firmware_get() with bwi mutex held, call bwi_mac_fw_alloc() at the device attach, not in the interface init. Modified: head/sys/dev/bwi/bwimac.c head/sys/dev/bwi/bwimac.h head/sys/dev/bwi/if_bwi.c Modified: head/sys/dev/bwi/bwimac.c ============================================================================== --- head/sys/dev/bwi/bwimac.c Wed May 27 22:29:19 2015 (r283638) +++ head/sys/dev/bwi/bwimac.c Wed May 27 22:30:21 2015 (r283639) @@ -101,7 +101,6 @@ static void bwi_mac_opmode_init(struct b static void bwi_mac_hostflags_init(struct bwi_mac *); static void bwi_mac_bss_param_init(struct bwi_mac *); -static int bwi_mac_fw_alloc(struct bwi_mac *); static void bwi_mac_fw_free(struct bwi_mac *); static int bwi_mac_fw_load(struct bwi_mac *); static int bwi_mac_fw_init(struct bwi_mac *); @@ -325,10 +324,6 @@ bwi_mac_init(struct bwi_mac *mac) /* * Load and initialize firmwares */ - error = bwi_mac_fw_alloc(mac); - if (error) - return error; - error = bwi_mac_fw_load(mac); if (error) return error; @@ -879,7 +874,7 @@ bwi_fwimage_is_valid(struct bwi_softc *s /* * XXX Error cleanup */ -static int +int bwi_mac_fw_alloc(struct bwi_mac *mac) { struct bwi_softc *sc = mac->mac_sc; Modified: head/sys/dev/bwi/bwimac.h ============================================================================== --- head/sys/dev/bwi/bwimac.h Wed May 27 22:29:19 2015 (r283638) +++ head/sys/dev/bwi/bwimac.h Wed May 27 22:30:21 2015 (r283639) @@ -57,6 +57,7 @@ void bwi_mac_init_tpctl_11bg(struct bwi void bwi_mac_dummy_xmit(struct bwi_mac *); void bwi_mac_reset_hwkeys(struct bwi_mac *); int bwi_mac_config_ps(struct bwi_mac *); +int bwi_mac_fw_alloc(struct bwi_mac *); uint16_t bwi_memobj_read_2(struct bwi_mac *, uint16_t, uint16_t); uint32_t bwi_memobj_read_4(struct bwi_mac *, uint16_t, uint16_t); Modified: head/sys/dev/bwi/if_bwi.c ============================================================================== --- head/sys/dev/bwi/if_bwi.c Wed May 27 22:29:19 2015 (r283638) +++ head/sys/dev/bwi/if_bwi.c Wed May 27 22:30:21 2015 (r283639) @@ -446,6 +446,10 @@ bwi_attach(struct bwi_softc *sc) if (error) goto fail; + error = bwi_mac_fw_alloc(mac); + if (error) + goto fail; + ifp = sc->sc_ifp = if_alloc(IFT_IEEE80211); if (ifp == NULL) { device_printf(dev, "can not if_alloc()\n");