Skip to content

Commit 06bb123

Browse files
Arend van Spriellinvjw
authored andcommitted
brcmfmac: remove brcmf_read_prof() function
The function brcmf_read_prof() provided access to fields with brcmf_cfg80211_profile structure using a field id, but the calling function can easily access that structure directly. This patch removes the function. 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>
1 parent 27a68fe commit 06bb123

File tree

1 file changed

+22
-27
lines changed

1 file changed

+22
-27
lines changed

drivers/net/wireless/brcm80211/brcmfmac/wl_cfg80211.c

Lines changed: 22 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -1283,20 +1283,6 @@ static s32 brcmf_cfg80211_set_wiphy_params(struct wiphy *wiphy, u32 changed)
12831283
return err;
12841284
}
12851285

1286-
static void *brcmf_read_prof(struct brcmf_cfg80211_info *cfg, s32 item)
1287-
{
1288-
switch (item) {
1289-
case WL_PROF_SEC:
1290-
return &cfg->profile->sec;
1291-
case WL_PROF_BSSID:
1292-
return &cfg->profile->bssid;
1293-
case WL_PROF_SSID:
1294-
return &cfg->profile->ssid;
1295-
}
1296-
WL_ERR("invalid item (%d)\n", item);
1297-
return NULL;
1298-
}
1299-
13001286
static s32
13011287
brcmf_update_prof(struct brcmf_cfg80211_info *cfg,
13021288
const struct brcmf_event_msg *e, void *data, s32 item)
@@ -1555,6 +1541,7 @@ static s32 brcmf_set_wpa_version(struct net_device *ndev,
15551541
struct cfg80211_connect_params *sme)
15561542
{
15571543
struct brcmf_cfg80211_info *cfg = ndev_to_cfg(ndev);
1544+
struct brcmf_cfg80211_profile *profile = cfg->profile;
15581545
struct brcmf_cfg80211_security *sec;
15591546
s32 val = 0;
15601547
s32 err = 0;
@@ -1571,7 +1558,7 @@ static s32 brcmf_set_wpa_version(struct net_device *ndev,
15711558
WL_ERR("set wpa_auth failed (%d)\n", err);
15721559
return err;
15731560
}
1574-
sec = brcmf_read_prof(cfg, WL_PROF_SEC);
1561+
sec = &profile->sec;
15751562
sec->wpa_versions = sme->crypto.wpa_versions;
15761563
return err;
15771564
}
@@ -1580,6 +1567,7 @@ static s32 brcmf_set_auth_type(struct net_device *ndev,
15801567
struct cfg80211_connect_params *sme)
15811568
{
15821569
struct brcmf_cfg80211_info *cfg = ndev_to_cfg(ndev);
1570+
struct brcmf_cfg80211_profile *profile = cfg->profile;
15831571
struct brcmf_cfg80211_security *sec;
15841572
s32 val = 0;
15851573
s32 err = 0;
@@ -1610,7 +1598,7 @@ static s32 brcmf_set_auth_type(struct net_device *ndev,
16101598
WL_ERR("set auth failed (%d)\n", err);
16111599
return err;
16121600
}
1613-
sec = brcmf_read_prof(cfg, WL_PROF_SEC);
1601+
sec = &profile->sec;
16141602
sec->auth_type = sme->auth_type;
16151603
return err;
16161604
}
@@ -1620,6 +1608,7 @@ brcmf_set_set_cipher(struct net_device *ndev,
16201608
struct cfg80211_connect_params *sme)
16211609
{
16221610
struct brcmf_cfg80211_info *cfg = ndev_to_cfg(ndev);
1611+
struct brcmf_cfg80211_profile *profile = cfg->profile;
16231612
struct brcmf_cfg80211_security *sec;
16241613
s32 pval = 0;
16251614
s32 gval = 0;
@@ -1675,7 +1664,7 @@ brcmf_set_set_cipher(struct net_device *ndev,
16751664
return err;
16761665
}
16771666

1678-
sec = brcmf_read_prof(cfg, WL_PROF_SEC);
1667+
sec = &profile->sec;
16791668
sec->cipher_pairwise = sme->crypto.ciphers_pairwise[0];
16801669
sec->cipher_group = sme->crypto.cipher_group;
16811670

@@ -1686,6 +1675,7 @@ static s32
16861675
brcmf_set_key_mgmt(struct net_device *ndev, struct cfg80211_connect_params *sme)
16871676
{
16881677
struct brcmf_cfg80211_info *cfg = ndev_to_cfg(ndev);
1678+
struct brcmf_cfg80211_profile *profile = cfg->profile;
16891679
struct brcmf_cfg80211_security *sec;
16901680
s32 val = 0;
16911681
s32 err = 0;
@@ -1731,7 +1721,7 @@ brcmf_set_key_mgmt(struct net_device *ndev, struct cfg80211_connect_params *sme)
17311721
return err;
17321722
}
17331723
}
1734-
sec = brcmf_read_prof(cfg, WL_PROF_SEC);
1724+
sec = &profile->sec;
17351725
sec->wpa_auth = sme->crypto.akm_suites[0];
17361726

17371727
return err;
@@ -1742,6 +1732,7 @@ brcmf_set_sharedkey(struct net_device *ndev,
17421732
struct cfg80211_connect_params *sme)
17431733
{
17441734
struct brcmf_cfg80211_info *cfg = ndev_to_cfg(ndev);
1735+
struct brcmf_cfg80211_profile *profile = cfg->profile;
17451736
struct brcmf_cfg80211_security *sec;
17461737
struct brcmf_wsec_key key;
17471738
s32 val;
@@ -1753,7 +1744,7 @@ brcmf_set_sharedkey(struct net_device *ndev,
17531744
if (sme->key_len == 0)
17541745
return 0;
17551746

1756-
sec = brcmf_read_prof(cfg, WL_PROF_SEC);
1747+
sec = &profile->sec;
17571748
WL_CONN("wpa_versions 0x%x cipher_pairwise 0x%x\n",
17581749
sec->wpa_versions, sec->cipher_pairwise);
17591750

@@ -1901,6 +1892,7 @@ brcmf_cfg80211_disconnect(struct wiphy *wiphy, struct net_device *ndev,
19011892
u16 reason_code)
19021893
{
19031894
struct brcmf_cfg80211_info *cfg = wiphy_to_cfg(wiphy);
1895+
struct brcmf_cfg80211_profile *profile = cfg->profile;
19041896
struct brcmf_scb_val_le scbval;
19051897
s32 err = 0;
19061898

@@ -1910,7 +1902,7 @@ brcmf_cfg80211_disconnect(struct wiphy *wiphy, struct net_device *ndev,
19101902

19111903
clear_bit(WL_STATUS_CONNECTED, &cfg->status);
19121904

1913-
memcpy(&scbval.ea, brcmf_read_prof(cfg, WL_PROF_BSSID), ETH_ALEN);
1905+
memcpy(&scbval.ea, &profile->bssid, ETH_ALEN);
19141906
scbval.val = cpu_to_le32(reason_code);
19151907
err = brcmf_exec_dcmd(ndev, BRCMF_C_DISASSOC, &scbval,
19161908
sizeof(struct brcmf_scb_val_le));
@@ -2262,6 +2254,7 @@ brcmf_cfg80211_get_key(struct wiphy *wiphy, struct net_device *ndev,
22622254
{
22632255
struct key_params params;
22642256
struct brcmf_cfg80211_info *cfg = wiphy_to_cfg(wiphy);
2257+
struct brcmf_cfg80211_profile *profile = cfg->profile;
22652258
struct brcmf_cfg80211_security *sec;
22662259
s32 wsec;
22672260
s32 err = 0;
@@ -2284,7 +2277,7 @@ brcmf_cfg80211_get_key(struct wiphy *wiphy, struct net_device *ndev,
22842277
}
22852278
switch (wsec & ~SES_OW_ENABLED) {
22862279
case WEP_ENABLED:
2287-
sec = brcmf_read_prof(cfg, WL_PROF_SEC);
2280+
sec = &profile->sec;
22882281
if (sec->cipher_pairwise & WLAN_CIPHER_SUITE_WEP40) {
22892282
params.cipher = WLAN_CIPHER_SUITE_WEP40;
22902283
WL_CONN("WLAN_CIPHER_SUITE_WEP40\n");
@@ -2327,11 +2320,12 @@ brcmf_cfg80211_get_station(struct wiphy *wiphy, struct net_device *ndev,
23272320
u8 *mac, struct station_info *sinfo)
23282321
{
23292322
struct brcmf_cfg80211_info *cfg = wiphy_to_cfg(wiphy);
2323+
struct brcmf_cfg80211_profile *profile = cfg->profile;
23302324
struct brcmf_scb_val_le scb_val;
23312325
int rssi;
23322326
s32 rate;
23332327
s32 err = 0;
2334-
u8 *bssid = brcmf_read_prof(cfg, WL_PROF_BSSID);
2328+
u8 *bssid = profile->bssid;
23352329
struct brcmf_sta_info_le *sta_info_le;
23362330

23372331
WL_TRACE("Enter, MAC %pM\n", mac);
@@ -2735,6 +2729,7 @@ brcmf_find_wpaie(u8 *parse, u32 len)
27352729

27362730
static s32 brcmf_update_bss_info(struct brcmf_cfg80211_info *cfg)
27372731
{
2732+
struct brcmf_cfg80211_profile *profile = cfg->profile;
27382733
struct brcmf_bss_info_le *bi;
27392734
struct brcmf_ssid *ssid;
27402735
struct brcmf_tlv *tim;
@@ -2748,7 +2743,7 @@ static s32 brcmf_update_bss_info(struct brcmf_cfg80211_info *cfg)
27482743
if (brcmf_is_ibssmode(cfg))
27492744
return err;
27502745

2751-
ssid = (struct brcmf_ssid *)brcmf_read_prof(cfg, WL_PROF_SSID);
2746+
ssid = &profile->ssid;
27522747

27532748
*(__le32 *)cfg->extra_buf = cpu_to_le32(WL_EXTRA_BUF_MAX);
27542749
err = brcmf_exec_dcmd(cfg_to_ndev(cfg), BRCMF_C_GET_BSS_INFO,
@@ -4648,6 +4643,7 @@ brcmf_bss_roaming_done(struct brcmf_cfg80211_info *cfg,
46484643
struct net_device *ndev,
46494644
const struct brcmf_event_msg *e)
46504645
{
4646+
struct brcmf_cfg80211_profile *profile = cfg->profile;
46514647
struct brcmf_cfg80211_connect_info *conn_info = cfg_to_conn(cfg);
46524648
struct wiphy *wiphy = cfg_to_wiphy(cfg);
46534649
struct brcmf_channel_info_le channel_le;
@@ -4677,8 +4673,7 @@ brcmf_bss_roaming_done(struct brcmf_cfg80211_info *cfg,
46774673
freq = ieee80211_channel_to_frequency(target_channel, band->band);
46784674
notify_channel = ieee80211_get_channel(wiphy, freq);
46794675

4680-
cfg80211_roamed(ndev, notify_channel,
4681-
(u8 *)brcmf_read_prof(cfg, WL_PROF_BSSID),
4676+
cfg80211_roamed(ndev, notify_channel, (u8 *)profile->bssid,
46824677
conn_info->req_ie, conn_info->req_ie_len,
46834678
conn_info->resp_ie, conn_info->resp_ie_len, GFP_KERNEL);
46844679
WL_CONN("Report roaming result\n");
@@ -4693,6 +4688,7 @@ brcmf_bss_connect_done(struct brcmf_cfg80211_info *cfg,
46934688
struct net_device *ndev, const struct brcmf_event_msg *e,
46944689
bool completed)
46954690
{
4691+
struct brcmf_cfg80211_profile *profile = cfg->profile;
46964692
struct brcmf_cfg80211_connect_info *conn_info = cfg_to_conn(cfg);
46974693
s32 err = 0;
46984694

@@ -4706,8 +4702,7 @@ brcmf_bss_connect_done(struct brcmf_cfg80211_info *cfg,
47064702
brcmf_update_bss_info(cfg);
47074703
}
47084704
cfg80211_connect_result(ndev,
4709-
(u8 *)brcmf_read_prof(cfg,
4710-
WL_PROF_BSSID),
4705+
(u8 *)profile->bssid,
47114706
conn_info->req_ie,
47124707
conn_info->req_ie_len,
47134708
conn_info->resp_ie,

0 commit comments

Comments
 (0)