net: wireless: bcm4329: Init locks in dhd_attach() at the beginning
authorAndrey Vagin <avagin@parallels.com>
Mon, 9 Jul 2012 17:31:06 +0000 (10:31 -0700)
committerDmitry Shmidt <dimitrysh@google.com>
Thu, 12 Jul 2012 17:45:49 +0000 (10:45 -0700)
Signed-off-by: Dmitry Shmidt <dimitrysh@google.com>
drivers/net/wireless/bcm4329/dhd_linux.c

index 5f5b418abc260336c83f394aad90179d05e2d021..b466d745f848680a53171ccb80b837f9c39ecafc 100644 (file)
@@ -2086,6 +2086,17 @@ dhd_attach(osl_t *osh, struct dhd_bus *bus, uint bus_hdrlen)
        memcpy(netdev_priv(net), &dhd, sizeof(dhd));
        dhd->pub.osh = osh;
 
+       mutex_init(&dhd->proto_sem);
+       mutex_init(&dhd->sdsem);
+       /* Initialize other structure content */
+       init_waitqueue_head(&dhd->ioctl_resp_wait);
+       init_waitqueue_head(&dhd->ctrl_wait);
+
+       /* Initialize the spinlocks */
+       spin_lock_init(&dhd->sdlock);
+       spin_lock_init(&dhd->txqlock);
+       spin_lock_init(&dhd->dhd_lock);
+
        /* Set network interface name if it was provided as module parameter */
        if (iface_name[0]) {
                int len;
@@ -2107,16 +2118,6 @@ dhd_attach(osl_t *osh, struct dhd_bus *bus, uint bus_hdrlen)
        net->netdev_ops = NULL;
 #endif
 
-       mutex_init(&dhd->proto_sem);
-       /* Initialize other structure content */
-       init_waitqueue_head(&dhd->ioctl_resp_wait);
-       init_waitqueue_head(&dhd->ctrl_wait);
-
-       /* Initialize the spinlocks */
-       spin_lock_init(&dhd->sdlock);
-       spin_lock_init(&dhd->txqlock);
-       spin_lock_init(&dhd->dhd_lock);
-
        /* Initialize Wakelock stuff */
        spin_lock_init(&dhd->wl_lock);
        dhd->wl_count = 0;
@@ -2154,7 +2155,6 @@ dhd_attach(osl_t *osh, struct dhd_bus *bus, uint bus_hdrlen)
        dhd->timer.function = dhd_watchdog;
 
        /* Initialize thread based operation and lock */
-       mutex_init(&dhd->sdsem);
        if ((dhd_watchdog_prio >= 0) && (dhd_dpc_prio >= 0)) {
                dhd->threads_only = TRUE;
        }