wl12xx: configure sleep_policy according to active roles
If there is an active AP role, stay always on.
Otherwise, allow chip to enter elp.
(Note that this is a global configuration, so if the
device is already configured according to our policy,
we don't have to configure it again)
Signed-off-by: Eliad Peller <eliad@wizery.com>
Signed-off-by: Luciano Coelho <coelho@ti.com>
diff --git a/drivers/net/wireless/wl12xx/main.c b/drivers/net/wireless/wl12xx/main.c
index 0623f5d..b52deac 100644
--- a/drivers/net/wireless/wl12xx/main.c
+++ b/drivers/net/wireless/wl12xx/main.c
@@ -2117,6 +2117,11 @@
wl->vif = vif;
list_add(&wlvif->list, &wl->wlvif_list);
set_bit(WL1271_FLAG_IF_INITIALIZED, &wl->flags);
+
+ if (wlvif->bss_type == BSS_TYPE_AP_BSS)
+ wl->ap_count++;
+ else
+ wl->sta_count++;
out:
mutex_unlock(&wl->mutex);
@@ -2188,6 +2193,11 @@
wlvif->role_id = WL12XX_INVALID_ROLE_ID;
wlvif->dev_role_id = WL12XX_INVALID_ROLE_ID;
+ if (wlvif->bss_type == BSS_TYPE_AP_BSS)
+ wl->ap_count--;
+ else
+ wl->sta_count--;
+
mutex_unlock(&wl->mutex);
cancel_delayed_work_sync(&wlvif->pspoll_work);