net: wireless: bcmdhd: Make sure that FW is UP after corresponding message
authorDmitry Shmidt <dimitrysh@google.com>
Tue, 4 Oct 2011 20:30:36 +0000 (13:30 -0700)
committermgross <mark.gross@intel.com>
Wed, 9 Nov 2011 20:24:48 +0000 (12:24 -0800)
Signed-off-by: Dmitry Shmidt <dimitrysh@google.com>
drivers/net/wireless/bcmdhd/dhd_linux.c

index 2363da9..09e3d81 100644 (file)
@@ -2922,19 +2922,6 @@ dhd_preinit_ioctls(dhd_pub_t *dhd)
        if ((ret = dhd_wl_ioctl_cmd(dhd, WLC_SET_VAR, iovbuf, sizeof(iovbuf), TRUE, 0)) < 0)
                DHD_ERROR(("%s assoc_listen failed %d\n", __FUNCTION__, ret));
 
-       /* query for 'ver' to get version info from firmware */
-       memset(buf, 0, sizeof(buf));
-       ptr = buf;
-       bcm_mkiovar("ver", (char *)&buf, 4, buf, sizeof(buf));
-       if ((ret  = dhd_wl_ioctl_cmd(dhd, WLC_GET_VAR, buf, sizeof(buf), FALSE, 0)) < 0)
-               DHD_ERROR(("%s failed %d\n", __FUNCTION__, ret));
-       else {
-               bcmstrtok(&ptr, "\n", 0);
-               /* Print fw version info */
-               DHD_ERROR(("Firmware version = %s\n", buf));
-               DHD_BLOG(buf, strlen(buf) + 1);
-               DHD_BLOG(dhd_version, strlen(dhd_version) + 1);
-       }
        /* Set PowerSave mode */
        dhd_wl_ioctl_cmd(dhd, WLC_SET_PM, (char *)&power_mode, sizeof(power_mode), TRUE, 0);
 
@@ -2980,7 +2967,6 @@ dhd_preinit_ioctls(dhd_pub_t *dhd)
        }
 #endif /* defined(KEEP_ALIVE) */
 
-
        /* Read event_msgs mask */
        bcm_mkiovar("event_msgs", eventmask, WL_EVENTING_MASK_LEN, iovbuf, sizeof(iovbuf));
        if ((ret  = dhd_wl_ioctl_cmd(dhd, WLC_GET_VAR, iovbuf, sizeof(iovbuf), FALSE, 0)) < 0) {
@@ -3077,9 +3063,24 @@ dhd_preinit_ioctls(dhd_pub_t *dhd)
 #endif /* PKT_FILTER_SUPPORT */
 
        /* Force STA UP */
-       if ((ret = dhd_wl_ioctl_cmd(dhd, WLC_UP, (char *)&up, sizeof(up), TRUE, 0)) < 0)
+       if ((ret = dhd_wl_ioctl_cmd(dhd, WLC_UP, (char *)&up, sizeof(up), TRUE, 0)) < 0) {
                DHD_ERROR(("%s Setting WL UP failed %d\n", __FUNCTION__, ret));
+               goto done;
+       }
 
+       /* query for 'ver' to get version info from firmware */
+       memset(buf, 0, sizeof(buf));
+       ptr = buf;
+       bcm_mkiovar("ver", (char *)&buf, 4, buf, sizeof(buf));
+       if ((ret  = dhd_wl_ioctl_cmd(dhd, WLC_GET_VAR, buf, sizeof(buf), FALSE, 0)) < 0)
+               DHD_ERROR(("%s failed %d\n", __FUNCTION__, ret));
+       else {
+               bcmstrtok(&ptr, "\n", 0);
+               /* Print fw version info */
+               DHD_ERROR(("Firmware version = %s\n", buf));
+               DHD_BLOG(buf, strlen(buf) + 1);
+               DHD_BLOG(dhd_version, strlen(dhd_version) + 1);
+       }
 
 done:
        return ret;