return ret;
 }
 
-int wl1251_cmd_join(struct wl1251 *wl, u8 bss_type, u16 beacon_interval,
-                   u8 dtim_interval)
+int wl1251_cmd_join(struct wl1251 *wl, u8 bss_type, u8 channel,
+                   u16 beacon_interval, u8 dtim_interval)
 {
        unsigned long timeout;
        struct cmd_join *join;
        if (ret < 0)
                goto out;
 
-       wl1251_debug(DEBUG_CMD, "cmd join%s %d %d",
+       wl1251_debug(DEBUG_CMD, "cmd join%s ch %d %d/%d",
                     bss_type == BSS_TYPE_IBSS ? " ibss" : "",
-                    beacon_interval, dtim_interval);
+                    channel, beacon_interval, dtim_interval);
 
        /* Reverse order BSSID */
        bssid = (u8 *) &join->bssid_lsb;
        join->beacon_interval = beacon_interval;
        join->dtim_interval = dtim_interval;
        join->bss_type = bss_type;
-       join->channel = wl->channel;
+       join->channel = channel;
        join->ctrl = JOIN_CMD_CTRL_TX_FLUSH;
 
        ret = wl1251_cmd_send(wl, CMD_START_JOIN, join, sizeof(*join));
 
 int wl1251_cmd_vbm(struct wl1251 *wl, u8 identity,
                   void *bitmap, u16 bitmap_len, u8 bitmap_control);
 int wl1251_cmd_data_path(struct wl1251 *wl, u8 channel, bool enable);
-int wl1251_cmd_join(struct wl1251 *wl, u8 bss_type, u16 beacon_interval,
-                   u8 dtim_interval);
+int wl1251_cmd_join(struct wl1251 *wl, u8 bss_type, u8 channel,
+                   u16 beacon_interval, u8 dtim_interval);
 int wl1251_cmd_ps_mode(struct wl1251 *wl, u8 ps_mode);
 int wl1251_cmd_read_memory(struct wl1251 *wl, u32 addr, void *answer,
                           size_t len);
 
        if (ret < 0)
                goto out;
 
-       ret = wl1251_cmd_join(wl, wl->bss_type, wl->beacon_int,
+       ret = wl1251_cmd_join(wl, wl->bss_type, wl->channel, wl->beacon_int,
                                   wl->dtim_period);
        if (ret < 0)
                goto out_sleep;
                goto out;
 
        if (channel != wl->channel) {
-               ret = wl1251_cmd_join(wl, wl->bss_type, wl->beacon_int,
-                                          wl->dtim_period);
+               ret = wl1251_cmd_join(wl, wl->bss_type, wl->channel,
+                                     wl->beacon_int, wl->dtim_period);
                if (ret < 0)
                        goto out_sleep;
 
                        goto out;
 
                if (wl->bss_type != BSS_TYPE_IBSS) {
-                       ret = wl1251_cmd_join(wl, wl->bss_type,
+                       ret = wl1251_cmd_join(wl, wl->bss_type, wl->channel,
                                              wl->beacon_int,
                                              wl->dtim_period);
                        if (ret < 0)
                        goto out;
 
                ret = wl1251_cmd_join(wl, wl->bss_type, wl->beacon_int,
-                                     wl->dtim_period);
+                                     wl->channel, wl->dtim_period);
 
                if (ret < 0)
                        goto out;