net: wireless: bcm4329: Fix setting HT clock race conditions
authorDmitry Shmidt <dimitrysh@google.com>
Wed, 29 Sep 2010 17:22:59 +0000 (10:22 -0700)
committerColin Cross <ccross@android.com>
Mon, 4 Oct 2010 19:08:01 +0000 (12:08 -0700)
Signed-off-by: Dmitry Shmidt <dimitrysh@google.com>
drivers/net/wireless/bcm4329/dhd_linux.c
drivers/net/wireless/bcm4329/dhd_sdio.c

index 2eff4693d17633d48c71217f8760f7d0e2085b40..f687b31e333890cc37bdcd0ebd957a1adce7616d 100644 (file)
@@ -1379,7 +1379,6 @@ dhd_watchdog_thread(void *data)
        /* Run until signal received */
        while (1) {
                if (down_interruptible (&dhd->watchdog_sem) == 0) {
-                       dhd_os_wake_lock(&dhd->pub);
 
                        if (dhd->pub.dongle_reset == FALSE) {
                                /* Call the bus module watchdog */
@@ -1387,6 +1386,11 @@ dhd_watchdog_thread(void *data)
                        }
                        /* Count the tick for reference */
                        dhd->pub.tickcnt++;
+
+                       /* Reschedule the watchdog */
+                       if (dhd->wd_timer_valid)
+                               mod_timer(&dhd->timer, jiffies + dhd_watchdog_ms * HZ / 1000);
+
                        dhd_os_wake_unlock(&dhd->pub);
                }
                else
@@ -1404,12 +1408,6 @@ dhd_watchdog(ulong data)
        dhd_os_wake_lock(&dhd->pub);
        if (dhd->watchdog_pid >= 0) {
                up(&dhd->watchdog_sem);
-
-               /* Reschedule the watchdog */
-               if (dhd->wd_timer_valid) {
-                               mod_timer(&dhd->timer, jiffies + dhd_watchdog_ms * HZ / 1000);
-               }
-               dhd_os_wake_unlock(&dhd->pub);
                return;
        }
 
index bd735568e2aec2d64d29328a15938adb0a4e1b36..176d6e86e76480d334123720fd84cb4b75a11565 100644 (file)
@@ -5808,6 +5808,8 @@ dhd_bus_devreset(dhd_pub_t *dhdp, uint8 flag)
                        dhd_os_proto_unblock(dhdp);
                        /* Expect app to have torn down any connection before calling */
                        /* Stop the bus, disable F2 */
+                       dhd_os_sdlock(dhdp);
+
                        dhd_bus_stop(bus, FALSE);
 
                        /* Clean tx/rx buffer pointers, detach from the dongle */
@@ -5816,6 +5818,8 @@ dhd_bus_devreset(dhd_pub_t *dhdp, uint8 flag)
                        bus->dhd->dongle_reset = TRUE;
                        bus->dhd->up = FALSE;
 
+                       dhd_os_sdunlock(dhdp);
+
                        DHD_TRACE(("%s:  WLAN OFF DONE\n", __FUNCTION__));
                        /* App can now remove power from device */
                } else