From: Arend van Spriel Date: Wed, 3 Apr 2013 10:40:48 +0000 (+0200) Subject: brcmfmac: only allocate firmware-signalling resources if required X-Git-Url: http://git.lede-project.org./?a=commitdiff_plain;h=47829f4fc4825ad3a50389a682a6ea954664ba79;p=openwrt%2Fstaging%2Fblogic.git brcmfmac: only allocate firmware-signalling resources if required Bail out of brcmf_fws_init() when no firmware-signalling is asked for. Need to take this into account in brcmf_fws_deinit() as well. Reviewed-by: Pieter-Paul Giesberts Reviewed-by: Piotr Haber Signed-off-by: Arend van Spriel Signed-off-by: John W. Linville --- diff --git a/drivers/net/wireless/brcm80211/brcmfmac/dhd_linux.c b/drivers/net/wireless/brcm80211/brcmfmac/dhd_linux.c index d37620e93e61..c82f3e0b66f9 100644 --- a/drivers/net/wireless/brcm80211/brcmfmac/dhd_linux.c +++ b/drivers/net/wireless/brcm80211/brcmfmac/dhd_linux.c @@ -982,8 +982,7 @@ void brcmf_detach(struct device *dev) if (drvr->prot) brcmf_proto_detach(drvr); - if (drvr->fws) - brcmf_fws_deinit(drvr); + brcmf_fws_deinit(drvr); brcmf_debugfs_detach(drvr); bus_if->drvr = NULL; diff --git a/drivers/net/wireless/brcm80211/brcmfmac/fwsignal.c b/drivers/net/wireless/brcm80211/brcmfmac/fwsignal.c index 8b09973309c9..430baa249465 100644 --- a/drivers/net/wireless/brcm80211/brcmfmac/fwsignal.c +++ b/drivers/net/wireless/brcm80211/brcmfmac/fwsignal.c @@ -1224,11 +1224,12 @@ int brcmf_fws_init(struct brcmf_pub *drvr) u32 tlv = 0; int rc; - /* enable rssi signals */ - if (drvr->fw_signals) - tlv = BRCMF_FWS_FLAGS_RSSI_SIGNALS | - BRCMF_FWS_FLAGS_XONXOFF_SIGNALS | - BRCMF_FWS_FLAGS_CREDIT_STATUS_SIGNALS; + if (!drvr->fw_signals) + return 0; + + tlv = BRCMF_FWS_FLAGS_RSSI_SIGNALS | + BRCMF_FWS_FLAGS_XONXOFF_SIGNALS | + BRCMF_FWS_FLAGS_CREDIT_STATUS_SIGNALS; spin_lock_init(&drvr->fws_spinlock); @@ -1277,6 +1278,9 @@ void brcmf_fws_deinit(struct brcmf_pub *drvr) struct brcmf_fws_info *fws = drvr->fws; ulong flags; + if (!fws) + return; + /* cleanup */ brcmf_fws_lock(drvr, flags); brcmf_fws_cleanup(fws, -1);