Merge remote-tracking branch 'remotes/aosp/android-3.0' into develop-3.0
[firefly-linux-kernel-4.4.55.git] / drivers / net / wireless / bcm4329 / dhd_cdc.c
index a68ad61c58b4f8d6596bb8e27f604d902b0e2c46..5ac864879829f4ed6789c083da0b31f11cf7875d 100644 (file)
@@ -152,7 +152,8 @@ dhdcdc_query_ioctl(dhd_pub_t *dhd, int ifidx, uint cmd, void *buf, uint len)
                memcpy(prot->buf, buf, len);
 
        if ((ret = dhdcdc_msg(dhd)) < 0) {
-               DHD_ERROR(("dhdcdc_query_ioctl: dhdcdc_msg failed w/status %d\n", ret));
+               if (!dhd->hang_was_sent)
+                       DHD_ERROR(("dhdcdc_query_ioctl: dhdcdc_msg failed w/status %d\n", ret));
                goto done;
        }
 
@@ -207,6 +208,18 @@ dhdcdc_set_ioctl(dhd_pub_t *dhd, int ifidx, uint cmd, void *buf, uint len)
        DHD_TRACE(("%s: Enter\n", __FUNCTION__));
        DHD_CTL(("%s: cmd %d len %d\n", __FUNCTION__, cmd, len));
 
+       if (dhd->busstate == DHD_BUS_DOWN) {
+               DHD_ERROR(("%s : bus is down. we have nothing to do\n", __FUNCTION__));
+               return -EIO;
+       }
+
+       /* don't talk to the dongle if fw is about to be reloaded */
+       if (dhd->hang_was_sent) {
+               DHD_ERROR(("%s: HANG was sent up earlier. Not talking to the chip\n",
+                       __FUNCTION__));
+               return -EIO;
+       }
+
        memset(msg, 0, sizeof(cdc_ioctl_t));
 
        msg->cmd = htol32(cmd);
@@ -253,7 +266,7 @@ dhd_prot_ioctl(dhd_pub_t *dhd, int ifidx, wl_ioctl_t * ioc, void * buf, int len)
        dhd_prot_t *prot = dhd->prot;
        int ret = -1;
 
-       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__));
                return ret;
        }