* [PATCH v2 1/3] wl12xx: configure suspend/resume only if associated/started
@ 2011-06-27 10:06 Eliad Peller
2011-06-27 10:06 ` [PATCH v2 2/3] wl12xx: add stop_scan command Eliad Peller
` (2 more replies)
0 siblings, 3 replies; 4+ messages in thread
From: Eliad Peller @ 2011-06-27 10:06 UTC (permalink / raw)
To: Luciano Coelho; +Cc: linux-wireless
Configure the device (to wowlan) only if the sta/ap
is associated/started.
Signed-off-by: Eliad Peller <eliad@wizery.com>
---
drivers/net/wireless/wl12xx/main.c | 10 ++++++++--
1 files changed, 8 insertions(+), 2 deletions(-)
diff --git a/drivers/net/wireless/wl12xx/main.c b/drivers/net/wireless/wl12xx/main.c
index 2c2251a..7017c23 100644
--- a/drivers/net/wireless/wl12xx/main.c
+++ b/drivers/net/wireless/wl12xx/main.c
@@ -1469,10 +1469,13 @@ static struct notifier_block wl1271_dev_notifier = {
static int wl1271_configure_suspend_sta(struct wl1271 *wl)
{
- int ret;
+ int ret = 0;
mutex_lock(&wl->mutex);
+ if (!test_bit(WL1271_FLAG_STA_ASSOCIATED, &wl->flags))
+ goto out_unlock;
+
ret = wl1271_ps_elp_wakeup(wl);
if (ret < 0)
goto out_unlock;
@@ -1517,10 +1520,13 @@ out:
static int wl1271_configure_suspend_ap(struct wl1271 *wl)
{
- int ret;
+ int ret = 0;
mutex_lock(&wl->mutex);
+ if (!test_bit(WL1271_FLAG_AP_STARTED, &wl->flags))
+ goto out_unlock;
+
ret = wl1271_ps_elp_wakeup(wl);
if (ret < 0)
goto out_unlock;
--
1.7.0.4
^ permalink raw reply related [flat|nested] 4+ messages in thread
* [PATCH v2 2/3] wl12xx: add stop_scan command
2011-06-27 10:06 [PATCH v2 1/3] wl12xx: configure suspend/resume only if associated/started Eliad Peller
@ 2011-06-27 10:06 ` Eliad Peller
2011-06-27 10:06 ` [PATCH v2 3/3] wl12xx: implement cancel_hw_scan() callback Eliad Peller
2011-07-05 19:08 ` [PATCH v2 1/3] wl12xx: configure suspend/resume only if associated/started Luciano Coelho
2 siblings, 0 replies; 4+ messages in thread
From: Eliad Peller @ 2011-06-27 10:06 UTC (permalink / raw)
To: Luciano Coelho; +Cc: linux-wireless
define wl1271_scan_stop() to cancel an ongoing hw scan.
Signed-off-by: Eliad Peller <eliad@wizery.com>
---
drivers/net/wireless/wl12xx/scan.c | 27 +++++++++++++++++++++++++++
drivers/net/wireless/wl12xx/scan.h | 1 +
2 files changed, 28 insertions(+), 0 deletions(-)
diff --git a/drivers/net/wireless/wl12xx/scan.c b/drivers/net/wireless/wl12xx/scan.c
index f37e5a3..e5e5c35 100644
--- a/drivers/net/wireless/wl12xx/scan.c
+++ b/drivers/net/wireless/wl12xx/scan.c
@@ -321,6 +321,33 @@ int wl1271_scan(struct wl1271 *wl, const u8 *ssid, size_t ssid_len,
return 0;
}
+int wl1271_scan_stop(struct wl1271 *wl)
+{
+ struct wl1271_cmd_header *cmd = NULL;
+ int ret = 0;
+
+ if (WARN_ON(wl->scan.state == WL1271_SCAN_STATE_IDLE))
+ return -EINVAL;
+
+ wl1271_debug(DEBUG_CMD, "cmd scan stop");
+
+ cmd = kzalloc(sizeof(*cmd), GFP_KERNEL);
+ if (!cmd) {
+ ret = -ENOMEM;
+ goto out;
+ }
+
+ ret = wl1271_cmd_send(wl, CMD_STOP_SCAN, cmd,
+ sizeof(*cmd), 0);
+ if (ret < 0) {
+ wl1271_error("cmd stop_scan failed");
+ goto out;
+ }
+out:
+ kfree(cmd);
+ return ret;
+}
+
static int
wl1271_scan_get_sched_scan_channels(struct wl1271 *wl,
struct cfg80211_sched_scan_request *req,
diff --git a/drivers/net/wireless/wl12xx/scan.h b/drivers/net/wireless/wl12xx/scan.h
index c833195..b13f297 100644
--- a/drivers/net/wireless/wl12xx/scan.h
+++ b/drivers/net/wireless/wl12xx/scan.h
@@ -28,6 +28,7 @@
int wl1271_scan(struct wl1271 *wl, const u8 *ssid, size_t ssid_len,
struct cfg80211_scan_request *req);
+int wl1271_scan_stop(struct wl1271 *wl);
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);
--
1.7.0.4
^ permalink raw reply related [flat|nested] 4+ messages in thread
* [PATCH v2 3/3] wl12xx: implement cancel_hw_scan() callback
2011-06-27 10:06 [PATCH v2 1/3] wl12xx: configure suspend/resume only if associated/started Eliad Peller
2011-06-27 10:06 ` [PATCH v2 2/3] wl12xx: add stop_scan command Eliad Peller
@ 2011-06-27 10:06 ` Eliad Peller
2011-07-05 19:08 ` [PATCH v2 1/3] wl12xx: configure suspend/resume only if associated/started Luciano Coelho
2 siblings, 0 replies; 4+ messages in thread
From: Eliad Peller @ 2011-06-27 10:06 UTC (permalink / raw)
To: Luciano Coelho; +Cc: linux-wireless
After implementing cancel_hw_scan(), there is no more need to
flush scan_complete_work on suspend.
scan_complete_work enqueues a new scan_work, that might lead
to the following warning (if the device was already suspended):
WARNING: at drivers/mmc/core/core.c:169 mmc_wait_for_req+0x1ac/0x2c8()
Backtrace:
[<c004b50c>] (dump_backtrace+0x0/0x110)
[<c04fda50>] (dump_stack+0x0/0x1c)
[<c008f700>] (warn_slowpath_common+0x0/0x6c)
[<c008f76c>] (warn_slowpath_null+0x0/0x2c)
[<c034b058>] (mmc_wait_for_req+0x0/0x2c8)
[<c034f804>] (mmc_io_rw_extended+0x0/0x1e4)
[<c0350b5c>] (sdio_io_rw_ext_helper+0x0/0x1ac)
[<c0350e00>] (sdio_memcpy_fromio+0x0/0x2c)
[<bf194464>] (wl1271_sdio_raw_read+0x0/0x1bc [wl12xx_sdio])
[<bf15ac14>] (wl1271_cmd_wait_for_event_or_timeout+0x0/0x19c [wl12xx])
[<bf15adb0>] (wl1271_cmd_wait_for_event+0x0/0x30 [wl12xx])
[<bf15b7dc>] (wl1271_cmd_disconnect+0x0/0x14c [wl12xx])
[<bf158fd0>] (wl1271_unjoin+0x0/0x48 [wl12xx])
[<bf159070>] (wl1271_op_config+0x0/0x490 [wl12xx])
[<bf105084>] (ieee80211_hw_config+0x0/0x14c [mac80211])
[<bf113120>] (ieee80211_recalc_idle+0x0/0x4c [mac80211])
[<bf109a70>] (__ieee80211_scan_completed+0x0/0x1ac [mac80211])
[<bf109fd4>] (ieee80211_scan_work+0x0/0x484 [mac80211])
[<c00a197c>] (worker_thread+0x0/0x1e8)
[<c00a5874>] (kthread+0x0/0x90)
Signed-off-by: Eliad Peller <eliad@wizery.com>
---
v2: callback prototype was changed to void
drivers/net/wireless/wl12xx/main.c | 40 +++++++++++++++++++++++++++++++++++-
1 files changed, 39 insertions(+), 1 deletions(-)
diff --git a/drivers/net/wireless/wl12xx/main.c b/drivers/net/wireless/wl12xx/main.c
index 7017c23..4dca961 100644
--- a/drivers/net/wireless/wl12xx/main.c
+++ b/drivers/net/wireless/wl12xx/main.c
@@ -1594,7 +1594,6 @@ static int wl1271_op_suspend(struct ieee80211_hw *hw,
}
/* flush any remaining work */
wl1271_debug(DEBUG_MAC80211, "flushing remaining works");
- flush_delayed_work(&wl->scan_complete_work);
/*
* disable and re-enable interrupts in order to flush
@@ -2644,6 +2643,44 @@ out:
return ret;
}
+static void wl1271_op_cancel_hw_scan(struct ieee80211_hw *hw,
+ struct ieee80211_vif *vif)
+{
+ struct wl1271 *wl = hw->priv;
+ int ret;
+
+ wl1271_debug(DEBUG_MAC80211, "mac80211 cancel hw scan");
+
+ mutex_lock(&wl->mutex);
+
+ if (wl->state == WL1271_STATE_OFF)
+ goto out;
+
+ if (wl->scan.state == WL1271_SCAN_STATE_IDLE)
+ goto out;
+
+ ret = wl1271_ps_elp_wakeup(wl);
+ if (ret < 0)
+ goto out;
+
+ if (wl->scan.state != WL1271_SCAN_STATE_DONE) {
+ ret = wl1271_scan_stop(wl);
+ if (ret < 0)
+ goto out_sleep;
+ }
+ wl->scan.state = WL1271_SCAN_STATE_IDLE;
+ memset(wl->scan.scanned_ch, 0, sizeof(wl->scan.scanned_ch));
+ wl->scan.req = NULL;
+ ieee80211_scan_completed(wl->hw, true);
+
+out_sleep:
+ wl1271_ps_elp_sleep(wl);
+out:
+ mutex_unlock(&wl->mutex);
+
+ cancel_delayed_work_sync(&wl->scan_complete_work);
+}
+
static int wl1271_op_sched_scan_start(struct ieee80211_hw *hw,
struct ieee80211_vif *vif,
struct cfg80211_sched_scan_request *req,
@@ -3815,6 +3852,7 @@ static const struct ieee80211_ops wl1271_ops = {
.tx = wl1271_op_tx,
.set_key = wl1271_op_set_key,
.hw_scan = wl1271_op_hw_scan,
+ .cancel_hw_scan = wl1271_op_cancel_hw_scan,
.sched_scan_start = wl1271_op_sched_scan_start,
.sched_scan_stop = wl1271_op_sched_scan_stop,
.bss_info_changed = wl1271_op_bss_info_changed,
--
1.7.0.4
^ permalink raw reply related [flat|nested] 4+ messages in thread
* Re: [PATCH v2 1/3] wl12xx: configure suspend/resume only if associated/started
2011-06-27 10:06 [PATCH v2 1/3] wl12xx: configure suspend/resume only if associated/started Eliad Peller
2011-06-27 10:06 ` [PATCH v2 2/3] wl12xx: add stop_scan command Eliad Peller
2011-06-27 10:06 ` [PATCH v2 3/3] wl12xx: implement cancel_hw_scan() callback Eliad Peller
@ 2011-07-05 19:08 ` Luciano Coelho
2 siblings, 0 replies; 4+ messages in thread
From: Luciano Coelho @ 2011-07-05 19:08 UTC (permalink / raw)
To: Eliad Peller; +Cc: linux-wireless
On Mon, 2011-06-27 at 13:06 +0300, Eliad Peller wrote:
> Configure the device (to wowlan) only if the sta/ap
> is associated/started.
>
> Signed-off-by: Eliad Peller <eliad@wizery.com>
> ---
Applied the series, thanks!
--
Cheers,
Luca.
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2011-07-05 19:08 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2011-06-27 10:06 [PATCH v2 1/3] wl12xx: configure suspend/resume only if associated/started Eliad Peller
2011-06-27 10:06 ` [PATCH v2 2/3] wl12xx: add stop_scan command Eliad Peller
2011-06-27 10:06 ` [PATCH v2 3/3] wl12xx: implement cancel_hw_scan() callback Eliad Peller
2011-07-05 19:08 ` [PATCH v2 1/3] wl12xx: configure suspend/resume only if associated/started Luciano Coelho
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox