Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

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>

authored by

Marc Yang and committed by
John W. Linville
203afeca 0022801c

+19 -77
+8 -9
drivers/net/wireless/mwifiex/cfg80211.c
··· 1055 1055 * scan. The cfg80211 does not give us the encryption 1056 1056 * mode at this stage so just setting it to WEP here. 1057 1057 */ 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; 1063 1062 } 1064 1063 1065 1064 goto done; ··· 1074 1075 if (sme->crypto.n_ciphers_pairwise) { 1075 1076 pairwise_encrypt_mode = mwifiex_get_mwifiex_cipher(sme->crypto. 1076 1077 ciphers_pairwise[0], &wpa_enabled); 1077 - ret = mwifiex_set_auth(priv, pairwise_encrypt_mode, auth_type, 1078 - wpa_enabled); 1078 + priv->sec_info.encryption_mode = pairwise_encrypt_mode; 1079 + priv->sec_info.authentication_mode = auth_type; 1079 1080 } 1080 1081 1081 1082 if (sme->crypto.cipher_group) { 1082 1083 group_encrypt_mode = mwifiex_get_mwifiex_cipher(sme->crypto. 1083 1084 cipher_group, &wpa_enabled); 1084 - ret = mwifiex_set_auth(priv, group_encrypt_mode, auth_type, 1085 - wpa_enabled); 1085 + priv->sec_info.encryption_mode = group_encrypt_mode; 1086 + priv->sec_info.authentication_mode = auth_type; 1086 1087 } 1087 1088 if (sme->ie) 1088 1089 ret = mwifiex_set_gen_ie(priv, sme->ie, sme->ie_len);
-2
drivers/net/wireless/mwifiex/ioctl.h
··· 277 277 enum { 278 278 MWIFIEX_AUTH_MODE_OPEN = 0x00, 279 279 MWIFIEX_AUTH_MODE_SHARED = 0x01, 280 - MWIFIEX_AUTH_MODE_NETWORKEAP = 0x80, 281 - MWIFIEX_AUTH_MODE_AUTO = 0xFF, 282 280 }; 283 281 284 282 enum {
+11 -14
drivers/net/wireless/mwifiex/join.c
··· 441 441 dev_dbg(priv->adapter->dev, "info: ASSOC_CMD: rates size = %d\n", 442 442 rates_size); 443 443 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); 458 455 459 456 if (IS_SUPPORT_MULTI_BANDS(priv->adapter) 460 457 && !(ISSUPP_11NENABLED(priv->adapter->fw_cap_info)
-8
drivers/net/wireless/mwifiex/main.h
··· 994 994 int mwifiex_get_scan_table(struct mwifiex_private *priv, 995 995 u8 wait_option, 996 996 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); 1002 997 int mwifiex_enable_wep_key(struct mwifiex_private *priv, u8 wait_option); 1003 998 int mwifiex_find_best_bss(struct mwifiex_private *priv, u8 wait_option, 1004 999 struct mwifiex_ssid_bssid *ssid_bssid); ··· 1008 1013 int mwifiex_drv_get_mode(struct mwifiex_private *priv, u8 wait_option); 1009 1014 1010 1015 int mwifiex_drv_change_adhoc_chan(struct mwifiex_private *priv, int channel); 1011 - 1012 - int mwifiex_set_auth(struct mwifiex_private *priv, int encrypt_mode, 1013 - int auth_mode, int wpa_enabled); 1014 1016 1015 1017 int mwifiex_set_encode(struct mwifiex_private *priv, const u8 *key, 1016 1018 int key_len, u8 key_index, int disable);
-44
drivers/net/wireless/mwifiex/sta_ioctl.c
··· 1691 1691 } 1692 1692 1693 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 - 1707 - /* 1708 1694 * IOCTL request handler to set WEP network key. 1709 1695 * 1710 1696 * This function prepares the correct firmware command and ··· 1982 1996 if (wait && (status != -EINPROGRESS)) 1983 1997 kfree(wait); 1984 1998 return status; 1985 - } 1986 - 1987 - /* 1988 - * Sends IOCTL request to set encryption mode. 1989 - * 1990 - * This function allocates the IOCTL request buffer, fills it 1991 - * with requisite parameters and calls the IOCTL handler. 1992 - */ 1993 - static int mwifiex_set_encrypt_mode(struct mwifiex_private *priv, 1994 - u8 wait_option, u32 encrypt_mode) 1995 - { 1996 - priv->sec_info.encryption_mode = encrypt_mode; 1997 - return 0; 1998 - } 1999 - 2000 - /* 2001 - * This function set the authentication parameters. It sets both encryption 2002 - * mode and authentication mode, and also enables WPA if required. 2003 - */ 2004 - int 2005 - mwifiex_set_auth(struct mwifiex_private *priv, int encrypt_mode, 2006 - int auth_mode, int wpa_enabled) 2007 - { 2008 - if (mwifiex_set_encrypt_mode(priv, MWIFIEX_IOCTL_WAIT, encrypt_mode)) 2009 - return -EFAULT; 2010 - 2011 - if (mwifiex_set_auth_mode(priv, auth_mode)) 2012 - return -EFAULT; 2013 - 2014 - return 0; 2015 1999 } 2016 2000 2017 2001 /*