diff options
author | Kalle Valo <kalle.valo@nokia.com> | 2009-08-07 06:34:42 -0400 |
---|---|---|
committer | John W. Linville <linville@tuxdriver.com> | 2009-08-14 09:13:40 -0400 |
commit | ae46ae17d1d8b953eb5859764737c065e4e3c86b (patch) | |
tree | f9d4e5cb265dc372ccdbcc8e6f843de80c17d622 /drivers/net/wireless/wl12xx | |
parent | c88f87540fa4b90a0b8696dae8bce801ecc142d3 (diff) |
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: Kalle Valo <kalle.valo@nokia.com>
Reviewed-by: Vidhya Govindan <vidhya.govindan@nokia.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
Diffstat (limited to 'drivers/net/wireless/wl12xx')
-rw-r--r-- | drivers/net/wireless/wl12xx/wl1251_cmd.c | 17 | ||||
-rw-r--r-- | drivers/net/wireless/wl12xx/wl1251_main.c | 45 |
2 files changed, 36 insertions, 26 deletions
diff --git a/drivers/net/wireless/wl12xx/wl1251_cmd.c b/drivers/net/wireless/wl12xx/wl1251_cmd.c index 4e796db16244..d7800a39f7d4 100644 --- a/drivers/net/wireless/wl12xx/wl1251_cmd.c +++ b/drivers/net/wireless/wl12xx/wl1251_cmd.c | |||
@@ -254,7 +254,6 @@ out: | |||
254 | int wl1251_cmd_join(struct wl1251 *wl, u8 bss_type, u8 channel, | 254 | int wl1251_cmd_join(struct wl1251 *wl, u8 bss_type, u8 channel, |
255 | u16 beacon_interval, u8 dtim_interval) | 255 | u16 beacon_interval, u8 dtim_interval) |
256 | { | 256 | { |
257 | unsigned long timeout; | ||
258 | struct cmd_join *join; | 257 | struct cmd_join *join; |
259 | int ret, i; | 258 | int ret, i; |
260 | u8 *bssid; | 259 | u8 *bssid; |
@@ -265,14 +264,6 @@ int wl1251_cmd_join(struct wl1251 *wl, u8 bss_type, u8 channel, | |||
265 | goto out; | 264 | goto out; |
266 | } | 265 | } |
267 | 266 | ||
268 | /* FIXME: this should be in main.c */ | ||
269 | ret = wl1251_acx_frame_rates(wl, DEFAULT_HW_GEN_TX_RATE, | ||
270 | DEFAULT_HW_GEN_MODULATION_TYPE, | ||
271 | wl->tx_mgmt_frm_rate, | ||
272 | wl->tx_mgmt_frm_mod); | ||
273 | if (ret < 0) | ||
274 | goto out; | ||
275 | |||
276 | wl1251_debug(DEBUG_CMD, "cmd join%s ch %d %d/%d", | 267 | wl1251_debug(DEBUG_CMD, "cmd join%s ch %d %d/%d", |
277 | bss_type == BSS_TYPE_IBSS ? " ibss" : "", | 268 | bss_type == BSS_TYPE_IBSS ? " ibss" : "", |
278 | channel, beacon_interval, dtim_interval); | 269 | channel, beacon_interval, dtim_interval); |
@@ -300,14 +291,6 @@ int wl1251_cmd_join(struct wl1251 *wl, u8 bss_type, u8 channel, | |||
300 | goto out; | 291 | goto out; |
301 | } | 292 | } |
302 | 293 | ||
303 | timeout = msecs_to_jiffies(JOIN_TIMEOUT); | ||
304 | |||
305 | /* | ||
306 | * ugly hack: we should wait for JOIN_EVENT_COMPLETE_ID but to | ||
307 | * simplify locking we just sleep instead, for now | ||
308 | */ | ||
309 | msleep(10); | ||
310 | |||
311 | out: | 294 | out: |
312 | kfree(join); | 295 | kfree(join); |
313 | return ret; | 296 | return ret; |
diff --git a/drivers/net/wireless/wl12xx/wl1251_main.c b/drivers/net/wireless/wl12xx/wl1251_main.c index 5e9045985e53..e575b7869fbc 100644 --- a/drivers/net/wireless/wl12xx/wl1251_main.c +++ b/drivers/net/wireless/wl12xx/wl1251_main.c | |||
@@ -309,6 +309,34 @@ out: | |||
309 | mutex_unlock(&wl->mutex); | 309 | mutex_unlock(&wl->mutex); |
310 | } | 310 | } |
311 | 311 | ||
312 | static int wl1251_join(struct wl1251 *wl, u8 bss_type, u8 channel, | ||
313 | u16 beacon_interval, u8 dtim_period) | ||
314 | { | ||
315 | int ret; | ||
316 | |||
317 | ret = wl1251_acx_frame_rates(wl, DEFAULT_HW_GEN_TX_RATE, | ||
318 | DEFAULT_HW_GEN_MODULATION_TYPE, | ||
319 | wl->tx_mgmt_frm_rate, | ||
320 | wl->tx_mgmt_frm_mod); | ||
321 | if (ret < 0) | ||
322 | goto out; | ||
323 | |||
324 | |||
325 | ret = wl1251_cmd_join(wl, bss_type, channel, beacon_interval, | ||
326 | dtim_period); | ||
327 | if (ret < 0) | ||
328 | goto out; | ||
329 | |||
330 | /* | ||
331 | * FIXME: we should wait for JOIN_EVENT_COMPLETE_ID but to simplify | ||
332 | * locking we just sleep instead, for now | ||
333 | */ | ||
334 | msleep(10); | ||
335 | |||
336 | out: | ||
337 | return ret; | ||
338 | } | ||
339 | |||
312 | static void wl1251_filter_work(struct work_struct *work) | 340 | static void wl1251_filter_work(struct work_struct *work) |
313 | { | 341 | { |
314 | struct wl1251 *wl = | 342 | struct wl1251 *wl = |
@@ -324,8 +352,8 @@ static void wl1251_filter_work(struct work_struct *work) | |||
324 | if (ret < 0) | 352 | if (ret < 0) |
325 | goto out; | 353 | goto out; |
326 | 354 | ||
327 | ret = wl1251_cmd_join(wl, wl->bss_type, wl->channel, wl->beacon_int, | 355 | ret = wl1251_join(wl, wl->bss_type, wl->channel, wl->beacon_int, |
328 | wl->dtim_period); | 356 | wl->dtim_period); |
329 | if (ret < 0) | 357 | if (ret < 0) |
330 | goto out_sleep; | 358 | goto out_sleep; |
331 | 359 | ||
@@ -565,8 +593,8 @@ static int wl1251_op_config(struct ieee80211_hw *hw, u32 changed) | |||
565 | goto out; | 593 | goto out; |
566 | 594 | ||
567 | if (channel != wl->channel) { | 595 | if (channel != wl->channel) { |
568 | ret = wl1251_cmd_join(wl, wl->bss_type, wl->channel, | 596 | ret = wl1251_join(wl, wl->bss_type, wl->channel, |
569 | wl->beacon_int, wl->dtim_period); | 597 | wl->beacon_int, wl->dtim_period); |
570 | if (ret < 0) | 598 | if (ret < 0) |
571 | goto out_sleep; | 599 | goto out_sleep; |
572 | 600 | ||
@@ -1123,9 +1151,8 @@ static void wl1251_op_bss_info_changed(struct ieee80211_hw *hw, | |||
1123 | goto out; | 1151 | goto out; |
1124 | 1152 | ||
1125 | if (wl->bss_type != BSS_TYPE_IBSS) { | 1153 | if (wl->bss_type != BSS_TYPE_IBSS) { |
1126 | ret = wl1251_cmd_join(wl, wl->bss_type, wl->channel, | 1154 | ret = wl1251_join(wl, wl->bss_type, wl->channel, |
1127 | wl->beacon_int, | 1155 | wl->beacon_int, wl->dtim_period); |
1128 | wl->dtim_period); | ||
1129 | if (ret < 0) | 1156 | if (ret < 0) |
1130 | goto out_sleep; | 1157 | goto out_sleep; |
1131 | wl1251_warning("Set ctsprotect failed %d", ret); | 1158 | wl1251_warning("Set ctsprotect failed %d", ret); |
@@ -1151,8 +1178,8 @@ static void wl1251_op_bss_info_changed(struct ieee80211_hw *hw, | |||
1151 | if (ret < 0) | 1178 | if (ret < 0) |
1152 | goto out; | 1179 | goto out; |
1153 | 1180 | ||
1154 | ret = wl1251_cmd_join(wl, wl->bss_type, wl->beacon_int, | 1181 | ret = wl1251_join(wl, wl->bss_type, wl->beacon_int, |
1155 | wl->channel, wl->dtim_period); | 1182 | wl->channel, wl->dtim_period); |
1156 | 1183 | ||
1157 | if (ret < 0) | 1184 | if (ret < 0) |
1158 | goto out; | 1185 | goto out; |