From a09343fc354d45973614e1120f15b5e03db8f972 Mon Sep 17 00:00:00 2001 From: =?utf8?q?J=C3=A9r=C3=B4me=20Pouiller?= Date: Wed, 15 Jan 2020 13:54:43 +0000 Subject: [PATCH] staging: wfx: simplify hif_update_ie() MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit hif_update_ie() is only called to change the beacon template. So, specialize this function and simplify the way to call it. Signed-off-by: Jérôme Pouiller Link: https://lore.kernel.org/r/20200115135338.14374-29-Jerome.Pouiller@silabs.com Signed-off-by: Greg Kroah-Hartman --- drivers/staging/wfx/hif_tx.c | 5 ++--- drivers/staging/wfx/hif_tx.h | 3 +-- drivers/staging/wfx/sta.c | 10 ++-------- 3 files changed, 5 insertions(+), 13 deletions(-) diff --git a/drivers/staging/wfx/hif_tx.c b/drivers/staging/wfx/hif_tx.c index 8df6e43..32eeba2fc 100644 --- a/drivers/staging/wfx/hif_tx.c +++ b/drivers/staging/wfx/hif_tx.c @@ -461,15 +461,14 @@ int hif_map_link(struct wfx_vif *wvif, u8 *mac_addr, int flags, int sta_id) return ret; } -int hif_update_ie(struct wfx_vif *wvif, const struct hif_ie_flags *target_frame, - const u8 *ies, size_t ies_len) +int hif_update_ie_beacon(struct wfx_vif *wvif, const u8 *ies, size_t ies_len) { int ret; struct hif_msg *hif; int buf_len = sizeof(struct hif_req_update_ie) + ies_len; struct hif_req_update_ie *body = wfx_alloc_hif(buf_len, &hif); - memcpy(&body->ie_flags, target_frame, sizeof(struct hif_ie_flags)); + body->ie_flags.beacon = 1; body->num_ies = cpu_to_le16(1); memcpy(body->ie, ies, ies_len); wfx_fill_header(hif, wvif->id, HIF_REQ_ID_UPDATE_IE, buf_len); diff --git a/drivers/staging/wfx/hif_tx.h b/drivers/staging/wfx/hif_tx.h index fbaed99..924b889 100644 --- a/drivers/staging/wfx/hif_tx.h +++ b/drivers/staging/wfx/hif_tx.h @@ -57,8 +57,7 @@ int hif_start(struct wfx_vif *wvif, const struct ieee80211_bss_conf *conf, const struct ieee80211_channel *channel); int hif_beacon_transmit(struct wfx_vif *wvif, bool enable); int hif_map_link(struct wfx_vif *wvif, u8 *mac_addr, int flags, int sta_id); -int hif_update_ie(struct wfx_vif *wvif, const struct hif_ie_flags *target_frame, - const u8 *ies, size_t ies_len); +int hif_update_ie_beacon(struct wfx_vif *wvif, const u8 *ies, size_t ies_len); int hif_sl_set_mac_key(struct wfx_dev *wdev, const u8 *slk_key, int destination); int hif_sl_config(struct wfx_dev *wdev, const unsigned long *bitmap); diff --git a/drivers/staging/wfx/sta.c b/drivers/staging/wfx/sta.c index e02ebc3..395a282 100644 --- a/drivers/staging/wfx/sta.c +++ b/drivers/staging/wfx/sta.c @@ -881,9 +881,6 @@ void wfx_bss_info_changed(struct ieee80211_hw *hw, if (changed & BSS_CHANGED_ASSOC || changed & BSS_CHANGED_ERP_CTS_PROT || changed & BSS_CHANGED_ERP_PREAMBLE) { - struct hif_ie_flags target_frame = { - .beacon = 1, - }; u8 erp_ie[3] = { WLAN_EID_ERP_INFO, 1, 0 }; hif_erp_use_protection(wvif, info->use_cts_prot); @@ -892,7 +889,7 @@ void wfx_bss_info_changed(struct ieee80211_hw *hw, if (info->use_short_preamble) erp_ie[2] |= WLAN_ERP_BARKER_PREAMBLE; if (wvif->vif->type != NL80211_IFTYPE_STATION) - hif_update_ie(wvif, &target_frame, erp_ie, sizeof(erp_ie)); + hif_update_ie_beacon(wvif, erp_ie, sizeof(erp_ie)); } if (changed & BSS_CHANGED_ASSOC || changed & BSS_CHANGED_ERP_SLOT) @@ -960,9 +957,6 @@ void wfx_sta_notify(struct ieee80211_hw *hw, struct ieee80211_vif *vif, static int wfx_set_tim_impl(struct wfx_vif *wvif, bool aid0_bit_set) { struct sk_buff *skb; - struct hif_ie_flags target_frame = { - .beacon = 1, - }; u16 tim_offset, tim_length; u8 *tim_ptr; @@ -987,7 +981,7 @@ static int wfx_set_tim_impl(struct wfx_vif *wvif, bool aid0_bit_set) tim_ptr[4] &= ~1; } - hif_update_ie(wvif, &target_frame, tim_ptr, tim_length); + hif_update_ie_beacon(wvif, tim_ptr, tim_length); dev_kfree_skb(skb); return 0; -- 2.7.4