diff mbox series

[v2,28/65] staging: wfx: simplify hif_update_ie()

Message ID 20200115135338.14374-29-Jerome.Pouiller@silabs.com
State New
Headers show
Series Simplify and improve the wfx driver | expand

Commit Message

Jérôme Pouiller Jan. 15, 2020, 1:54 p.m. UTC
From: Jérôme Pouiller <jerome.pouiller@silabs.com>

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 <jerome.pouiller@silabs.com>
---
 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 mbox series

Patch

diff --git a/drivers/staging/wfx/hif_tx.c b/drivers/staging/wfx/hif_tx.c
index 8df6e43fe742..32eeba2fca47 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 fbaed991b112..924b889cad0a 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 e02ebc39ed41..395a282346b1 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;