wl12xx: configure suspend/resume only if associated/started
authorEliad Peller <eliad@wizery.com>
Mon, 27 Jun 2011 10:06:43 +0000 (13:06 +0300)
committerLuciano Coelho <coelho@ti.com>
Tue, 5 Jul 2011 18:50:39 +0000 (21:50 +0300)
Configure the device (to wowlan) only if the sta/ap
is associated/started.

Signed-off-by: Eliad Peller <eliad@wizery.com>
Signed-off-by: Luciano Coelho <coelho@ti.com>
drivers/net/wireless/wl12xx/main.c

index d7a74597fd590cc8d5402fb0ce0b5c314584759f..357dc9d999451c8b8891f8b7c5a91da9dcbf03b7 100644 (file)
@@ -1610,10 +1610,13 @@ static struct notifier_block wl1271_dev_notifier = {
 #ifdef CONFIG_PM
 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;
@@ -1658,10 +1661,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;