linux-wireless.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Kalle Valo <kalle.valo@iki.fi>
To: linville@tuxdriver.com
Cc: linux-wireless@vger.kernel.org
Subject: [PATCH 16/23] wl1251: create wl1251_join()
Date: Fri, 07 Aug 2009 13:34:42 +0300	[thread overview]
Message-ID: <20090807103441.31717.80626.stgit@tikku> (raw)
In-Reply-To: <20090807102732.31717.84006.stgit@tikku>

From: Kalle Valo <kalle.valo@nokia.com>

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>
---

 drivers/net/wireless/wl12xx/wl1251_cmd.c  |   17 -----------
 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 4e796db..d7800a3 100644
--- a/drivers/net/wireless/wl12xx/wl1251_cmd.c
+++ b/drivers/net/wireless/wl12xx/wl1251_cmd.c
@@ -254,7 +254,6 @@ out:
 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;
 	int ret, i;
 	u8 *bssid;
@@ -265,14 +264,6 @@ int wl1251_cmd_join(struct wl1251 *wl, u8 bss_type, u8 channel,
 		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",
 		     bss_type == BSS_TYPE_IBSS ? " ibss" : "",
 		     channel, beacon_interval, dtim_interval);
@@ -300,14 +291,6 @@ int wl1251_cmd_join(struct wl1251 *wl, u8 bss_type, u8 channel,
 		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:
 	kfree(join);
 	return ret;
diff --git a/drivers/net/wireless/wl12xx/wl1251_main.c b/drivers/net/wireless/wl12xx/wl1251_main.c
index 5e90459..e575b78 100644
--- a/drivers/net/wireless/wl12xx/wl1251_main.c
+++ b/drivers/net/wireless/wl12xx/wl1251_main.c
@@ -309,6 +309,34 @@ out:
 	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)
 {
 	struct wl1251 *wl =
@@ -324,8 +352,8 @@ static void wl1251_filter_work(struct work_struct *work)
 	if (ret < 0)
 		goto out;
 
-	ret = wl1251_cmd_join(wl, wl->bss_type, wl->channel, wl->beacon_int,
-				   wl->dtim_period);
+	ret = wl1251_join(wl, wl->bss_type, wl->channel, wl->beacon_int,
+			  wl->dtim_period);
 	if (ret < 0)
 		goto out_sleep;
 
@@ -565,8 +593,8 @@ static int wl1251_op_config(struct ieee80211_hw *hw, u32 changed)
 		goto out;
 
 	if (channel != wl->channel) {
-		ret = wl1251_cmd_join(wl, wl->bss_type, wl->channel,
-				      wl->beacon_int, wl->dtim_period);
+		ret = wl1251_join(wl, wl->bss_type, wl->channel,
+				  wl->beacon_int, wl->dtim_period);
 		if (ret < 0)
 			goto out_sleep;
 
@@ -1123,9 +1151,8 @@ static void wl1251_op_bss_info_changed(struct ieee80211_hw *hw,
 			goto out;
 
 		if (wl->bss_type != BSS_TYPE_IBSS) {
-			ret = wl1251_cmd_join(wl, wl->bss_type, wl->channel,
-					      wl->beacon_int,
-					      wl->dtim_period);
+			ret = wl1251_join(wl, wl->bss_type, wl->channel,
+					  wl->beacon_int, wl->dtim_period);
 			if (ret < 0)
 				goto out_sleep;
 			wl1251_warning("Set ctsprotect failed %d", ret);
@@ -1151,8 +1178,8 @@ static void wl1251_op_bss_info_changed(struct ieee80211_hw *hw,
 		if (ret < 0)
 			goto out;
 
-		ret = wl1251_cmd_join(wl, wl->bss_type, wl->beacon_int,
-				      wl->channel, wl->dtim_period);
+		ret = wl1251_join(wl, wl->bss_type, wl->beacon_int,
+				  wl->channel, wl->dtim_period);
 
 		if (ret < 0)
 			goto out;


  parent reply	other threads:[~2009-08-07 10:34 UTC|newest]

Thread overview: 25+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-08-07 10:32 [PATCH 00/23] wl1251 sdio support Kalle Valo
2009-08-07 10:32 ` [PATCH 01/23] wl1251: remove fixed address support from spi commands Kalle Valo
2009-08-07 10:32 ` [PATCH 02/23] wl1251: separate bus i/o code into io.c Kalle Valo
2009-08-07 10:33 ` [PATCH 03/23] wl1251: use wiphy_dev instead of wl->spi->dev Kalle Valo
2009-08-07 10:33 ` [PATCH 04/23] wl1251: introduce wl1251_if_operations struct Kalle Valo
2009-08-07 10:33 ` [PATCH 05/23] wl1251: make wl1251_set_partition bus agnostic Kalle Valo
2009-08-07 10:33 ` [PATCH 06/23] wl1251: move module probe methods into spi.c Kalle Valo
2009-08-07 10:33 ` [PATCH 07/23] wl1251: split spi interface into separate module Kalle Valo
2009-08-07 10:33 ` [PATCH 08/23] wl1251: add sdio support Kalle Valo
2009-08-07 10:33 ` [PATCH 09/23] wl1251: make irq handling interface specific Kalle Valo
2009-08-07 10:33 ` [PATCH 10/23] wl1251: remove wl1251_ops Kalle Valo
2009-08-07 10:34 ` [PATCH 11/23] wl1251: reorder wl1251_cmd_join() arguments Kalle Valo
2009-08-07 10:34 ` [PATCH 12/23] wl1251: use beacon interval and dtim period provided by mac80211 Kalle Valo
2009-08-07 10:34 ` [PATCH 13/23] wl1251: remove wait parameter from wl1251_cmd_join() Kalle Valo
2009-08-07 10:34 ` [PATCH 14/23] wl1251: initialise default channel to zero Kalle Valo
2009-08-07 10:34 ` [PATCH 15/23] wl1251: add channel to wl1251_cmd_join() parameters Kalle Valo
2009-08-07 10:34 ` Kalle Valo [this message]
2009-08-07 10:34 ` [PATCH 17/23] wl1251: fix channel setting in wl1251_op_config() Kalle Valo
2009-08-07 10:34 ` [PATCH 18/23] wl1251: move wl1251_acx_wake_up_conditions() to wl1251_ps_set_mode() Kalle Valo
2009-08-07 10:35 ` [PATCH 19/23] wl1251: use workqueue provided by mac80211 Kalle Valo
2009-08-07 10:35 ` [PATCH 20/23] wl1251: rename reg.h to wl1251_reg.h Kalle Valo
2009-08-07 10:35 ` [PATCH 21/23] wl1251: remove Luciano as maintainer Kalle Valo
2009-08-07 10:46   ` Luciano Coelho
2009-08-07 10:35 ` [PATCH 22/23] wl1251: add hw scan completed debug message Kalle Valo
2009-08-07 10:35 ` [PATCH 23/23] wl1251: hack to disable filters for fixing association Kalle Valo

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20090807103441.31717.80626.stgit@tikku \
    --to=kalle.valo@iki.fi \
    --cc=linux-wireless@vger.kernel.org \
    --cc=linville@tuxdriver.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).