brcmfmac: only allocate firmware-signalling resources if required
authorArend van Spriel <arend@broadcom.com>
Wed, 3 Apr 2013 10:40:48 +0000 (12:40 +0200)
committerJohn W. Linville <linville@tuxdriver.com>
Wed, 3 Apr 2013 19:07:08 +0000 (15:07 -0400)
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 <pieterpg@broadcom.com>
Reviewed-by: Piotr Haber <phaber@broadcom.com>
Signed-off-by: Arend van Spriel <arend@broadcom.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
drivers/net/wireless/brcm80211/brcmfmac/dhd_linux.c
drivers/net/wireless/brcm80211/brcmfmac/fwsignal.c

index d37620e93e61961b9406989df323782ab7730e6d..c82f3e0b66f9d8f8449467feb2192c37c97cdef6 100644 (file)
@@ -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;
index 8b09973309c96c5fd12a1188d942016e43c63f83..430baa249465ecbb8da3a755144e0834d556fef7 100644 (file)
@@ -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);