net: wireless: bcmdhd: Prohibit FW access in case of FW crash
authorDmitry Shmidt <dimitrysh@google.com>
Wed, 7 Sep 2011 23:17:10 +0000 (16:17 -0700)
committermgross <mark.gross@intel.com>
Wed, 9 Nov 2011 20:24:04 +0000 (12:24 -0800)
Signed-off-by: Dmitry Shmidt <dimitrysh@google.com>
drivers/net/wireless/bcmdhd/dhd_cdc.c
drivers/net/wireless/bcmdhd/dhd_linux.c

index a86ea56..67d9481 100644 (file)
@@ -282,7 +282,7 @@ dhd_prot_ioctl(dhd_pub_t *dhd, int ifidx, wl_ioctl_t * ioc, void * buf, int len)
        int ret = -1;
        uint8 action;
 
-       if (dhd->busstate == DHD_BUS_DOWN) {
+       if ((dhd->busstate == DHD_BUS_DOWN) || dhd->hang_was_sent) {
                DHD_ERROR(("%s : bus is down. we have nothing to do\n", __FUNCTION__));
                goto done;
        }
index 61b1aef..6f19cb7 100644 (file)
@@ -2000,6 +2000,14 @@ dhd_ioctl_entry(struct net_device *net, struct ifreq *ifr, int cmd)
 
        DHD_OS_WAKE_LOCK(&dhd->pub);
 
+       /* send to dongle only if we are not waiting for reload already */
+       if (dhd->pub.hang_was_sent) {
+               DHD_ERROR(("%s: HANG was sent up earlier\n", __FUNCTION__));
+               DHD_OS_WAKE_LOCK_TIMEOUT_ENABLE(&dhd->pub, DHD_EVENT_TIMEOUT);
+               DHD_OS_WAKE_UNLOCK(&dhd->pub);
+               return OSL_ERROR(BCME_DONGLE_DOWN);
+       }
+
        ifidx = dhd_net2idx(dhd, net);
        DHD_TRACE(("%s: ifidx %d, cmd 0x%04x\n", __FUNCTION__, ifidx, cmd));
 
@@ -2078,14 +2086,6 @@ dhd_ioctl_entry(struct net_device *net, struct ifreq *ifr, int cmd)
                goto done;
        }
 
-       /* send to dongle only if we are not waiting for reload already */
-       if (dhd->pub.hang_was_sent) {
-               DHD_ERROR(("%s: HANG was sent up earlier. Not talking to the chip\n",
-                       __FUNCTION__));
-               bcmerror = BCME_DONGLE_DOWN;
-               goto done;
-       }
-
        /* check for local dhd ioctl and handle it */
        if (driver == DHD_IOCTL_MAGIC) {
                bcmerror = dhd_ioctl((void *)&dhd->pub, &ioc, buf, buflen);
@@ -2267,7 +2267,7 @@ dhd_stop(struct net_device *net)
        if (ifidx == 0)
                wl_android_wifi_off(net);
 #endif
-
+       dhd->pub.hang_was_sent = 0;
        OLD_MOD_DEC_USE_COUNT;
        return 0;
 }
@@ -2317,7 +2317,6 @@ dhd_open(struct net_device *net)
 #if defined(WL_CFG80211)
                DHD_ERROR(("\n%s\n", dhd_version));
                wl_android_wifi_on(net);
-               dhd->pub.hang_was_sent = 0;
 #endif
 
                if (dhd->pub.busstate != DHD_BUS_DATA) {