From owner-p4-projects@FreeBSD.ORG Mon Oct 8 08:06:33 2007 Return-Path: Delivered-To: p4-projects@freebsd.org Received: by hub.freebsd.org (Postfix, from userid 32767) id 895E416A421; Mon, 8 Oct 2007 08:06:33 +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 BF97316A41B for ; Mon, 8 Oct 2007 08:06:32 +0000 (UTC) (envelope-from kevlo@freebsd.org) Received: from repoman.freebsd.org (repoman.freebsd.org [IPv6:2001:4f8:fff6::29]) by mx1.freebsd.org (Postfix) with ESMTP id 8EC9B13C465 for ; Mon, 8 Oct 2007 08:06:32 +0000 (UTC) (envelope-from kevlo@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 l9886WRQ081055 for ; Mon, 8 Oct 2007 08:06:32 GMT (envelope-from kevlo@freebsd.org) Received: (from perforce@localhost) by repoman.freebsd.org (8.14.1/8.14.1/Submit) id l9886WhV081052 for perforce@freebsd.org; Mon, 8 Oct 2007 08:06:32 GMT (envelope-from kevlo@freebsd.org) Date: Mon, 8 Oct 2007 08:06:32 GMT Message-Id: <200710080806.l9886WhV081052@repoman.freebsd.org> X-Authentication-Warning: repoman.freebsd.org: perforce set sender to kevlo@freebsd.org using -f From: Kevin Lo To: Perforce Change Reviews Cc: Subject: PERFORCE change 127300 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: Mon, 08 Oct 2007 08:06:33 -0000 http://perforce.freebsd.org/chv.cgi?CH=127300 Change 127300 by kevlo@kevlo_rtsl on 2007/10/08 08:05:43 Passed in the MTX_RECURSE argument of mtx_init(). This fixes a potential kernel panic problem after configuring a bwi interface. Affected files ... .. //depot/projects/wifi/sys/dev/bwi/bwirf.c#3 edit .. //depot/projects/wifi/sys/dev/bwi/if_bwi.c#4 edit .. //depot/projects/wifi/sys/dev/bwi/if_bwi_pci.c#3 edit .. //depot/projects/wifi/sys/dev/bwi/if_bwivar.h#3 edit Differences ... ==== //depot/projects/wifi/sys/dev/bwi/bwirf.c#3 (text+ko) ==== @@ -358,6 +358,7 @@ 0x0810, 0x002b, 0x0015 }; + struct bwi_softc *sc = mac->mac_sc; struct bwi_phy *phy = &mac->mac_phy; struct bwi_rf *rf = &mac->mac_rf; uint16_t save_phy[SAVE_PHY_MAX]; @@ -425,7 +426,7 @@ PHY_SETBITS(mac, 0x811, 0x100); PHY_CLRBITS(mac, 0x812, 0x3000); - if ((mac->mac_sc->sc_card_flags & BWI_CARD_F_EXT_LNA) && + if ((sc->sc_card_flags & BWI_CARD_F_EXT_LNA) && phy->phy_rev >= 7) { PHY_SETBITS(mac, 0x811, 0x800); PHY_SETBITS(mac, 0x812, 0x8000); ==== //depot/projects/wifi/sys/dev/bwi/if_bwi.c#4 (text+ko) ==== @@ -285,6 +285,8 @@ struct bwi_phy *phy; int i, error, bands; + BWI_LOCK_INIT(sc); + bwi_power_on(sc, 1); error = bwi_bbp_attach(sc); @@ -459,10 +461,10 @@ if (bootverbose) ieee80211_announce(ic); - return 0; + return (0); fail: - bwi_detach(sc); - return error; + BWI_LOCK_DESTROY(sc); + return (error); } int ==== //depot/projects/wifi/sys/dev/bwi/if_bwi_pci.c#3 (text+ko) ==== @@ -194,13 +194,10 @@ sc->sc_pci_subvid = pci_get_subvendor(dev); sc->sc_pci_subdid = pci_get_subdevice(dev); - BWI_LOCK_INIT(sc); - error = bwi_attach(sc); if (error == 0) /* success */ return 0; - BWI_LOCK_DESTROY(sc); bus_teardown_intr(dev, sc->sc_irq_res, sc->sc_irq_handle); bad2: bus_release_resource(dev, SYS_RES_IRQ, 0, sc->sc_irq_res); @@ -227,8 +224,6 @@ bus_release_resource(dev, SYS_RES_MEMORY, BS_BAR, sc->sc_mem_res); - BWI_LOCK_DESTROY(sc); - return (0); } ==== //depot/projects/wifi/sys/dev/bwi/if_bwivar.h#3 (text+ko) ==== @@ -590,10 +590,9 @@ #define BWI_F_BUS_INITED 0x1 #define BWI_F_PROMISC 0x2 -#define BWI_LOCK_INIT(sc) do { \ +#define BWI_LOCK_INIT(sc) \ mtx_init(&(sc)->sc_mtx, device_get_nameunit((sc)->sc_dev), \ - MTX_NETWORK_LOCK, MTX_DEF); \ -} while (0) + MTX_NETWORK_LOCK, MTX_DEF | MTX_RECURSE); #define BWI_LOCK_DESTROY(sc) mtx_destroy(&(sc)->sc_mtx) #define BWI_LOCK(sc) mtx_lock(&sc->sc_mtx) #define BWI_UNLOCK(sc) mtx_unlock(&sc->sc_mtx)