Skip to content

Commit 203afec

Browse files
marcyanglinvjw
authored andcommitted
mwifiex: remove unnecessary _set_auth functions
mwifiex_set_encrypt_mode() mwifiex_set_auth_mode() mwifiex_set_auth() These functions are confusing and misleading. And they are really not needed at all. Some unused definitions are also removed. Signed-off-by: Marc Yang <yangyang@marvell.com> Signed-off-by: Bing Zhao <bzhao@marvell.com> Signed-off-by: John W. Linville <linville@tuxdriver.com>
1 parent 0022801 commit 203afec

5 files changed

Lines changed: 19 additions & 77 deletions

File tree

‎drivers/net/wireless/mwifiex/cfg80211.c‎

Lines changed: 8 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1055,11 +1055,10 @@ mwifiex_cfg80211_assoc(struct mwifiex_private *priv, size_t ssid_len, u8 *ssid,
10551055
* scan. The cfg80211 does not give us the encryption
10561056
* mode at this stage so just setting it to WEP here.
10571057
*/
1058-
wpa_enabled = 0;
1059-
auth_type = MWIFIEX_AUTH_MODE_OPEN;
1060-
ret = mwifiex_set_auth(priv,
1061-
MWIFIEX_ENCRYPTION_MODE_WEP104,
1062-
auth_type, wpa_enabled);
1058+
priv->sec_info.encryption_mode =
1059+
MWIFIEX_ENCRYPTION_MODE_WEP104;
1060+
priv->sec_info.authentication_mode =
1061+
MWIFIEX_AUTH_MODE_OPEN;
10631062
}
10641063

10651064
goto done;
@@ -1075,15 +1074,15 @@ mwifiex_cfg80211_assoc(struct mwifiex_private *priv, size_t ssid_len, u8 *ssid,
10751074
if (sme->crypto.n_ciphers_pairwise) {
10761075
pairwise_encrypt_mode = mwifiex_get_mwifiex_cipher(sme->crypto.
10771076
ciphers_pairwise[0], &wpa_enabled);
1078-
ret = mwifiex_set_auth(priv, pairwise_encrypt_mode, auth_type,
1079-
wpa_enabled);
1077+
priv->sec_info.encryption_mode = pairwise_encrypt_mode;
1078+
priv->sec_info.authentication_mode = auth_type;
10801079
}
10811080

10821081
if (sme->crypto.cipher_group) {
10831082
group_encrypt_mode = mwifiex_get_mwifiex_cipher(sme->crypto.
10841083
cipher_group, &wpa_enabled);
1085-
ret = mwifiex_set_auth(priv, group_encrypt_mode, auth_type,
1086-
wpa_enabled);
1084+
priv->sec_info.encryption_mode = group_encrypt_mode;
1085+
priv->sec_info.authentication_mode = auth_type;
10871086
}
10881087
if (sme->ie)
10891088
ret = mwifiex_set_gen_ie(priv, sme->ie, sme->ie_len);

‎drivers/net/wireless/mwifiex/ioctl.h‎

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -277,8 +277,6 @@ struct mwifiex_debug_info {
277277
enum {
278278
MWIFIEX_AUTH_MODE_OPEN = 0x00,
279279
MWIFIEX_AUTH_MODE_SHARED = 0x01,
280-
MWIFIEX_AUTH_MODE_NETWORKEAP = 0x80,
281-
MWIFIEX_AUTH_MODE_AUTO = 0xFF,
282280
};
283281

284282
enum {

‎drivers/net/wireless/mwifiex/join.c‎

Lines changed: 11 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -441,20 +441,17 @@ int mwifiex_cmd_802_11_associate(struct mwifiex_private *priv,
441441
dev_dbg(priv->adapter->dev, "info: ASSOC_CMD: rates size = %d\n",
442442
rates_size);
443443

444-
/* Add the Authentication type to be used for Auth frames if needed */
445-
if (priv->sec_info.authentication_mode != MWIFIEX_AUTH_MODE_AUTO) {
446-
auth_tlv = (struct mwifiex_ie_types_auth_type *) pos;
447-
auth_tlv->header.type = cpu_to_le16(TLV_TYPE_AUTH_TYPE);
448-
auth_tlv->header.len = cpu_to_le16(sizeof(auth_tlv->auth_type));
449-
if (priv->sec_info.wep_status == MWIFIEX_802_11_WEP_ENABLED)
450-
auth_tlv->auth_type = cpu_to_le16((u16) priv->sec_info.
451-
authentication_mode);
452-
else
453-
auth_tlv->auth_type =
454-
cpu_to_le16(MWIFIEX_AUTH_MODE_OPEN);
455-
pos += sizeof(auth_tlv->header) +
456-
le16_to_cpu(auth_tlv->header.len);
457-
}
444+
/* Add the Authentication type to be used for Auth frames */
445+
auth_tlv = (struct mwifiex_ie_types_auth_type *) pos;
446+
auth_tlv->header.type = cpu_to_le16(TLV_TYPE_AUTH_TYPE);
447+
auth_tlv->header.len = cpu_to_le16(sizeof(auth_tlv->auth_type));
448+
if (priv->sec_info.wep_status == MWIFIEX_802_11_WEP_ENABLED)
449+
auth_tlv->auth_type = cpu_to_le16(
450+
(u16) priv->sec_info.authentication_mode);
451+
else
452+
auth_tlv->auth_type = cpu_to_le16(MWIFIEX_AUTH_MODE_OPEN);
453+
454+
pos += sizeof(auth_tlv->header) + le16_to_cpu(auth_tlv->header.len);
458455

459456
if (IS_SUPPORT_MULTI_BANDS(priv->adapter)
460457
&& !(ISSUPP_11NENABLED(priv->adapter->fw_cap_info)

‎drivers/net/wireless/mwifiex/main.h‎

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -994,11 +994,6 @@ int mwifiex_get_channel_list(struct mwifiex_private *priv,
994994
int mwifiex_get_scan_table(struct mwifiex_private *priv,
995995
u8 wait_option,
996996
struct mwifiex_scan_resp *scanresp);
997-
int mwifiex_get_auth_mode(struct mwifiex_private *priv,
998-
u8 wait_option, u32 *auth_mode);
999-
int mwifiex_get_encrypt_mode(struct mwifiex_private *priv,
1000-
u8 wait_option,
1001-
u32 *encrypt_mode);
1002997
int mwifiex_enable_wep_key(struct mwifiex_private *priv, u8 wait_option);
1003998
int mwifiex_find_best_bss(struct mwifiex_private *priv, u8 wait_option,
1004999
struct mwifiex_ssid_bssid *ssid_bssid);
@@ -1014,9 +1009,6 @@ int mwifiex_drv_get_mode(struct mwifiex_private *priv, u8 wait_option);
10141009

10151010
int mwifiex_drv_change_adhoc_chan(struct mwifiex_private *priv, int channel);
10161011

1017-
int mwifiex_set_auth(struct mwifiex_private *priv, int encrypt_mode,
1018-
int auth_mode, int wpa_enabled);
1019-
10201012
int mwifiex_set_encode(struct mwifiex_private *priv, const u8 *key,
10211013
int key_len, u8 key_index, int disable);
10221014

‎drivers/net/wireless/mwifiex/sta_ioctl.c‎

Lines changed: 0 additions & 44 deletions
Original file line numberDiff line numberDiff line change
@@ -1690,20 +1690,6 @@ static int mwifiex_sec_ioctl_set_wapi_key(struct mwifiex_adapter *adapter,
16901690
return ret;
16911691
}
16921692

1693-
/*
1694-
* IOCTL request handler to set/get authentication mode.
1695-
*/
1696-
static int mwifiex_set_auth_mode(struct mwifiex_private *priv, u32 auth_mode)
1697-
{
1698-
int ret = 0;
1699-
1700-
priv->sec_info.authentication_mode = auth_mode;
1701-
if (priv->sec_info.authentication_mode == MWIFIEX_AUTH_MODE_NETWORKEAP)
1702-
ret = mwifiex_set_wpa_ie_helper(priv, NULL, 0);
1703-
1704-
return ret;
1705-
}
1706-
17071693
/*
17081694
* IOCTL request handler to set WEP network key.
17091695
*
@@ -1998,36 +1984,6 @@ int mwifiex_get_signal_info(struct mwifiex_private *priv, u8 wait_option,
19981984
return status;
19991985
}
20001986

2001-
/*
2002-
* Sends IOCTL request to set encryption mode.
2003-
*
2004-
* This function allocates the IOCTL request buffer, fills it
2005-
* with requisite parameters and calls the IOCTL handler.
2006-
*/
2007-
static int mwifiex_set_encrypt_mode(struct mwifiex_private *priv,
2008-
u8 wait_option, u32 encrypt_mode)
2009-
{
2010-
priv->sec_info.encryption_mode = encrypt_mode;
2011-
return 0;
2012-
}
2013-
2014-
/*
2015-
* This function set the authentication parameters. It sets both encryption
2016-
* mode and authentication mode, and also enables WPA if required.
2017-
*/
2018-
int
2019-
mwifiex_set_auth(struct mwifiex_private *priv, int encrypt_mode,
2020-
int auth_mode, int wpa_enabled)
2021-
{
2022-
if (mwifiex_set_encrypt_mode(priv, MWIFIEX_IOCTL_WAIT, encrypt_mode))
2023-
return -EFAULT;
2024-
2025-
if (mwifiex_set_auth_mode(priv, auth_mode))
2026-
return -EFAULT;
2027-
2028-
return 0;
2029-
}
2030-
20311987
/*
20321988
* Sends IOCTL request to set encoding parameters.
20331989
*

0 commit comments

Comments
 (0)