linux-wireless.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Luciano Coelho <luciano.coelho@nokia.com>
To: linux-wireless@vger.kernel.org
Cc: Juuso Oikarinen <juuso.oikarinen@nokia.com>
Subject: [PATCH 19/25] wl1271: Move scan complete invocation into work function
Date: Mon, 27 Sep 2010 11:37:43 +0300	[thread overview]
Message-ID: <1285576669-8070-20-git-send-email-luciano.coelho@nokia.com> (raw)
In-Reply-To: <1285576669-8070-1-git-send-email-luciano.coelho@nokia.com>

From: Juuso Oikarinen <juuso.oikarinen@nokia.com>

The current scan implementation can jam, if the scan request ends up
containing no work. This can especially happen if there is a scan request
with only 11a band channels for HW that does not support 11a.

Signed-off-by: Juuso Oikarinen <juuso.oikarinen@nokia.com>
Reviewed-by: Luciano Coelho <luciano.coelho@nokia.com>
Signed-off-by: Luciano Coelho <luciano.coelho@nokia.com>
---
 drivers/net/wireless/wl12xx/wl1271.h      |    1 +
 drivers/net/wireless/wl12xx/wl1271_main.c |    4 ++++
 drivers/net/wireless/wl12xx/wl1271_scan.c |   23 ++++++++++++++++++-----
 drivers/net/wireless/wl12xx/wl1271_scan.h |    1 +
 4 files changed, 24 insertions(+), 5 deletions(-)

diff --git a/drivers/net/wireless/wl12xx/wl1271.h b/drivers/net/wireless/wl12xx/wl1271.h
index 9782bc1..55ec656 100644
--- a/drivers/net/wireless/wl12xx/wl1271.h
+++ b/drivers/net/wireless/wl12xx/wl1271.h
@@ -418,6 +418,7 @@ struct wl1271 {
 
 	/* Are we currently scanning */
 	struct wl1271_scan scan;
+	struct work_struct scan_complete_work;
 
 	/* Our association ID */
 	u16 aid;
diff --git a/drivers/net/wireless/wl12xx/wl1271_main.c b/drivers/net/wireless/wl12xx/wl1271_main.c
index 44915ee..37f61de 100644
--- a/drivers/net/wireless/wl12xx/wl1271_main.c
+++ b/drivers/net/wireless/wl12xx/wl1271_main.c
@@ -634,6 +634,8 @@ static int wl1271_setup(struct wl1271 *wl)
 
 	INIT_WORK(&wl->irq_work, wl1271_irq_work);
 	INIT_WORK(&wl->tx_work, wl1271_tx_work);
+	INIT_WORK(&wl->scan_complete_work, wl1271_scan_complete_work);
+
 	return 0;
 }
 
@@ -962,6 +964,8 @@ static void wl1271_op_remove_interface(struct ieee80211_hw *hw,
 	struct wl1271 *wl = hw->priv;
 	int i;
 
+	cancel_work_sync(&wl->scan_complete_work);
+
 	mutex_lock(&wl->mutex);
 	wl1271_debug(DEBUG_MAC80211, "mac80211 remove interface");
 
diff --git a/drivers/net/wireless/wl12xx/wl1271_scan.c b/drivers/net/wireless/wl12xx/wl1271_scan.c
index 8d30150..9f1da82 100644
--- a/drivers/net/wireless/wl12xx/wl1271_scan.c
+++ b/drivers/net/wireless/wl12xx/wl1271_scan.c
@@ -28,6 +28,23 @@
 #include "wl1271_scan.h"
 #include "wl1271_acx.h"
 
+void wl1271_scan_complete_work(struct work_struct *work)
+{
+	struct wl1271 *wl =
+		container_of(work, struct wl1271, scan_complete_work);
+
+	wl1271_debug(DEBUG_SCAN, "Scanning complete");
+
+	mutex_lock(&wl->mutex);
+	wl->scan.state = WL1271_SCAN_STATE_IDLE;
+	kfree(wl->scan.scanned_ch);
+	wl->scan.scanned_ch = NULL;
+	mutex_unlock(&wl->mutex);
+
+	ieee80211_scan_completed(wl->hw, false);
+}
+
+
 static int wl1271_get_scan_channels(struct wl1271 *wl,
 				    struct cfg80211_scan_request *req,
 				    struct basic_scan_channel_params *channels,
@@ -218,11 +235,7 @@ void wl1271_scan_stm(struct wl1271 *wl)
 		break;
 
 	case WL1271_SCAN_STATE_DONE:
-		kfree(wl->scan.scanned_ch);
-		wl->scan.scanned_ch = NULL;
-
-		wl->scan.state = WL1271_SCAN_STATE_IDLE;
-		ieee80211_scan_completed(wl->hw, false);
+		ieee80211_queue_work(wl->hw, &wl->scan_complete_work);
 		break;
 
 	default:
diff --git a/drivers/net/wireless/wl12xx/wl1271_scan.h b/drivers/net/wireless/wl12xx/wl1271_scan.h
index f181570..1404e00 100644
--- a/drivers/net/wireless/wl12xx/wl1271_scan.h
+++ b/drivers/net/wireless/wl12xx/wl1271_scan.h
@@ -32,6 +32,7 @@ int wl1271_scan_build_probe_req(struct wl1271 *wl,
 				const u8 *ssid, size_t ssid_len,
 				const u8 *ie, size_t ie_len, u8 band);
 void wl1271_scan_stm(struct wl1271 *wl);
+void wl1271_scan_complete_work(struct work_struct *work);
 
 #define WL1271_SCAN_MAX_CHANNELS       24
 #define WL1271_SCAN_DEFAULT_TAG        1
-- 
1.6.3.3


  parent reply	other threads:[~2010-09-27  8:38 UTC|newest]

Thread overview: 46+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-09-27  8:37 [PATCH 00/25] wl1271: pending patches Luciano Coelho
2010-09-27  8:37 ` [PATCH 01/25] wl1271: remove deprecated ACX definition Luciano Coelho
2010-09-27  8:37 ` [PATCH 02/25] wl1271: Implement CMD_SET_STA_STATE to indicate connection completion to FW Luciano Coelho
2010-09-27  8:37 ` [PATCH 03/25] wl1271: Add trigger to net_device oper_state to change BT coex priority Luciano Coelho
2010-09-27  8:37 ` [PATCH 04/25] wl1271: Fix scan race condition Luciano Coelho
2010-09-27  8:37 ` [PATCH 05/25] wl1271: remove useless 11a check when scanning Luciano Coelho
2010-09-27  8:37 ` [PATCH 06/25] wl1271: fix forced passive scan Luciano Coelho
2010-09-27  8:37 ` [PATCH 07/25] wl1271: Change supported channel order for a more optimal scan Luciano Coelho
2010-09-27  8:48   ` Johannes Berg
2010-09-27 10:50     ` Luciano Coelho
2010-09-27  8:37 ` [PATCH 08/25] wl1271: Remove outdated FIXME's Luciano Coelho
2010-09-27  8:37 ` [PATCH 09/25] wl1271: Move setting of wake-up conditions to ps.c from cmd.c Luciano Coelho
2010-09-27  8:37 ` [PATCH 10/25] wl1271: Remove acx_fw_version function Luciano Coelho
2010-09-27  8:37 ` [PATCH 11/25] wl1271: Release interrupt *after* releasing the driver context Luciano Coelho
2010-09-27  8:37 ` [PATCH 12/25] wl1271: Remove function cmd_read_memory Luciano Coelho
2010-09-27  8:37 ` [PATCH 13/25] wl1271: Enable/disable 11a support based on INI configuration Luciano Coelho
2010-10-06  5:26   ` Gabay, Benzy
2010-10-06  5:36     ` Juuso Oikarinen
2010-10-06  6:19       ` Gabay, Benzy
2010-09-27  8:37 ` [PATCH 14/25] wl1271: Reduce rate used for last PSM entry attempt Luciano Coelho
2010-09-27  8:37 ` [PATCH 15/25] wl1271: Enable 11a support always, prevent scanning for unsupporting chips Luciano Coelho
2010-09-27  8:37 ` [PATCH 16/25] wl1271: Add support for hardware GEM cipher Luciano Coelho
2010-09-27  9:12   ` Johannes Berg
2010-09-27  9:46     ` Juuso Oikarinen
2010-09-27  9:49       ` Johannes Berg
2010-09-27  9:58         ` Juuso Oikarinen
2010-09-27 10:01           ` Luciano Coelho
2010-09-27 10:42             ` [PATCHv2] " juuso.oikarinen
2010-09-27  8:37 ` [PATCH 17/25] wl1271: Fix tid-configuration of TX frames Luciano Coelho
2010-09-27  8:51   ` Johannes Berg
2010-09-27  8:57     ` Juuso Oikarinen
2010-09-27  8:37 ` [PATCH 18/25] wl1271: Fix AC/TID default configuration Luciano Coelho
2010-09-27  8:37 ` Luciano Coelho [this message]
2010-09-27  8:37 ` [PATCH 20/25] wl1271: Fix work cancelling when shutting down the driver Luciano Coelho
2010-09-27  8:37 ` [PATCH 21/25] wl1271: Separate interface removal to another function Luciano Coelho
2010-09-27  8:37 ` [PATCH 22/25] wl1271: Add hardware recovery mechanism Luciano Coelho
2010-09-27  8:37 ` [PATCH 23/25] wl1271: Add handling for failing hardware scan command Luciano Coelho
2010-09-27  8:37 ` [PATCH 24/25] wl1271: Optimize scan duration Luciano Coelho
2010-10-05  5:30   ` Gabay, Benzy
2010-10-05  5:40     ` Juuso Oikarinen
2010-10-05 15:42       ` Gabay, Benzy
2010-10-06  4:59         ` Juuso Oikarinen
2010-10-06  5:21           ` Gabay, Benzy
2010-10-06  5:26             ` Juuso Oikarinen
2010-10-06  5:50               ` Gabay, Benzy
2010-09-27  8:37 ` [PATCH 25/25] wl1271: Increase connection reliability Luciano Coelho

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=1285576669-8070-20-git-send-email-luciano.coelho@nokia.com \
    --to=luciano.coelho@nokia.com \
    --cc=juuso.oikarinen@nokia.com \
    --cc=linux-wireless@vger.kernel.org \
    /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).