From: Jérôme Pouiller <jerome.pouil...@silabs.com>

Current code parse the TIM and retrieve the DTIM period. It is far
easier to rely on bss_info_changed() for this job.

It is no more necessary to run task asynchronously. So
set_beacon_wakeup_period_work is now useless.

Signed-off-by: Jérôme Pouiller <jerome.pouil...@silabs.com>
---
 drivers/staging/wfx/data_rx.c | 14 --------------
 drivers/staging/wfx/sta.c     | 19 ++++++-------------
 drivers/staging/wfx/wfx.h     |  2 --
 3 files changed, 6 insertions(+), 29 deletions(-)

diff --git a/drivers/staging/wfx/data_rx.c b/drivers/staging/wfx/data_rx.c
index d460c0ffca1f..0ab71c911f84 100644
--- a/drivers/staging/wfx/data_rx.c
+++ b/drivers/staging/wfx/data_rx.c
@@ -173,20 +173,6 @@ void wfx_rx_cb(struct wfx_vif *wvif,
            !arg->status && wvif->vif &&
            ether_addr_equal(ieee80211_get_SA(frame),
                             wvif->vif->bss_conf.bssid)) {
-               const u8 *tim_ie;
-               u8 *ies = mgmt->u.beacon.variable;
-               size_t ies_len = skb->len - (ies - skb->data);
-
-               tim_ie = cfg80211_find_ie(WLAN_EID_TIM, ies, ies_len);
-               if (tim_ie) {
-                       struct ieee80211_tim_ie *tim = (struct ieee80211_tim_ie 
*)&tim_ie[2];
-
-                       if (wvif->dtim_period != tim->dtim_period) {
-                               wvif->dtim_period = tim->dtim_period;
-                               
schedule_work(&wvif->set_beacon_wakeup_period_work);
-                       }
-               }
-
                /* Disable beacon filter once we're associated... */
                if (wvif->disable_beacon_filter &&
                    (wvif->vif->bss_conf.assoc ||
diff --git a/drivers/staging/wfx/sta.c b/drivers/staging/wfx/sta.c
index ae01f7be0ddb..1af99b7930f4 100644
--- a/drivers/staging/wfx/sta.c
+++ b/drivers/staging/wfx/sta.c
@@ -446,15 +446,6 @@ static void wfx_bss_params_work(struct work_struct *work)
        mutex_unlock(&wvif->wdev->conf_mutex);
 }
 
-static void wfx_set_beacon_wakeup_period_work(struct work_struct *work)
-{
-       struct wfx_vif *wvif = container_of(work, struct wfx_vif,
-                                           set_beacon_wakeup_period_work);
-
-       hif_set_beacon_wakeup_period(wvif, wvif->dtim_period,
-                                    wvif->dtim_period);
-}
-
 static void wfx_do_unjoin(struct wfx_vif *wvif)
 {
        mutex_lock(&wvif->wdev->conf_mutex);
@@ -466,7 +457,6 @@ static void wfx_do_unjoin(struct wfx_vif *wvif)
                goto done;
 
        cancel_work_sync(&wvif->update_filtering_work);
-       cancel_work_sync(&wvif->set_beacon_wakeup_period_work);
        wvif->state = WFX_STATE_PASSIVE;
 
        /* Unjoin is a reset. */
@@ -823,7 +813,8 @@ static void wfx_join_finalize(struct wfx_vif *wvif,
                hif_keep_alive_period(wvif, 30 /* sec */);
                hif_set_bss_params(wvif, &wvif->bss_params);
                wvif->setbssparams_done = true;
-               
wfx_set_beacon_wakeup_period_work(&wvif->set_beacon_wakeup_period_work);
+               hif_set_beacon_wakeup_period(wvif, info->dtim_period,
+                                            info->dtim_period);
                wfx_update_pm(wvif);
        }
 }
@@ -872,6 +863,10 @@ void wfx_bss_info_changed(struct ieee80211_hw *hw,
                }
        }
 
+       if (changed & BSS_CHANGED_BEACON_INFO)
+               hif_set_beacon_wakeup_period(wvif, info->dtim_period,
+                                            info->dtim_period);
+
        /* assoc/disassoc, or maybe AID changed */
        if (changed & BSS_CHANGED_ASSOC) {
                wfx_tx_lock_flush(wdev);
@@ -1260,8 +1255,6 @@ int wfx_add_interface(struct ieee80211_hw *hw, struct 
ieee80211_vif *vif)
 
        init_completion(&wvif->set_pm_mode_complete);
        complete(&wvif->set_pm_mode_complete);
-       INIT_WORK(&wvif->set_beacon_wakeup_period_work,
-                 wfx_set_beacon_wakeup_period_work);
        INIT_WORK(&wvif->update_filtering_work, wfx_update_filtering_work);
        INIT_WORK(&wvif->bss_params_work, wfx_bss_params_work);
        INIT_WORK(&wvif->set_cts_work, wfx_set_cts_work);
diff --git a/drivers/staging/wfx/wfx.h b/drivers/staging/wfx/wfx.h
index 155dbe5704c9..d201cceec1ab 100644
--- a/drivers/staging/wfx/wfx.h
+++ b/drivers/staging/wfx/wfx.h
@@ -101,8 +101,6 @@ struct wfx_vif {
        int                     dtim_period;
        int                     beacon_int;
        bool                    enable_beacon;
-       struct work_struct      set_beacon_wakeup_period_work;
-
        bool                    filter_bssid;
        bool                    fwd_probe_req;
        bool                    disable_beacon_filter;
-- 
2.25.0

_______________________________________________
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel

Reply via email to