Commit ae46ae17 authored by Kalle Valo's avatar Kalle Valo Committed by John W. Linville

wl1251: create wl1251_join()

Better to use wl1251_cmd_join() only for sending the command and move
the logic to wl1251_join().
Signed-off-by: default avatarKalle Valo <kalle.valo@nokia.com>
Reviewed-by: default avatarVidhya Govindan <vidhya.govindan@nokia.com>
Signed-off-by: default avatarJohn W. Linville <linville@tuxdriver.com>
parent c88f8754
...@@ -254,7 +254,6 @@ int wl1251_cmd_data_path(struct wl1251 *wl, u8 channel, bool enable) ...@@ -254,7 +254,6 @@ int wl1251_cmd_data_path(struct wl1251 *wl, u8 channel, bool enable)
int wl1251_cmd_join(struct wl1251 *wl, u8 bss_type, u8 channel, int wl1251_cmd_join(struct wl1251 *wl, u8 bss_type, u8 channel,
u16 beacon_interval, u8 dtim_interval) u16 beacon_interval, u8 dtim_interval)
{ {
unsigned long timeout;
struct cmd_join *join; struct cmd_join *join;
int ret, i; int ret, i;
u8 *bssid; u8 *bssid;
...@@ -265,14 +264,6 @@ int wl1251_cmd_join(struct wl1251 *wl, u8 bss_type, u8 channel, ...@@ -265,14 +264,6 @@ int wl1251_cmd_join(struct wl1251 *wl, u8 bss_type, u8 channel,
goto out; goto out;
} }
/* FIXME: this should be in main.c */
ret = wl1251_acx_frame_rates(wl, DEFAULT_HW_GEN_TX_RATE,
DEFAULT_HW_GEN_MODULATION_TYPE,
wl->tx_mgmt_frm_rate,
wl->tx_mgmt_frm_mod);
if (ret < 0)
goto out;
wl1251_debug(DEBUG_CMD, "cmd join%s ch %d %d/%d", wl1251_debug(DEBUG_CMD, "cmd join%s ch %d %d/%d",
bss_type == BSS_TYPE_IBSS ? " ibss" : "", bss_type == BSS_TYPE_IBSS ? " ibss" : "",
channel, beacon_interval, dtim_interval); channel, beacon_interval, dtim_interval);
...@@ -300,14 +291,6 @@ int wl1251_cmd_join(struct wl1251 *wl, u8 bss_type, u8 channel, ...@@ -300,14 +291,6 @@ int wl1251_cmd_join(struct wl1251 *wl, u8 bss_type, u8 channel,
goto out; goto out;
} }
timeout = msecs_to_jiffies(JOIN_TIMEOUT);
/*
* ugly hack: we should wait for JOIN_EVENT_COMPLETE_ID but to
* simplify locking we just sleep instead, for now
*/
msleep(10);
out: out:
kfree(join); kfree(join);
return ret; return ret;
......
...@@ -309,6 +309,34 @@ static void wl1251_irq_work(struct work_struct *work) ...@@ -309,6 +309,34 @@ static void wl1251_irq_work(struct work_struct *work)
mutex_unlock(&wl->mutex); mutex_unlock(&wl->mutex);
} }
static int wl1251_join(struct wl1251 *wl, u8 bss_type, u8 channel,
u16 beacon_interval, u8 dtim_period)
{
int ret;
ret = wl1251_acx_frame_rates(wl, DEFAULT_HW_GEN_TX_RATE,
DEFAULT_HW_GEN_MODULATION_TYPE,
wl->tx_mgmt_frm_rate,
wl->tx_mgmt_frm_mod);
if (ret < 0)
goto out;
ret = wl1251_cmd_join(wl, bss_type, channel, beacon_interval,
dtim_period);
if (ret < 0)
goto out;
/*
* FIXME: we should wait for JOIN_EVENT_COMPLETE_ID but to simplify
* locking we just sleep instead, for now
*/
msleep(10);
out:
return ret;
}
static void wl1251_filter_work(struct work_struct *work) static void wl1251_filter_work(struct work_struct *work)
{ {
struct wl1251 *wl = struct wl1251 *wl =
...@@ -324,8 +352,8 @@ static void wl1251_filter_work(struct work_struct *work) ...@@ -324,8 +352,8 @@ static void wl1251_filter_work(struct work_struct *work)
if (ret < 0) if (ret < 0)
goto out; goto out;
ret = wl1251_cmd_join(wl, wl->bss_type, wl->channel, wl->beacon_int, ret = wl1251_join(wl, wl->bss_type, wl->channel, wl->beacon_int,
wl->dtim_period); wl->dtim_period);
if (ret < 0) if (ret < 0)
goto out_sleep; goto out_sleep;
...@@ -565,8 +593,8 @@ static int wl1251_op_config(struct ieee80211_hw *hw, u32 changed) ...@@ -565,8 +593,8 @@ static int wl1251_op_config(struct ieee80211_hw *hw, u32 changed)
goto out; goto out;
if (channel != wl->channel) { if (channel != wl->channel) {
ret = wl1251_cmd_join(wl, wl->bss_type, wl->channel, ret = wl1251_join(wl, wl->bss_type, wl->channel,
wl->beacon_int, wl->dtim_period); wl->beacon_int, wl->dtim_period);
if (ret < 0) if (ret < 0)
goto out_sleep; goto out_sleep;
...@@ -1123,9 +1151,8 @@ static void wl1251_op_bss_info_changed(struct ieee80211_hw *hw, ...@@ -1123,9 +1151,8 @@ static void wl1251_op_bss_info_changed(struct ieee80211_hw *hw,
goto out; goto out;
if (wl->bss_type != BSS_TYPE_IBSS) { if (wl->bss_type != BSS_TYPE_IBSS) {
ret = wl1251_cmd_join(wl, wl->bss_type, wl->channel, ret = wl1251_join(wl, wl->bss_type, wl->channel,
wl->beacon_int, wl->beacon_int, wl->dtim_period);
wl->dtim_period);
if (ret < 0) if (ret < 0)
goto out_sleep; goto out_sleep;
wl1251_warning("Set ctsprotect failed %d", ret); wl1251_warning("Set ctsprotect failed %d", ret);
...@@ -1151,8 +1178,8 @@ static void wl1251_op_bss_info_changed(struct ieee80211_hw *hw, ...@@ -1151,8 +1178,8 @@ static void wl1251_op_bss_info_changed(struct ieee80211_hw *hw,
if (ret < 0) if (ret < 0)
goto out; goto out;
ret = wl1251_cmd_join(wl, wl->bss_type, wl->beacon_int, ret = wl1251_join(wl, wl->bss_type, wl->beacon_int,
wl->channel, wl->dtim_period); wl->channel, wl->dtim_period);
if (ret < 0) if (ret < 0)
goto out; goto out;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment