wl12xx: make WL1271_FLAG_IDLE flag per-vif
authorEliad Peller <eliad@wizery.com>
Sun, 18 Dec 2011 18:25:41 +0000 (20:25 +0200)
committerLuciano Coelho <coelho@ti.com>
Tue, 20 Dec 2011 20:30:14 +0000 (22:30 +0200)
This flag should be set per-vif, rather than globally.

Rename the flag to indicate IN_USE (rather than IDLE), as
in the default configuration (i.e. flag is clear) the vif
should be idle.

Change all the bit operations (and elp conditions) appropriately.

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

index 92a0577cb06261605b26803d981c43a1b8ee0e03..69f6937d40294a6bd29476f2d6ad6170d9bca31f 100644 (file)
@@ -2384,6 +2384,10 @@ static int wl1271_sta_handle_idle(struct wl1271 *wl, struct wl12xx_vif *wlvif,
                                  bool idle)
 {
        int ret;
+       bool cur_idle = !test_bit(WLVIF_FLAG_IN_USE, &wlvif->flags);
+
+       if (idle == cur_idle)
+               return 0;
 
        if (idle) {
                /* no need to croc if we weren't busy (e.g. during boot) */
@@ -2402,7 +2406,7 @@ static int wl1271_sta_handle_idle(struct wl1271 *wl, struct wl12xx_vif *wlvif,
                        ACX_KEEP_ALIVE_TPL_INVALID);
                if (ret < 0)
                        goto out;
-               set_bit(WL1271_FLAG_IDLE, &wl->flags);
+               clear_bit(WLVIF_FLAG_IN_USE, &wlvif->flags);
        } else {
                /* The current firmware only supports sched_scan in idle */
                if (wl->sched_scanning) {
@@ -2413,7 +2417,7 @@ static int wl1271_sta_handle_idle(struct wl1271 *wl, struct wl12xx_vif *wlvif,
                ret = wl12xx_start_dev(wl, wlvif);
                if (ret < 0)
                        goto out;
-               clear_bit(WL1271_FLAG_IDLE, &wl->flags);
+               set_bit(WLVIF_FLAG_IN_USE, &wlvif->flags);
        }
 
 out:
index a7a11088dd3104f2f8b9a2941d567c20bba822b1..a2bdacdd7e1dd742ae9398ef70c1d2eb1c8037d2 100644 (file)
@@ -53,8 +53,11 @@ void wl1271_elp_work(struct work_struct *work)
                goto out;
 
        wl12xx_for_each_wlvif(wl, wlvif) {
+               if (wlvif->bss_type == BSS_TYPE_AP_BSS)
+                       goto out;
+
                if (!test_bit(WLVIF_FLAG_PSM, &wlvif->flags) &&
-                   !test_bit(WL1271_FLAG_IDLE, &wl->flags))
+                   test_bit(WLVIF_FLAG_IN_USE, &wlvif->flags))
                        goto out;
        }
 
@@ -78,8 +81,11 @@ void wl1271_ps_elp_sleep(struct wl1271 *wl)
                return;
 
        wl12xx_for_each_wlvif(wl, wlvif) {
+               if (wlvif->bss_type == BSS_TYPE_AP_BSS)
+                       return;
+
                if (!test_bit(WLVIF_FLAG_PSM, &wlvif->flags) &&
-                   !test_bit(WL1271_FLAG_IDLE, &wl->flags))
+                   test_bit(WLVIF_FLAG_IN_USE, &wlvif->flags))
                        return;
        }
 
index 8599dab1fe2a53e22c4ae60d7a7ed2afd1d176ff..108765ab775501e0bb46ce3a5aabc54254a5ad67 100644 (file)
@@ -703,7 +703,7 @@ int wl1271_scan_sched_scan_start(struct wl1271 *wl, struct wl12xx_vif *wlvif)
        if (wlvif->bss_type != BSS_TYPE_STA_BSS)
                return -EOPNOTSUPP;
 
-       if (!test_bit(WL1271_FLAG_IDLE, &wl->flags))
+       if (test_bit(WLVIF_FLAG_IN_USE, &wlvif->flags))
                return -EBUSY;
 
        start = kzalloc(sizeof(*start), GFP_KERNEL);
index d21f71ff6f64c9326d0719b34e567740b609a54c..b2b09cd0202256c4a623c65f6870160f5fa106b9 100644 (file)
@@ -241,7 +241,6 @@ enum wl12xx_flags {
        WL1271_FLAG_IN_ELP,
        WL1271_FLAG_ELP_REQUESTED,
        WL1271_FLAG_IRQ_RUNNING,
-       WL1271_FLAG_IDLE,
        WL1271_FLAG_FW_TX_BUSY,
        WL1271_FLAG_DUMMY_PACKET_PENDING,
        WL1271_FLAG_SUSPENDED,
@@ -262,6 +261,7 @@ enum wl12xx_vif_flags {
        WLVIF_FLAG_PSPOLL_FAILURE,
        WLVIF_FLAG_CS_PROGRESS,
        WLVIF_FLAG_AP_PROBE_RESP_SET,
+       WLVIF_FLAG_IN_USE,
 };
 
 struct wl1271_link {