net: wireless: bcm4329: Add sdlock to firmware loading
authorDmitry Shmidt <dimitrysh@google.com>
Sat, 12 Feb 2011 00:54:39 +0000 (16:54 -0800)
committermgross <mark.gross@intel.com>
Wed, 9 Nov 2011 20:07:11 +0000 (12:07 -0800)
Signed-off-by: Dmitry Shmidt <dimitrysh@google.com>
drivers/net/wireless/bcm4329/dhd_linux.c

index f14f5e8..72b5fda 100644 (file)
@@ -2186,12 +2186,15 @@ dhd_bus_start(dhd_pub_t *dhdp)
 
        DHD_TRACE(("%s: \n", __FUNCTION__));
 
+       dhd_os_sdlock(dhdp);
+
        /* try to download image and nvram to the dongle */
        if  (dhd->pub.busstate == DHD_BUS_DOWN) {
                if (!(dhd_bus_download_firmware(dhd->pub.bus, dhd->pub.osh,
                                                fw_path, nv_path))) {
                        DHD_ERROR(("%s: dhdsdio_probe_download failed. firmware = %s nvram = %s\n",
                                   __FUNCTION__, fw_path, nv_path));
+                       dhd_os_sdunlock(dhdp);
                        return -1;
                }
        }
@@ -2201,8 +2204,9 @@ dhd_bus_start(dhd_pub_t *dhdp)
        dhd_os_wd_timer(&dhd->pub, dhd_watchdog_ms);
 
        /* Bring up the bus */
-       if ((ret = dhd_bus_init(&dhd->pub, TRUE)) != 0) {
+       if ((ret = dhd_bus_init(&dhd->pub, FALSE)) != 0) {
                DHD_ERROR(("%s, dhd_bus_init failed %d\n", __FUNCTION__, ret));
+               dhd_os_sdunlock(dhdp);
                return ret;
        }
 #if defined(OOB_INTR_ONLY)
@@ -2211,6 +2215,7 @@ dhd_bus_start(dhd_pub_t *dhdp)
                dhd->wd_timer_valid = FALSE;
                del_timer_sync(&dhd->timer);
                DHD_ERROR(("%s Host failed to resgister for OOB\n", __FUNCTION__));
+               dhd_os_sdunlock(dhdp);
                return -ENODEV;
        }
 
@@ -2223,9 +2228,12 @@ dhd_bus_start(dhd_pub_t *dhdp)
                dhd->wd_timer_valid = FALSE;
                del_timer_sync(&dhd->timer);
                DHD_ERROR(("%s failed bus is not ready\n", __FUNCTION__));
+               dhd_os_sdunlock(dhdp);
                return -ENODEV;
        }
 
+       dhd_os_sdunlock(dhdp);
+
 #ifdef EMBEDDED_PLATFORM
        bcm_mkiovar("event_msgs", dhdp->eventmask, WL_EVENTING_MASK_LEN, iovbuf, sizeof(iovbuf));
        dhdcdc_query_ioctl(dhdp, 0, WLC_GET_VAR, iovbuf, sizeof(iovbuf));