brcmfmac: remove brcmf_update_prof() function

The function brcmf_update_prof() only add complexity that is not
needed.

Reviewed-by: Hante Meuleman <meuleman@broadcom.com>
Reviewed-by: Pieter-Paul Giesberts <pieterpg@broadcom.com>
Signed-off-by: Arend van Spriel <arend@broadcom.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
diff --git a/drivers/net/wireless/brcm80211/brcmfmac/wl_cfg80211.c b/drivers/net/wireless/brcm80211/brcmfmac/wl_cfg80211.c
index 53c17f9..eca71b3 100644
--- a/drivers/net/wireless/brcm80211/brcmfmac/wl_cfg80211.c
+++ b/drivers/net/wireless/brcm80211/brcmfmac/wl_cfg80211.c
@@ -1283,47 +1283,6 @@
 	return err;
 }
 
-static s32
-brcmf_update_prof(struct brcmf_cfg80211_info *cfg,
-		  const struct brcmf_event_msg *e, void *data, s32 item)
-{
-	s32 err = 0;
-	struct brcmf_ssid *ssid;
-
-	switch (item) {
-	case WL_PROF_SSID:
-		ssid = (struct brcmf_ssid *) data;
-		memset(cfg->profile->ssid.SSID, 0,
-		       sizeof(cfg->profile->ssid.SSID));
-		memcpy(cfg->profile->ssid.SSID,
-		       ssid->SSID, ssid->SSID_len);
-		cfg->profile->ssid.SSID_len = ssid->SSID_len;
-		break;
-	case WL_PROF_BSSID:
-		if (data)
-			memcpy(cfg->profile->bssid, data, ETH_ALEN);
-		else
-			memset(cfg->profile->bssid, 0, ETH_ALEN);
-		break;
-	case WL_PROF_SEC:
-		memcpy(&cfg->profile->sec, data,
-		       sizeof(cfg->profile->sec));
-		break;
-	case WL_PROF_BEACONINT:
-		cfg->profile->beacon_interval = *(u16 *)data;
-		break;
-	case WL_PROF_DTIMPERIOD:
-		cfg->profile->dtim_period = *(u8 *)data;
-		break;
-	default:
-		WL_ERR("unsupported item (%d)\n", item);
-		err = -EOPNOTSUPP;
-		break;
-	}
-
-	return err;
-}
-
 static void brcmf_init_prof(struct brcmf_cfg80211_profile *prof)
 {
 	memset(prof, 0, sizeof(*prof));
@@ -1379,12 +1338,12 @@
 		      struct cfg80211_ibss_params *params)
 {
 	struct brcmf_cfg80211_info *cfg = wiphy_to_cfg(wiphy);
+	struct brcmf_cfg80211_profile *profile = cfg->profile;
 	struct brcmf_join_params join_params;
 	size_t join_params_size = 0;
 	s32 err = 0;
 	s32 wsec = 0;
 	s32 bcnprd;
-	struct brcmf_ssid ssid;
 
 	WL_TRACE("Enter\n");
 	if (!check_sys_up(wiphy))
@@ -1460,25 +1419,23 @@
 	memset(&join_params, 0, sizeof(struct brcmf_join_params));
 
 	/* SSID */
-	ssid.SSID_len = min_t(u32, params->ssid_len, 32);
-	memcpy(ssid.SSID, params->ssid, ssid.SSID_len);
-	memcpy(join_params.ssid_le.SSID, params->ssid, ssid.SSID_len);
-	join_params.ssid_le.SSID_len = cpu_to_le32(ssid.SSID_len);
+	profile->ssid.SSID_len = min_t(u32, params->ssid_len, 32);
+	memcpy(profile->ssid.SSID, params->ssid, profile->ssid.SSID_len);
+	memcpy(join_params.ssid_le.SSID, params->ssid, profile->ssid.SSID_len);
+	join_params.ssid_le.SSID_len = cpu_to_le32(profile->ssid.SSID_len);
 	join_params_size = sizeof(join_params.ssid_le);
-	brcmf_update_prof(cfg, NULL, &ssid, WL_PROF_SSID);
 
 	/* BSSID */
 	if (params->bssid) {
 		memcpy(join_params.params_le.bssid, params->bssid, ETH_ALEN);
 		join_params_size = sizeof(join_params.ssid_le) +
 				   BRCMF_ASSOC_PARAMS_FIXED_SIZE;
+		memcpy(profile->bssid, params->bssid, ETH_ALEN);
 	} else {
 		memcpy(join_params.params_le.bssid, ether_bcast, ETH_ALEN);
+		memset(profile->bssid, 0, ETH_ALEN);
 	}
 
-	brcmf_update_prof(cfg, NULL,
-			  &join_params.params_le.bssid, WL_PROF_BSSID);
-
 	/* Channel */
 	if (params->channel) {
 		u32 target_channel;
@@ -1800,6 +1757,7 @@
 		    struct cfg80211_connect_params *sme)
 {
 	struct brcmf_cfg80211_info *cfg = wiphy_to_cfg(wiphy);
+	struct brcmf_cfg80211_profile *profile = cfg->profile;
 	struct ieee80211_channel *chan = sme->channel;
 	struct brcmf_join_params join_params;
 	size_t join_params_size;
@@ -1861,11 +1819,11 @@
 	memset(&join_params, 0, sizeof(join_params));
 	join_params_size = sizeof(join_params.ssid_le);
 
-	ssid.SSID_len = min_t(u32, sizeof(ssid.SSID), (u32)sme->ssid_len);
-	memcpy(&join_params.ssid_le.SSID, sme->ssid, ssid.SSID_len);
-	memcpy(&ssid.SSID, sme->ssid, ssid.SSID_len);
-	join_params.ssid_le.SSID_len = cpu_to_le32(ssid.SSID_len);
-	brcmf_update_prof(cfg, NULL, &ssid, WL_PROF_SSID);
+	profile->ssid.SSID_len = min_t(u32,
+				       sizeof(ssid.SSID), (u32)sme->ssid_len);
+	memcpy(&join_params.ssid_le.SSID, sme->ssid, profile->ssid.SSID_len);
+	memcpy(&profile->ssid.SSID, sme->ssid, profile->ssid.SSID_len);
+	join_params.ssid_le.SSID_len = cpu_to_le32(profile->ssid.SSID_len);
 
 	memcpy(join_params.params_le.bssid, ether_bcast, ETH_ALEN);
 
@@ -2781,8 +2739,8 @@
 		dtim_period = (u8)var;
 	}
 
-	brcmf_update_prof(cfg, NULL, &beacon_interval, WL_PROF_BEACONINT);
-	brcmf_update_prof(cfg, NULL, &dtim_period, WL_PROF_DTIMPERIOD);
+	profile->beacon_interval = beacon_interval;
+	profile->dtim_period = dtim_period;
 
 update_bss_info_out:
 	WL_TRACE("Exit");
@@ -4656,7 +4614,7 @@
 	WL_TRACE("Enter\n");
 
 	brcmf_get_assoc_ies(cfg);
-	brcmf_update_prof(cfg, NULL, &e->addr, WL_PROF_BSSID);
+	memcpy(profile->bssid, e->addr, ETH_ALEN);
 	brcmf_update_bss_info(cfg);
 
 	brcmf_exec_dcmd(ndev, BRCMF_C_GET_CHANNEL, &channel_le,
@@ -4697,8 +4655,7 @@
 	if (test_and_clear_bit(WL_STATUS_CONNECTING, &cfg->status)) {
 		if (completed) {
 			brcmf_get_assoc_ies(cfg);
-			brcmf_update_prof(cfg, NULL, &e->addr,
-					  WL_PROF_BSSID);
+			memcpy(profile->bssid, e->addr, ETH_ALEN);
 			brcmf_update_bss_info(cfg);
 		}
 		cfg80211_connect_result(ndev,
@@ -4763,6 +4720,7 @@
 			    struct net_device *ndev,
 			    const struct brcmf_event_msg *e, void *data)
 {
+	struct brcmf_cfg80211_profile *profile = cfg->profile;
 	s32 err = 0;
 
 	if (cfg->conf->mode == WL_MODE_AP) {
@@ -4770,8 +4728,7 @@
 	} else if (brcmf_is_linkup(cfg, e)) {
 		WL_CONN("Linkup\n");
 		if (brcmf_is_ibssmode(cfg)) {
-			brcmf_update_prof(cfg, NULL, (void *)e->addr,
-				WL_PROF_BSSID);
+			memcpy(profile->bssid, e->addr, ETH_ALEN);
 			wl_inform_ibss(cfg, ndev, e->addr);
 			cfg80211_ibss_joined(ndev, e->addr, GFP_KERNEL);
 			clear_bit(WL_STATUS_CONNECTING, &cfg->status);