diff --git a/drivers/staging/rtl8723bs/os_dep/ioctl_linux.c b/drivers/staging/rtl8723bs/os_dep/ioctl_linux.c index 79d8383d4b9b..c7bad646134e 100644 --- a/drivers/staging/rtl8723bs/os_dep/ioctl_linux.c +++ b/drivers/staging/rtl8723bs/os_dep/ioctl_linux.c @@ -19,7 +19,7 @@ #include #include -#define RTL_IOCTL_WPA_SUPPLICANT SIOCIWFIRSTPRIV+30 +#define RTL_IOCTL_WPA_SUPPLICANT (SIOCIWFIRSTPRIV+30) #define SCAN_ITEM_SIZE 768 #define MAX_CUSTOM_LEN 64 @@ -44,8 +44,7 @@ extern u8 key_2char2num(u8 hch, u8 lch); static u32 rtw_rates[] = {1000000, 2000000, 5500000, 11000000, 6000000, 9000000, 12000000, 18000000, 24000000, 36000000, 48000000, 54000000}; -static const char * const iw_operation_mode[] = -{ +static const char * const iw_operation_mode[] = { "Auto", "Ad-Hoc", "Managed", "Master", "Repeater", "Secondary", "Monitor" }; @@ -190,16 +189,12 @@ static char *translate_scan(struct adapter *padapter, start = iwe_stream_add_point(info, start, stop, &iwe, pnetwork->network.Ssid.Ssid); /* parsing HT_CAP_IE */ - if (pnetwork->network.Reserved[0] == 2) /* Probe Request */ - { + if (pnetwork->network.Reserved[0] == 2) { /* Probe Request */ p = rtw_get_ie(&pnetwork->network.IEs[0], _HT_CAPABILITY_IE_, &ht_ielen, pnetwork->network.IELength); - } - else - { + } else { p = rtw_get_ie(&pnetwork->network.IEs[12], _HT_CAPABILITY_IE_, &ht_ielen, pnetwork->network.IELength-12); } - if (p && ht_ielen>0) - { + if (p && ht_ielen>0) { struct rtw_ieee80211_ht_cap *pht_capie; ht_cap = true; pht_capie = (struct rtw_ieee80211_ht_cap *)(p+2); @@ -210,33 +205,25 @@ static char *translate_scan(struct adapter *padapter, /* Add the protocol name */ iwe.cmd = SIOCGIWNAME; - if ((rtw_is_cckratesonly_included((u8 *)&pnetwork->network.SupportedRates)) == true) - { + if ((rtw_is_cckratesonly_included((u8 *)&pnetwork->network.SupportedRates)) == true) { if (ht_cap == true) snprintf(iwe.u.name, IFNAMSIZ, "IEEE 802.11bn"); else snprintf(iwe.u.name, IFNAMSIZ, "IEEE 802.11b"); - } - else if ((rtw_is_cckrates_included((u8 *)&pnetwork->network.SupportedRates)) == true) - { + } else if ((rtw_is_cckrates_included((u8 *)&pnetwork->network.SupportedRates)) == true) { if (ht_cap == true) snprintf(iwe.u.name, IFNAMSIZ, "IEEE 802.11bgn"); else snprintf(iwe.u.name, IFNAMSIZ, "IEEE 802.11bg"); - } - else - { - if (pnetwork->network.Configuration.DSConfig > 14) - { + } else { + if (pnetwork->network.Configuration.DSConfig > 14) { if (vht_cap == true) snprintf(iwe.u.name, IFNAMSIZ, "IEEE 802.11AC"); else if (ht_cap == true) snprintf(iwe.u.name, IFNAMSIZ, "IEEE 802.11an"); else snprintf(iwe.u.name, IFNAMSIZ, "IEEE 802.11a"); - } - else - { + } else { if (ht_cap == true) snprintf(iwe.u.name, IFNAMSIZ, "IEEE 802.11gn"); else @@ -247,12 +234,9 @@ static char *translate_scan(struct adapter *padapter, start = iwe_stream_add_event(info, start, stop, &iwe, IW_EV_CHAR_LEN); /* Add mode */ - if (pnetwork->network.Reserved[0] == 2) /* Probe Request */ - { + if (pnetwork->network.Reserved[0] == 2) { /* Probe Request */ cap = 0; - } - else - { + } else { __le16 le_tmp; iwe.cmd = SIOCGIWMODE; @@ -295,8 +279,7 @@ static char *translate_scan(struct adapter *padapter, return start; p = custom; p += snprintf(p, MAX_CUSTOM_LEN - (p - custom), " Rates (Mb/s): "); - while (pnetwork->network.SupportedRates[i]!= 0) - { + while (pnetwork->network.SupportedRates[i]!= 0) { rate = pnetwork->network.SupportedRates[i]&0x7F; if (rate > max_rate) max_rate = rate; @@ -307,20 +290,12 @@ static char *translate_scan(struct adapter *padapter, if (vht_cap == true) { max_rate = vht_data_rate; - } - else if (ht_cap == true) - { - if (mcs_rate&0x8000)/* MCS15 */ - { + } else if (ht_cap == true) { + if (mcs_rate&0x8000) { /* MCS15 */ max_rate = (bw_40MHz) ? ((short_GI)?300:270):((short_GI)?144:130); - - } - else if (mcs_rate&0x0080)/* MCS7 */ - { + } else if (mcs_rate&0x0080) { /* MCS7 */ max_rate = (bw_40MHz) ? ((short_GI)?150:135):((short_GI)?72:65); - } - else/* default MCS7 */ - { + } else { /* default MCS7 */ /* DBG_871X("wx_get_scan, mcs_rate_bitmap = 0x%x\n", mcs_rate); */ max_rate = (bw_40MHz) ? ((short_GI)?150:135):((short_GI)?72:65); } @@ -334,8 +309,7 @@ static char *translate_scan(struct adapter *padapter, start = iwe_stream_add_event(info, start, stop, &iwe, IW_EV_PARAM_LEN); /* parsing WPA/WPA2 IE */ - if (pnetwork->network.Reserved[0] != 2) /* Probe Request */ - { + if (pnetwork->network.Reserved[0] != 2) { /* Probe Request */ u8 *buf; u8 wpa_ie[255], rsn_ie[255]; u16 wpa_len = 0, rsn_len = 0; @@ -351,15 +325,13 @@ static char *translate_scan(struct adapter *padapter, if (wpa_len > 0) { p =buf; p += sprintf(p, "wpa_ie ="); - for (i = 0; i < wpa_len; i++) { + for (i = 0; i < wpa_len; i++) p += sprintf(p, "%02x", wpa_ie[i]); - } if (wpa_len > 100) { printk("-----------------Len %d----------------\n", wpa_len); - for (i = 0; i < wpa_len; i++) { + for (i = 0; i < wpa_len; i++) printk("%02x ", wpa_ie[i]); - } printk("\n"); printk("-----------------Len %d----------------\n", wpa_len); } @@ -401,21 +373,16 @@ static char *translate_scan(struct adapter *padapter, u8 *ie_ptr = pnetwork->network.IEs + ie_offset; total_ielen = pnetwork->network.IELength - ie_offset; - if (pnetwork->network.Reserved[0] == 2) /* Probe Request */ - { + if (pnetwork->network.Reserved[0] == 2) { /* Probe Request */ ie_ptr = pnetwork->network.IEs; total_ielen = pnetwork->network.IELength; - } - else /* Beacon or Probe Respones */ - { + } else { /* Beacon or Probe Respones */ ie_ptr = pnetwork->network.IEs + _FIXED_IE_LENGTH_; total_ielen = pnetwork->network.IELength - _FIXED_IE_LENGTH_; } - while (cnt < total_ielen) - { - if (rtw_is_wps_ie(&ie_ptr[cnt], &wps_ielen) && (wps_ielen>2)) - { + while (cnt < total_ielen) { + if (rtw_is_wps_ie(&ie_ptr[cnt], &wps_ielen) && (wps_ielen>2)) { wpsie_ptr = &ie_ptr[cnt]; iwe.cmd =IWEVGENIE; iwe.u.data.length = (u16)wps_ielen; @@ -507,38 +474,27 @@ static int wpa_set_auth_algs(struct net_device *dev, u32 value) struct adapter *padapter = (struct adapter *) rtw_netdev_priv(dev); int ret = 0; - if ((value & AUTH_ALG_SHARED_KEY) && (value & AUTH_ALG_OPEN_SYSTEM)) - { + if ((value & AUTH_ALG_SHARED_KEY) && (value & AUTH_ALG_OPEN_SYSTEM)) { DBG_871X("wpa_set_auth_algs, AUTH_ALG_SHARED_KEY and AUTH_ALG_OPEN_SYSTEM [value:0x%x]\n", value); padapter->securitypriv.ndisencryptstatus = Ndis802_11Encryption1Enabled; padapter->securitypriv.ndisauthtype = Ndis802_11AuthModeAutoSwitch; padapter->securitypriv.dot11AuthAlgrthm = dot11AuthAlgrthm_Auto; - } - else if (value & AUTH_ALG_SHARED_KEY) - { + } else if (value & AUTH_ALG_SHARED_KEY) { DBG_871X("wpa_set_auth_algs, AUTH_ALG_SHARED_KEY [value:0x%x]\n", value); padapter->securitypriv.ndisencryptstatus = Ndis802_11Encryption1Enabled; padapter->securitypriv.ndisauthtype = Ndis802_11AuthModeShared; padapter->securitypriv.dot11AuthAlgrthm = dot11AuthAlgrthm_Shared; - } - else if (value & AUTH_ALG_OPEN_SYSTEM) - { + } else if (value & AUTH_ALG_OPEN_SYSTEM) { DBG_871X("wpa_set_auth_algs, AUTH_ALG_OPEN_SYSTEM\n"); /* padapter->securitypriv.ndisencryptstatus = Ndis802_11EncryptionDisabled; */ - if (padapter->securitypriv.ndisauthtype < Ndis802_11AuthModeWPAPSK) - { + if (padapter->securitypriv.ndisauthtype < Ndis802_11AuthModeWPAPSK) { padapter->securitypriv.ndisauthtype = Ndis802_11AuthModeOpen; padapter->securitypriv.dot11AuthAlgrthm = dot11AuthAlgrthm_Open; } - - } - else if (value & AUTH_ALG_LEAP) - { + } else if (value & AUTH_ALG_LEAP) { DBG_871X("wpa_set_auth_algs, AUTH_ALG_LEAP\n"); - } - else - { + } else { DBG_871X("wpa_set_auth_algs, error!\n"); ret = -EINVAL; } @@ -559,33 +515,27 @@ static int wpa_set_encryption(struct net_device *dev, struct ieee_param *param, param->u.crypt.err = 0; param->u.crypt.alg[IEEE_CRYPT_ALG_NAME_LEN - 1] = '\0'; - if (param_len < (u32) ((u8 *) param->u.crypt.key - (u8 *) param) + param->u.crypt.key_len) - { + if (param_len < (u32) ((u8 *) param->u.crypt.key - (u8 *) param) + param->u.crypt.key_len) { ret = -EINVAL; goto exit; } if (param->sta_addr[0] == 0xff && param->sta_addr[1] == 0xff && param->sta_addr[2] == 0xff && param->sta_addr[3] == 0xff && - param->sta_addr[4] == 0xff && param->sta_addr[5] == 0xff) - { - + param->sta_addr[4] == 0xff && param->sta_addr[5] == 0xff) { if (param->u.crypt.idx >= WEP_KEYS || param->u.crypt.idx >= BIP_MAX_KEYID) { ret = -EINVAL; goto exit; } - } - else - { + } else { { ret = -EINVAL; goto exit; } } - if (strcmp(param->u.crypt.alg, "WEP") == 0) - { + if (strcmp(param->u.crypt.alg, "WEP") == 0) { RT_TRACE(_module_rtl871x_ioctl_os_c, _drv_err_, ("wpa_set_encryption, crypt.alg = WEP\n")); DBG_871X("wpa_set_encryption, crypt.alg = WEP\n"); @@ -604,8 +554,7 @@ static int wpa_set_encryption(struct net_device *dev, struct ieee_param *param, RT_TRACE(_module_rtl871x_ioctl_os_c, _drv_info_, ("(2)wep_key_idx =%d\n", wep_key_idx)); - if (wep_key_len > 0) - { + if (wep_key_len > 0) { wep_key_len = wep_key_len <= 5 ? 5 : 13; wep_total_len = wep_key_len + FIELD_OFFSET(struct ndis_802_11_wep, KeyMaterial); pwep =(struct ndis_802_11_wep *) rtw_malloc(wep_total_len); @@ -619,13 +568,11 @@ static int wpa_set_encryption(struct net_device *dev, struct ieee_param *param, pwep->KeyLength = wep_key_len; pwep->Length = wep_total_len; - if (wep_key_len == 13) - { + if (wep_key_len == 13) { padapter->securitypriv.dot11PrivacyAlgrthm = _WEP104_; padapter->securitypriv.dot118021XGrpPrivacy = _WEP104_; } - } - else { + } else { ret = -EINVAL; goto exit; } @@ -635,17 +582,12 @@ static int wpa_set_encryption(struct net_device *dev, struct ieee_param *param, memcpy(pwep->KeyMaterial, param->u.crypt.key, pwep->KeyLength); - if (param->u.crypt.set_tx) - { + if (param->u.crypt.set_tx) { DBG_871X("wep, set_tx = 1\n"); if (rtw_set_802_11_add_wep(padapter, pwep) == (u8)_FAIL) - { ret = -EOPNOTSUPP ; - } - } - else - { + } else { DBG_871X("wep, set_tx = 0\n"); /* don't update "psecuritypriv->dot11PrivacyAlgrthm" and */ @@ -664,35 +606,28 @@ static int wpa_set_encryption(struct net_device *dev, struct ieee_param *param, goto exit; } - if (padapter->securitypriv.dot11AuthAlgrthm == dot11AuthAlgrthm_8021X) /* 802_1x */ - { + if (padapter->securitypriv.dot11AuthAlgrthm == dot11AuthAlgrthm_8021X) { /* 802_1x */ struct sta_info * psta,*pbcmc_sta; struct sta_priv * pstapriv = &padapter->stapriv; - if (check_fwstate(pmlmepriv, WIFI_STATION_STATE | WIFI_MP_STATE) == true) /* sta mode */ - { + if (check_fwstate(pmlmepriv, WIFI_STATION_STATE | WIFI_MP_STATE) == true) { /* sta mode */ psta = rtw_get_stainfo(pstapriv, get_bssid(pmlmepriv)); if (psta == NULL) { /* DEBUG_ERR(("Set wpa_set_encryption: Obtain Sta_info fail\n")); */ - } - else - { + } else { /* Jeff: don't disable ieee8021x_blocked while clearing key */ if (strcmp(param->u.crypt.alg, "none") != 0) psta->ieee8021x_blocked = false; if ((padapter->securitypriv.ndisencryptstatus == Ndis802_11Encryption2Enabled)|| - (padapter->securitypriv.ndisencryptstatus == Ndis802_11Encryption3Enabled)) - { + (padapter->securitypriv.ndisencryptstatus == Ndis802_11Encryption3Enabled)) { psta->dot118021XPrivacy = padapter->securitypriv.dot11PrivacyAlgrthm; } - if (param->u.crypt.set_tx == 1)/* pairwise key */ - { + if (param->u.crypt.set_tx == 1) { /* pairwise key */ memcpy(psta->dot118021x_UncstKey.skey, param->u.crypt.key, (param->u.crypt.key_len>16 ?16:param->u.crypt.key_len)); - if (strcmp(param->u.crypt.alg, "TKIP") == 0)/* set mic key */ - { + if (strcmp(param->u.crypt.alg, "TKIP") == 0) { /* set mic key */ /* DEBUG_ERR(("\nset key length :param->u.crypt.key_len =%d\n", param->u.crypt.key_len)); */ memcpy(psta->dot11tkiptxmickey.skey, &(param->u.crypt.key[16]), 8); memcpy(psta->dot11tkiprxmickey.skey, &(param->u.crypt.key[24]), 8); @@ -705,15 +640,11 @@ static int wpa_set_encryption(struct net_device *dev, struct ieee_param *param, DBG_871X(" ~~~~set sta key:unicastkey\n"); rtw_setstakey_cmd(padapter, psta, true, true); - } - else/* group key */ - { - if (strcmp(param->u.crypt.alg, "TKIP") == 0 || strcmp(param->u.crypt.alg, "CCMP") == 0) - { + } else { /* group key */ + if (strcmp(param->u.crypt.alg, "TKIP") == 0 || strcmp(param->u.crypt.alg, "CCMP") == 0) { memcpy(padapter->securitypriv.dot118021XGrpKey[param->u.crypt.idx].skey, param->u.crypt.key, (param->u.crypt.key_len>16 ?16:param->u.crypt.key_len)); /* only TKIP group key need to install this */ - if (param->u.crypt.key_len > 16) - { + if (param->u.crypt.key_len > 16) { memcpy(padapter->securitypriv.dot118021XGrptxmickey[param->u.crypt.idx].skey,&(param->u.crypt.key[16]), 8); memcpy(padapter->securitypriv.dot118021XGrprxmickey[param->u.crypt.idx].skey,&(param->u.crypt.key[24]), 8); } @@ -724,9 +655,7 @@ static int wpa_set_encryption(struct net_device *dev, struct ieee_param *param, padapter->securitypriv.dot118021XGrpKeyid = param->u.crypt.idx; rtw_set_key(padapter,&padapter->securitypriv, param->u.crypt.idx, 1, true); - } - else if (strcmp(param->u.crypt.alg, "BIP") == 0) - { + } else if (strcmp(param->u.crypt.alg, "BIP") == 0) { /* printk("BIP key_len =%d , index =%d @@@@@@@@@@@@@@@@@@\n", param->u.crypt.key_len, param->u.crypt.idx); */ /* save the IGTK key, length 16 bytes */ memcpy(padapter->securitypriv.dot11wBIPKey[param->u.crypt.idx].skey, param->u.crypt.key, (param->u.crypt.key_len>16 ?16:param->u.crypt.key_len)); @@ -742,25 +671,20 @@ static int wpa_set_encryption(struct net_device *dev, struct ieee_param *param, } pbcmc_sta =rtw_get_bcmc_stainfo(padapter); - if (pbcmc_sta == NULL) - { + if (pbcmc_sta == NULL) { /* DEBUG_ERR(("Set OID_802_11_ADD_KEY: bcmc stainfo is null\n")); */ - } - else - { + } else { /* Jeff: don't disable ieee8021x_blocked while clearing key */ if (strcmp(param->u.crypt.alg, "none") != 0) pbcmc_sta->ieee8021x_blocked = false; if ((padapter->securitypriv.ndisencryptstatus == Ndis802_11Encryption2Enabled)|| - (padapter->securitypriv.ndisencryptstatus == Ndis802_11Encryption3Enabled)) - { + (padapter->securitypriv.ndisencryptstatus == Ndis802_11Encryption3Enabled)) { pbcmc_sta->dot118021XPrivacy = padapter->securitypriv.dot11PrivacyAlgrthm; } } - } - else if (check_fwstate(pmlmepriv, WIFI_ADHOC_STATE)) /* adhoc mode */ - { + } else if (check_fwstate(pmlmepriv, WIFI_ADHOC_STATE)) { + /* adhoc mode */ } } @@ -785,8 +709,7 @@ static int rtw_set_wpa_ie(struct adapter *padapter, char *pie, unsigned short ie return -EINVAL; } - if (ielen) - { + if (ielen) { buf = rtw_zmalloc(ielen); if (buf == NULL) { ret = -ENOMEM; @@ -810,31 +733,24 @@ static int rtw_set_wpa_ie(struct adapter *padapter, char *pie, unsigned short ie goto exit; } - if (rtw_parse_wpa_ie(buf, ielen, &group_cipher, &pairwise_cipher, NULL) == _SUCCESS) - { + if (rtw_parse_wpa_ie(buf, ielen, &group_cipher, &pairwise_cipher, NULL) == _SUCCESS) { padapter->securitypriv.dot11AuthAlgrthm = dot11AuthAlgrthm_8021X; padapter->securitypriv.ndisauthtype =Ndis802_11AuthModeWPAPSK; memcpy(padapter->securitypriv.supplicant_ie, &buf[0], ielen); } - if (rtw_parse_wpa2_ie(buf, ielen, &group_cipher, &pairwise_cipher, NULL) == _SUCCESS) - { + if (rtw_parse_wpa2_ie(buf, ielen, &group_cipher, &pairwise_cipher, NULL) == _SUCCESS) { padapter->securitypriv.dot11AuthAlgrthm = dot11AuthAlgrthm_8021X; padapter->securitypriv.ndisauthtype =Ndis802_11AuthModeWPA2PSK; memcpy(padapter->securitypriv.supplicant_ie, &buf[0], ielen); } if (group_cipher == 0) - { group_cipher = WPA_CIPHER_NONE; - } if (pairwise_cipher == 0) - { pairwise_cipher = WPA_CIPHER_NONE; - } - switch (group_cipher) - { + switch (group_cipher) { case WPA_CIPHER_NONE: padapter->securitypriv.dot118021XGrpPrivacy = _NO_PRIVACY_; padapter->securitypriv.ndisencryptstatus =Ndis802_11EncryptionDisabled; @@ -857,8 +773,7 @@ static int rtw_set_wpa_ie(struct adapter *padapter, char *pie, unsigned short ie break; } - switch (pairwise_cipher) - { + switch (pairwise_cipher) { case WPA_CIPHER_NONE: padapter->securitypriv.dot11PrivacyAlgrthm = _NO_PRIVACY_; padapter->securitypriv.ndisencryptstatus =Ndis802_11EncryptionDisabled; @@ -886,12 +801,10 @@ static int rtw_set_wpa_ie(struct adapter *padapter, char *pie, unsigned short ie u16 cnt = 0; u8 eid, wps_oui[4]={0x0, 0x50, 0xf2, 0x04}; - while (cnt < ielen) - { + while (cnt < ielen) { eid = buf[cnt]; - if ((eid == _VENDOR_SPECIFIC_IE_) && (!memcmp(&buf[cnt+2], wps_oui, 4))) - { + if ((eid == _VENDOR_SPECIFIC_IE_) && (!memcmp(&buf[cnt+2], wps_oui, 4))) { DBG_871X("SET WPS_IE\n"); padapter->securitypriv.wps_ie_len = ((buf[cnt+1]+2) < MAX_WPS_IE_LEN) ? (buf[cnt+1]+2):MAX_WPS_IE_LEN; @@ -947,48 +860,36 @@ static int rtw_wx_get_name(struct net_device *dev, /* parsing HT_CAP_IE */ p = rtw_get_ie(&pcur_bss->IEs[12], _HT_CAPABILITY_IE_, &ht_ielen, pcur_bss->IELength-12); if (p && ht_ielen>0) - { ht_cap = true; - } prates = &pcur_bss->SupportedRates; - if (rtw_is_cckratesonly_included((u8 *)prates) == true) - { + if (rtw_is_cckratesonly_included((u8 *)prates) == true) { if (ht_cap == true) snprintf(wrqu->name, IFNAMSIZ, "IEEE 802.11bn"); else snprintf(wrqu->name, IFNAMSIZ, "IEEE 802.11b"); - } - else if ((rtw_is_cckrates_included((u8 *)prates)) == true) - { + } else if ((rtw_is_cckrates_included((u8 *)prates)) == true) { if (ht_cap == true) snprintf(wrqu->name, IFNAMSIZ, "IEEE 802.11bgn"); else snprintf(wrqu->name, IFNAMSIZ, "IEEE 802.11bg"); - } - else - { - if (pcur_bss->Configuration.DSConfig > 14) - { + } else { + if (pcur_bss->Configuration.DSConfig > 14) { if (vht_cap == true) snprintf(wrqu->name, IFNAMSIZ, "IEEE 802.11AC"); else if (ht_cap == true) snprintf(wrqu->name, IFNAMSIZ, "IEEE 802.11an"); else snprintf(wrqu->name, IFNAMSIZ, "IEEE 802.11a"); - } - else - { + } else { if (ht_cap == true) snprintf(wrqu->name, IFNAMSIZ, "IEEE 802.11gn"); else snprintf(wrqu->name, IFNAMSIZ, "IEEE 802.11g"); } } - } - else - { + } else { /* prates = &padapter->registrypriv.dev_network.SupportedRates; */ /* snprintf(wrqu->name, IFNAMSIZ, "IEEE 802.11g"); */ snprintf(wrqu->name, IFNAMSIZ, "unassociated"); @@ -1013,15 +914,13 @@ static int rtw_wx_get_freq(struct net_device *dev, struct mlme_priv *pmlmepriv = &(padapter->mlmepriv); struct wlan_bssid_ex *pcur_bss = &pmlmepriv->cur_network.network; - if (check_fwstate(pmlmepriv, _FW_LINKED) == true) - { + if (check_fwstate(pmlmepriv, _FW_LINKED) == true) { /* wrqu->freq.m = ieee80211_wlan_frequencies[pcur_bss->Configuration.DSConfig-1] * 100000; */ wrqu->freq.m = rtw_ch2freq(pcur_bss->Configuration.DSConfig) * 100000; wrqu->freq.e = 1; wrqu->freq.i = pcur_bss->Configuration.DSConfig; - } - else { + } else { wrqu->freq.m = rtw_ch2freq(padapter->mlmeextpriv.cur_channel) * 100000; wrqu->freq.e = 1; wrqu->freq.i = padapter->mlmeextpriv.cur_channel; @@ -1047,8 +946,7 @@ static int rtw_wx_set_mode(struct net_device *dev, struct iw_request_info *a, goto exit; } - switch (wrqu->mode) - { + switch (wrqu->mode) { case IW_MODE_AUTO: networkType = Ndis802_11AutoUnknown; DBG_871X("set_mode = IW_MODE_AUTO\n"); @@ -1105,22 +1003,14 @@ static int rtw_wx_get_mode(struct net_device *dev, struct iw_request_info *a, RT_TRACE(_module_rtl871x_mlme_c_, _drv_info_, (" rtw_wx_get_mode\n")); - if (check_fwstate(pmlmepriv, WIFI_STATION_STATE) == true) - { + if (check_fwstate(pmlmepriv, WIFI_STATION_STATE) == true) { wrqu->mode = IW_MODE_INFRA; - } - else if ((check_fwstate(pmlmepriv, WIFI_ADHOC_MASTER_STATE) == true) || - (check_fwstate(pmlmepriv, WIFI_ADHOC_STATE) == true)) - - { + } else if ((check_fwstate(pmlmepriv, WIFI_ADHOC_MASTER_STATE) == true) || + (check_fwstate(pmlmepriv, WIFI_ADHOC_STATE) == true)) { wrqu->mode = IW_MODE_ADHOC; - } - else if (check_fwstate(pmlmepriv, WIFI_AP_STATE) == true) - { + } else if (check_fwstate(pmlmepriv, WIFI_AP_STATE) == true) { wrqu->mode = IW_MODE_MASTER; - } - else - { + } else { wrqu->mode = IW_MODE_AUTO; } return 0; @@ -1147,25 +1037,19 @@ static int rtw_wx_set_pmkid(struct net_device *dev, */ memcpy(strIssueBssid, pPMK->bssid.sa_data, ETH_ALEN); - if (pPMK->cmd == IW_PMKSA_ADD) - { + if (pPMK->cmd == IW_PMKSA_ADD) { DBG_871X("[rtw_wx_set_pmkid] IW_PMKSA_ADD!\n"); if (!memcmp(strIssueBssid, strZeroMacAddress, ETH_ALEN)) - { return(intReturn); - } else - { intReturn = true; - } + blInserted = false; /* overwrite PMKID */ - for (j = 0 ; jPMKIDList[j].Bssid, strIssueBssid, ETH_ALEN)) - { /* BSSID is matched, the same AP => rewrite with new PMKID. */ - + for (j = 0 ; jPMKIDList[j].Bssid, strIssueBssid, ETH_ALEN)) { + /* BSSID is matched, the same AP => rewrite with new PMKID. */ DBG_871X("[rtw_wx_set_pmkid] BSSID exists in the PMKList.\n"); memcpy(psecuritypriv->PMKIDList[j].PMKID, pPMK->pmkid, IW_PMKID_LEN); @@ -1176,8 +1060,7 @@ static int rtw_wx_set_pmkid(struct net_device *dev, } } - if (!blInserted) - { + if (!blInserted) { /* Find a new entry */ DBG_871X("[rtw_wx_set_pmkid] Use the new entry index = %d for this PMKID.\n", psecuritypriv->PMKIDIndex); @@ -1188,27 +1071,20 @@ static int rtw_wx_set_pmkid(struct net_device *dev, psecuritypriv->PMKIDList[ psecuritypriv->PMKIDIndex ].bUsed = true; psecuritypriv->PMKIDIndex++ ; if (psecuritypriv->PMKIDIndex == 16) - { psecuritypriv->PMKIDIndex = 0; - } } - } - else if (pPMK->cmd == IW_PMKSA_REMOVE) - { + } else if (pPMK->cmd == IW_PMKSA_REMOVE) { DBG_871X("[rtw_wx_set_pmkid] IW_PMKSA_REMOVE!\n"); intReturn = true; - for (j = 0 ; jPMKIDList[j].Bssid, strIssueBssid, ETH_ALEN)) - { /* BSSID is matched, the same AP => Remove this PMKID information and reset it. */ + for (j = 0 ; jPMKIDList[j].Bssid, strIssueBssid, ETH_ALEN)) { + /* BSSID is matched, the same AP => Remove this PMKID information and reset it. */ memset(psecuritypriv->PMKIDList[ j ].Bssid, 0x00, ETH_ALEN); psecuritypriv->PMKIDList[ j ].bUsed = false; break; } } - } - else if (pPMK->cmd == IW_PMKSA_FLUSH) - { + } else if (pPMK->cmd == IW_PMKSA_FLUSH) { DBG_871X("[rtw_wx_set_pmkid] IW_PMKSA_FLUSH!\n"); memset(&psecuritypriv->PMKIDList[ 0 ], 0x00, sizeof(RT_PMKID_LIST) * NUM_PMKID_CACHE); psecuritypriv->PMKIDIndex = 0; @@ -1273,9 +1149,8 @@ static int rtw_wx_get_range(struct net_device *dev, range->num_bitrates = RATE_COUNT; - for (i = 0; i < RATE_COUNT && i < IW_MAX_BITRATES; i++) { + for (i = 0; i < RATE_COUNT && i < IW_MAX_BITRATES; i++) range->bitrate[i] = rtw_rates[i]; - } range->min_frag = MIN_FRAG_THRESHOLD; range->max_frag = MAX_FRAG_THRESHOLD; @@ -1288,8 +1163,7 @@ static int rtw_wx_get_range(struct net_device *dev, for (i = 0, val = 0; i < MAX_CHANNEL_NUM; i++) { /* Include only legal frequencies for some countries */ - if (pmlmeext->channel_set[i].ChannelNum != 0) - { + if (pmlmeext->channel_set[i].ChannelNum != 0) { range->freq[val].i = pmlmeext->channel_set[i].ChannelNum; range->freq[val].m = rtw_ch2freq(pmlmeext->channel_set[i].ChannelNum) * 100000; range->freq[val].e = 1; @@ -1349,8 +1223,7 @@ static int rtw_wx_set_wap(struct net_device *dev, enum NDIS_802_11_AUTHENTICATION_MODE authmode; rtw_ps_deny(padapter, PS_DENY_JOIN); - if (_FAIL == rtw_pwr_wakeup(padapter)) - { + if (_FAIL == rtw_pwr_wakeup(padapter)) { ret = -1; goto exit; } @@ -1383,15 +1256,12 @@ static int rtw_wx_set_wap(struct net_device *dev, src_bssid = temp->sa_data; - if ((!memcmp(dst_bssid, src_bssid, ETH_ALEN))) - { - if (!rtw_set_802_11_infrastructure_mode(padapter, pnetwork->network.InfrastructureMode)) - { + if ((!memcmp(dst_bssid, src_bssid, ETH_ALEN))) { + if (!rtw_set_802_11_infrastructure_mode(padapter, pnetwork->network.InfrastructureMode)) { ret = -1; spin_unlock_bh(&queue->lock); goto exit; } - break; } @@ -1429,13 +1299,9 @@ static int rtw_wx_get_wap(struct net_device *dev, if (((check_fwstate(pmlmepriv, _FW_LINKED)) == true) || ((check_fwstate(pmlmepriv, WIFI_ADHOC_MASTER_STATE)) == true) || - ((check_fwstate(pmlmepriv, WIFI_AP_STATE)) == true)) - { - + ((check_fwstate(pmlmepriv, WIFI_AP_STATE)) == true)) { memcpy(wrqu->ap_addr.sa_data, pcur_bss->MacAddress, ETH_ALEN); - } - else - { + } else { memset(wrqu->ap_addr.sa_data, 0, ETH_ALEN); } @@ -1461,8 +1327,7 @@ static int rtw_wx_set_mlme(struct net_device *dev, DBG_871X("%s, cmd =%d, reason =%d\n", __func__, mlme->cmd, reason); - switch (mlme->cmd) - { + switch (mlme->cmd) { case IW_MLME_DEAUTH: if (!rtw_set_802_11_disassociate(padapter)) ret = -1; @@ -1493,8 +1358,7 @@ static int rtw_wx_set_scan(struct net_device *dev, struct iw_request_info *a, #endif rtw_ps_deny(padapter, PS_DENY_SCAN); - if (_FAIL == rtw_pwr_wakeup(padapter)) - { + if (_FAIL == rtw_pwr_wakeup(padapter)) { ret = -1; goto exit; } @@ -1518,26 +1382,22 @@ static int rtw_wx_set_scan(struct net_device *dev, struct iw_request_info *a, /* When Busy Traffic, driver do not site survey. So driver return success. */ /* wpa_supplicant will not issue SIOCSIWSCAN cmd again after scan timeout. */ /* modify by thomas 2011-02-22. */ - if (pmlmepriv->LinkDetectInfo.bBusyTraffic == true) - { + if (pmlmepriv->LinkDetectInfo.bBusyTraffic == true) { indicate_wx_scan_complete_event(padapter); goto exit; } - if (check_fwstate(pmlmepriv, _FW_UNDER_SURVEY|_FW_UNDER_LINKING) == true) - { + if (check_fwstate(pmlmepriv, _FW_UNDER_SURVEY|_FW_UNDER_LINKING) == true) { indicate_wx_scan_complete_event(padapter); goto exit; } memset(ssid, 0, sizeof(struct ndis_802_11_ssid)*RTW_SSID_SCAN_AMOUNT); - if (wrqu->data.length == sizeof(struct iw_scan_req)) - { + if (wrqu->data.length == sizeof(struct iw_scan_req)) { struct iw_scan_req *req = (struct iw_scan_req *)extra; - if (wrqu->data.flags & IW_SCAN_THIS_ESSID) - { + if (wrqu->data.flags & IW_SCAN_THIS_ESSID) { int len = min((int)req->essid_len, IW_ESSID_MAX_SIZE); memcpy(ssid[0].Ssid, req->essid, len); @@ -1551,17 +1411,12 @@ static int rtw_wx_set_scan(struct net_device *dev, struct iw_request_info *a, spin_unlock_bh(&pmlmepriv->lock); - } - else if (req->scan_type == IW_SCAN_TYPE_PASSIVE) - { + } else if (req->scan_type == IW_SCAN_TYPE_PASSIVE) { DBG_871X("rtw_wx_set_scan, req->scan_type == IW_SCAN_TYPE_PASSIVE\n"); } - } - else if (wrqu->data.length >= WEXT_CSCAN_HEADER_SIZE - && !memcmp(extra, WEXT_CSCAN_HEADER, WEXT_CSCAN_HEADER_SIZE) - ) - { + } else if (wrqu->data.length >= WEXT_CSCAN_HEADER_SIZE + && !memcmp(extra, WEXT_CSCAN_HEADER, WEXT_CSCAN_HEADER_SIZE)) { int len = wrqu->data.length -WEXT_CSCAN_HEADER_SIZE; char *pos = extra+WEXT_CSCAN_HEADER_SIZE; char section; @@ -1626,9 +1481,7 @@ static int rtw_wx_set_scan(struct net_device *dev, struct iw_request_info *a, /* jeff: it has still some scan paramater to parse, we only do this now... */ _status = rtw_set_802_11_bssid_list_scan(padapter, ssid, RTW_SSID_SCAN_AMOUNT); - } else - - { + } else { _status = rtw_set_802_11_bssid_list_scan(padapter, NULL, 0); } @@ -1666,8 +1519,7 @@ static int rtw_wx_get_scan(struct net_device *dev, struct iw_request_info *a, DBG_871X("DBG_IOCTL %s:%d\n", __func__, __LINE__); #endif - if (adapter_to_pwrctl(padapter)->brfoffbyhw && padapter->bDriverStopped) - { + if (adapter_to_pwrctl(padapter)->brfoffbyhw && padapter->bDriverStopped) { ret = -EINVAL; goto exit; } @@ -1682,8 +1534,7 @@ static int rtw_wx_get_scan(struct net_device *dev, struct iw_request_info *a, phead = get_list_head(queue); plist = get_next(phead); - while (1) - { + while (1) { if (phead == plist) break; @@ -1697,9 +1548,8 @@ static int rtw_wx_get_scan(struct net_device *dev, struct iw_request_info *a, /* report network only if the current channel set contains the channel to which this network belongs */ if (rtw_ch_set_search_ch(padapter->mlmeextpriv.channel_set, pnetwork->network.Configuration.DSConfig) >= 0 && rtw_mlme_band_check(padapter, pnetwork->network.Configuration.DSConfig) == true - && true == rtw_validate_ssid(&(pnetwork->network.Ssid)) - ) - { + && true == rtw_validate_ssid(&(pnetwork->network.Ssid))) { + ev =translate_scan(padapter, a, pnetwork, ev, stop); } @@ -1750,8 +1600,7 @@ static int rtw_wx_set_essid(struct net_device *dev, ("+rtw_wx_set_essid: fw_state = 0x%08x\n", get_fwstate(pmlmepriv))); rtw_ps_deny(padapter, PS_DENY_JOIN); - if (_FAIL == rtw_pwr_wakeup(padapter)) - { + if (_FAIL == rtw_pwr_wakeup(padapter)) { ret = -1; goto exit; } @@ -1773,8 +1622,7 @@ static int rtw_wx_set_essid(struct net_device *dev, authmode = padapter->securitypriv.ndisauthtype; DBG_871X("=>%s\n", __func__); - if (wrqu->essid.flags && wrqu->essid.length) - { + if (wrqu->essid.flags && wrqu->essid.length) { len = (wrqu->essid.length < IW_ESSID_MAX_SIZE) ? wrqu->essid.length : IW_ESSID_MAX_SIZE; if (wrqu->essid.length != 33) @@ -1791,8 +1639,7 @@ static int rtw_wx_set_essid(struct net_device *dev, pmlmepriv->pscanned = get_next(phead); while (1) { - if (phead == pmlmepriv->pscanned) - { + if (phead == pmlmepriv->pscanned) { RT_TRACE(_module_rtl871x_ioctl_os_c, _drv_warning_, ("rtw_wx_set_essid: scan_q is empty, set ssid to check if scanning again!\n")); @@ -1810,19 +1657,16 @@ static int rtw_wx_set_essid(struct net_device *dev, pnetwork->network.Ssid.Ssid)); if ((!memcmp(dst_ssid, src_ssid, ndis_ssid.SsidLength)) && - (pnetwork->network.Ssid.SsidLength ==ndis_ssid.SsidLength)) - { + (pnetwork->network.Ssid.SsidLength ==ndis_ssid.SsidLength)) { RT_TRACE(_module_rtl871x_ioctl_os_c, _drv_info_, ("rtw_wx_set_essid: find match, set infra mode\n")); - if (check_fwstate(pmlmepriv, WIFI_ADHOC_STATE) == true) - { + if (check_fwstate(pmlmepriv, WIFI_ADHOC_STATE) == true) { if (pnetwork->network.InfrastructureMode != pmlmepriv->cur_network.network.InfrastructureMode) continue; } - if (rtw_set_802_11_infrastructure_mode(padapter, pnetwork->network.InfrastructureMode) == false) - { + if (rtw_set_802_11_infrastructure_mode(padapter, pnetwork->network.InfrastructureMode) == false) { ret = -1; spin_unlock_bh(&queue->lock); goto exit; @@ -1867,8 +1711,7 @@ static int rtw_wx_get_essid(struct net_device *dev, RT_TRACE(_module_rtl871x_mlme_c_, _drv_info_, ("rtw_wx_get_essid\n")); if ((check_fwstate(pmlmepriv, _FW_LINKED) == true) || - (check_fwstate(pmlmepriv, WIFI_ADHOC_MASTER_STATE) == true)) - { + (check_fwstate(pmlmepriv, WIFI_ADHOC_MASTER_STATE) == true)) { len = pcur_bss->Ssid.SsidLength; wrqu->essid.length = len; @@ -1876,9 +1719,7 @@ static int rtw_wx_get_essid(struct net_device *dev, memcpy(extra, pcur_bss->Ssid.Ssid, len); wrqu->essid.flags = 1; - } - else - { + } else { ret = -1; goto exit; } @@ -1952,15 +1793,12 @@ static int rtw_wx_set_rate(struct net_device *dev, set_rate: - for (i = 0; iflags & IW_ENCODE_INDEX; - if (erq->flags & IW_ENCODE_DISABLED) - { + if (erq->flags & IW_ENCODE_DISABLED) { DBG_871X("EncryptionDisabled\n"); padapter->securitypriv.ndisencryptstatus = Ndis802_11EncryptionDisabled; padapter->securitypriv.dot11PrivacyAlgrthm = _NO_PRIVACY_; @@ -2115,17 +1952,14 @@ static int rtw_wx_set_enc(struct net_device *dev, return -EINVAL; key--; keyindex_provided = 1; - } - else - { + } else { keyindex_provided = 0; key = padapter->securitypriv.dot11PrivacyKeyIndex; DBG_871X("rtw_wx_set_enc, key =%d\n", key); } /* set authentication mode */ - if (erq->flags & IW_ENCODE_OPEN) - { + if (erq->flags & IW_ENCODE_OPEN) { DBG_871X("rtw_wx_set_enc():IW_ENCODE_OPEN\n"); padapter->securitypriv.ndisencryptstatus = Ndis802_11Encryption1Enabled;/* Ndis802_11EncryptionDisabled; */ @@ -2135,9 +1969,7 @@ static int rtw_wx_set_enc(struct net_device *dev, padapter->securitypriv.dot118021XGrpPrivacy = _NO_PRIVACY_; authmode = Ndis802_11AuthModeOpen; padapter->securitypriv.ndisauthtype =authmode; - } - else if (erq->flags & IW_ENCODE_RESTRICTED) - { + } else if (erq->flags & IW_ENCODE_RESTRICTED) { DBG_871X("rtw_wx_set_enc():IW_ENCODE_RESTRICTED\n"); padapter->securitypriv.ndisencryptstatus = Ndis802_11Encryption1Enabled; @@ -2147,9 +1979,7 @@ static int rtw_wx_set_enc(struct net_device *dev, padapter->securitypriv.dot118021XGrpPrivacy = _WEP40_; authmode = Ndis802_11AuthModeShared; padapter->securitypriv.ndisauthtype =authmode; - } - else - { + } else { DBG_871X("rtw_wx_set_enc():erq->flags = 0x%x\n", erq->flags); padapter->securitypriv.ndisencryptstatus = Ndis802_11Encryption1Enabled;/* Ndis802_11EncryptionDisabled; */ @@ -2161,24 +1991,19 @@ static int rtw_wx_set_enc(struct net_device *dev, } wep.KeyIndex = key; - if (erq->length > 0) - { + if (erq->length > 0) { wep.KeyLength = erq->length <= 5 ? 5 : 13; wep.Length = wep.KeyLength + FIELD_OFFSET(struct ndis_802_11_wep, KeyMaterial); - } - else - { + } else { wep.KeyLength = 0 ; - if (keyindex_provided == 1)/* set key_id only, no given KeyMaterial(erq->length == 0). */ - { + if (keyindex_provided == 1) { /* set key_id only, no given KeyMaterial(erq->length == 0). */ padapter->securitypriv.dot11PrivacyKeyIndex = key; DBG_871X("(keyindex_provided == 1), keyid =%d, key_len =%d\n", key, padapter->securitypriv.dot11DefKeylen[key]); - switch (padapter->securitypriv.dot11DefKeylen[key]) - { + switch (padapter->securitypriv.dot11DefKeylen[key]) { case 5: padapter->securitypriv.dot11PrivacyAlgrthm = _WEP40_; break; @@ -2219,14 +2044,12 @@ static int rtw_wx_get_enc(struct net_device *dev, struct iw_point *erq = &(wrqu->encoding); struct mlme_priv *pmlmepriv = &(padapter->mlmepriv); - if (check_fwstate(pmlmepriv, _FW_LINKED) != true) - { - if (check_fwstate(pmlmepriv, WIFI_ADHOC_MASTER_STATE) != true) - { - erq->length = 0; - erq->flags |= IW_ENCODE_DISABLED; - return 0; - } + if (check_fwstate(pmlmepriv, _FW_LINKED) != true) { + if (check_fwstate(pmlmepriv, WIFI_ADHOC_MASTER_STATE) != true) { + erq->length = 0; + erq->flags |= IW_ENCODE_DISABLED; + return 0; + } } @@ -2236,8 +2059,7 @@ static int rtw_wx_get_enc(struct net_device *dev, if (key > WEP_KEYS) return -EINVAL; key--; - } else - { + } else { key = padapter->securitypriv.dot11PrivacyKeyIndex; } @@ -2248,8 +2070,7 @@ static int rtw_wx_get_enc(struct net_device *dev, /* erq->flags |= IW_ENCODE_OPEN; */ /* */ - switch (padapter->securitypriv.ndisencryptstatus) - { + switch (padapter->securitypriv.ndisencryptstatus) { case Ndis802_11EncryptionNotSupported: case Ndis802_11EncryptionDisabled: erq->length = 0; @@ -2258,23 +2079,16 @@ static int rtw_wx_get_enc(struct net_device *dev, case Ndis802_11Encryption1Enabled: erq->length = padapter->securitypriv.dot11DefKeylen[key]; - if (erq->length) - { + if (erq->length) { memcpy(keybuf, padapter->securitypriv.dot11DefKey[key].skey, padapter->securitypriv.dot11DefKeylen[key]); erq->flags |= IW_ENCODE_ENABLED; if (padapter->securitypriv.ndisauthtype == Ndis802_11AuthModeOpen) - { erq->flags |= IW_ENCODE_OPEN; - } else if (padapter->securitypriv.ndisauthtype == Ndis802_11AuthModeShared) - { - erq->flags |= IW_ENCODE_RESTRICTED; - } - } - else - { + erq->flags |= IW_ENCODE_RESTRICTED; + } else { erq->length = 0; erq->flags |= IW_ENCODE_DISABLED; } @@ -2343,14 +2157,13 @@ static int rtw_wx_set_auth(struct net_device *dev, case IW_AUTH_TKIP_COUNTERMEASURES: { - if (param->value) - { /* wpa_supplicant is enabling the tkip countermeasure. */ - padapter->securitypriv.btkip_countermeasure = true; - } - else - { /* wpa_supplicant is disabling the tkip countermeasure. */ - padapter->securitypriv.btkip_countermeasure = false; - } + if (param->value) { + /* wpa_supplicant is enabling the tkip countermeasure. */ + padapter->securitypriv.btkip_countermeasure = true; + } else { + /* wpa_supplicant is disabling the tkip countermeasure. */ + padapter->securitypriv.btkip_countermeasure = false; + } break; } case IW_AUTH_DROP_UNENCRYPTED: @@ -2367,8 +2180,7 @@ static int rtw_wx_set_auth(struct net_device *dev, * be set. */ - if (padapter->securitypriv.ndisencryptstatus == Ndis802_11Encryption1Enabled) - { + if (padapter->securitypriv.ndisencryptstatus == Ndis802_11Encryption1Enabled) { break;/* it means init value, or using wep, ndisencryptstatus = Ndis802_11Encryption1Enabled, */ /* then it needn't reset it; */ } @@ -2462,37 +2274,29 @@ static int rtw_wx_set_enc_ext(struct net_device *dev, strncpy((char *)param->u.crypt.alg, alg_name, IEEE_CRYPT_ALG_NAME_LEN); if (pext->ext_flags & IW_ENCODE_EXT_SET_TX_KEY) - { param->u.crypt.set_tx = 1; - } /* cliW: WEP does not have group key * just not checking GROUP key setting */ if ((pext->alg != IW_ENCODE_ALG_WEP) && ((pext->ext_flags & IW_ENCODE_EXT_GROUP_KEY) - || (pext->ext_flags & IW_ENCODE_ALG_AES_CMAC) - )) - { + || (pext->ext_flags & IW_ENCODE_ALG_AES_CMAC))) { param->u.crypt.set_tx = 0; } param->u.crypt.idx = (pencoding->flags&0x00FF) -1 ; if (pext->ext_flags & IW_ENCODE_EXT_RX_SEQ_VALID) - { memcpy(param->u.crypt.seq, pext->rx_seq, 8); - } - if (pext->key_len) - { + if (pext->key_len) { param->u.crypt.key_len = pext->key_len; /* memcpy(param + 1, pext + 1, pext->key_len); */ memcpy(param->u.crypt.key, pext + 1, pext->key_len); } - if (pencoding->flags & IW_ENCODE_DISABLED) - { + if (pencoding->flags & IW_ENCODE_DISABLED) { /* todo: remove key */ /* remove = 1; */ } @@ -2514,8 +2318,7 @@ static int rtw_wx_get_nick(struct net_device *dev, /* struct mlme_priv *pmlmepriv = &(padapter->mlmepriv); */ /* struct security_priv *psecuritypriv = &padapter->securitypriv; */ - if (extra) - { + if (extra) { wrqu->data.length = 14; wrqu->data.flags = 1; memcpy(extra, "", 14); @@ -2683,9 +2486,9 @@ static int rtw_wx_set_channel_plan(struct net_device *dev, struct adapter *padapter = (struct adapter *)rtw_netdev_priv(dev); u8 channel_plan_req = (u8) (*((int *)wrqu)); - if (_SUCCESS == rtw_set_chplan_cmd(padapter, channel_plan_req, 1, 1)) { + if (_SUCCESS == rtw_set_chplan_cmd(padapter, channel_plan_req, 1, 1)) DBG_871X("%s set channel_plan = 0x%02X\n", __func__, channel_plan_req); - } else + else return -EPERM; return 0; @@ -2751,14 +2554,12 @@ static int rtw_get_ap_info(struct net_device *dev, DBG_871X("+rtw_get_aplist_info\n"); - if ((padapter->bDriverStopped) || (pdata == NULL)) - { + if ((padapter->bDriverStopped) || (pdata == NULL)) { ret = -EINVAL; goto exit; } - while ((check_fwstate(pmlmepriv, (_FW_UNDER_SURVEY|_FW_UNDER_LINKING))) == true) - { + while ((check_fwstate(pmlmepriv, (_FW_UNDER_SURVEY|_FW_UNDER_LINKING))) == true) { msleep(30); cnt++; if (cnt > 100) @@ -2768,16 +2569,12 @@ static int rtw_get_ap_info(struct net_device *dev, /* pdata->length = 0;? */ pdata->flags = 0; - if (pdata->length>=32) - { - if (copy_from_user(data, pdata->pointer, 32)) - { + if (pdata->length>=32) { + if (copy_from_user(data, pdata->pointer, 32)) { ret = -EINVAL; goto exit; } - } - else - { + } else { ret = -EINVAL; goto exit; } @@ -2787,8 +2584,7 @@ static int rtw_get_ap_info(struct net_device *dev, phead = get_list_head(queue); plist = get_next(phead); - while (1) - { + while (1) { if (phead == plist) break; @@ -2796,32 +2592,27 @@ static int rtw_get_ap_info(struct net_device *dev, pnetwork = LIST_CONTAINOR(plist, struct wlan_network, list); /* if (hwaddr_aton_i(pdata->pointer, bssid)) */ - if (hwaddr_aton_i(data, bssid)) - { + if (hwaddr_aton_i(data, bssid)) { DBG_871X("Invalid BSSID '%s'.\n", (u8 *)data); spin_unlock_bh(&(pmlmepriv->scanned_queue.lock)); return -EINVAL; } - if (!memcmp(bssid, pnetwork->network.MacAddress, ETH_ALEN))/* BSSID match, then check if supporting wpa/wpa2 */ - { + if (!memcmp(bssid, pnetwork->network.MacAddress, ETH_ALEN)) { /* BSSID match, then check if supporting wpa/wpa2 */ DBG_871X("BSSID:" MAC_FMT "\n", MAC_ARG(bssid)); pbuf = rtw_get_wpa_ie(&pnetwork->network.IEs[12], &wpa_ielen, pnetwork->network.IELength-12); - if (pbuf && (wpa_ielen>0)) - { + if (pbuf && (wpa_ielen>0)) { pdata->flags = 1; break; } pbuf = rtw_get_wpa2_ie(&pnetwork->network.IEs[12], &wpa_ielen, pnetwork->network.IELength-12); - if (pbuf && (wpa_ielen>0)) - { + if (pbuf && (wpa_ielen>0)) { pdata->flags = 2; break; } - } plist = get_next(plist); @@ -2830,10 +2621,8 @@ static int rtw_get_ap_info(struct net_device *dev, spin_unlock_bh(&(pmlmepriv->scanned_queue.lock)); - if (pdata->length>=34) - { - if (copy_to_user((u8 __force __user *)pdata->pointer+32, (u8 *)&pdata->flags, 1)) - { + if (pdata->length>=34) { + if (copy_to_user((u8 __force __user *)pdata->pointer+32, (u8 *)&pdata->flags, 1)) { ret = -EINVAL; goto exit; } @@ -2855,8 +2644,7 @@ static int rtw_set_pid(struct net_device *dev, int *pdata = (int *)wrqu; int selector; - if ((padapter->bDriverStopped) || (pdata == NULL)) - { + if ((padapter->bDriverStopped) || (pdata == NULL)) { ret = -EINVAL; goto exit; } @@ -2886,17 +2674,14 @@ static int rtw_wps_start(struct net_device *dev, u32 u32wps_start = 0; unsigned int uintRet = 0; - if ((true == padapter->bDriverStopped) ||(true ==padapter->bSurpriseRemoved) || (NULL == pdata)) - { + if ((true == padapter->bDriverStopped) ||(true ==padapter->bSurpriseRemoved) || (NULL == pdata)) { ret = -EINVAL; goto exit; } uintRet = copy_from_user((void*) &u32wps_start, pdata->pointer, 4); if (u32wps_start == 0) - { u32wps_start = *extra; - } DBG_871X("[%s] wps_start = %d\n", __func__, u32wps_start); @@ -2964,18 +2749,15 @@ static int rtw_rereg_nd_name(struct net_device *dev, if (wrqu->data.length > IFNAMSIZ) return -EFAULT; - if (copy_from_user(new_ifname, wrqu->data.pointer, IFNAMSIZ)) { + if (copy_from_user(new_ifname, wrqu->data.pointer, IFNAMSIZ)) return -EFAULT; - } - if (0 == strcmp(rereg_priv->old_ifname, new_ifname)) { + if (0 == strcmp(rereg_priv->old_ifname, new_ifname)) return ret; - } DBG_871X("%s new_ifname:%s\n", __func__, new_ifname); - if (0 != (ret = rtw_change_ifname(padapter, new_ifname))) { + if (0 != (ret = rtw_change_ifname(padapter, new_ifname))) goto exit; - } strncpy(rereg_priv->old_ifname, new_ifname, IFNAMSIZ); rereg_priv->old_ifname[IFNAMSIZ-1] = 0; @@ -3021,11 +2803,9 @@ static int rtw_dbg_port(struct net_device *dev, extra_arg = *(pdata+1); - switch (major_cmd) - { + switch (major_cmd) { case 0x70:/* read_reg */ - switch (minor_cmd) - { + switch (minor_cmd) { case 1: DBG_871X("rtw_read8(0x%x) = 0x%02x\n", arg, rtw_read8(padapter, arg)); break; @@ -3038,8 +2818,7 @@ static int rtw_dbg_port(struct net_device *dev, } break; case 0x71:/* write_reg */ - switch (minor_cmd) - { + switch (minor_cmd) { case 1: rtw_write8(padapter, arg, extra_arg); DBG_871X("rtw_write8(0x%x) = 0x%02x\n", arg, rtw_read8(padapter, arg)); @@ -3070,8 +2849,7 @@ static int rtw_dbg_port(struct net_device *dev, break; case 0x76: - switch (minor_cmd) - { + switch (minor_cmd) { case 0x00: /* normal mode, */ padapter->recvpriv.is_signal_dbg = 0; break; @@ -3108,8 +2886,7 @@ static int rtw_dbg_port(struct net_device *dev, , WLAN_REASON_EXPIRATION_CHK); break; case 0x7F: - switch (minor_cmd) - { + switch (minor_cmd) { case 0x0: DBG_871X("fwstate = 0x%x\n", get_fwstate(pmlmepriv)); break; @@ -3137,8 +2914,7 @@ static int rtw_dbg_port(struct net_device *dev, break; case 0x05: psta = rtw_get_stainfo(pstapriv, cur_network->network.MacAddress); - if (psta) - { + if (psta) { int i; struct recv_reorder_ctrl *preorder_ctrl; @@ -3152,18 +2928,13 @@ static int rtw_dbg_port(struct net_device *dev, DBG_871X("ampdu_enable = %d\n", psta->htpriv.ampdu_enable); DBG_871X("agg_enable_bitmap =%x, candidate_tid_bitmap =%x\n", psta->htpriv.agg_enable_bitmap, psta->htpriv.candidate_tid_bitmap); - for (i = 0;i<16;i++) - { + for (i = 0;i<16;i++) { preorder_ctrl = &psta->recvreorder_ctrl[i]; if (preorder_ctrl->enable) - { DBG_871X("tid =%d, indicate_seq =%d\n", i, preorder_ctrl->indicate_seq); - } } - } - else - { + } else { DBG_871X("can't get sta's macaddr, cur_network's macaddr:" MAC_FMT "\n", MAC_ARG(cur_network->network.MacAddress)); } break; @@ -3196,19 +2967,16 @@ static int rtw_dbg_port(struct net_device *dev, spin_lock_bh(&pstapriv->sta_hash_lock); - for (i = 0; i< NUM_STA; i++) - { + for (i = 0; i< NUM_STA; i++) { phead = &(pstapriv->sta_hash[i]); plist = get_next(phead); - while (phead != plist) - { + while (phead != plist) { psta = LIST_CONTAINOR(plist, struct sta_info, hash_list); plist = get_next(plist); - if (extra_arg == psta->aid) - { + if (extra_arg == psta->aid) { DBG_871X("sta's macaddr:" MAC_FMT "\n", MAC_ARG(psta->hwaddr)); DBG_871X("rtsen =%d, cts2slef =%d\n", psta->rtsen, psta->cts2self); DBG_871X("state = 0x%x, aid =%d, macid =%d, raid =%d\n", psta->state, psta->aid, psta->mac_id, psta->raid); @@ -3226,17 +2994,12 @@ static int rtw_dbg_port(struct net_device *dev, - for (j = 0;j<16;j++) - { + for (j = 0;j<16;j++) { preorder_ctrl = &psta->recvreorder_ctrl[j]; if (preorder_ctrl->enable) - { DBG_871X("tid =%d, indicate_seq =%d\n", j, preorder_ctrl->indicate_seq); - } } - } - } } @@ -3255,8 +3018,7 @@ static int rtw_dbg_port(struct net_device *dev, if (arg == 0) { DBG_871X("disable driver ctrl vcs\n"); padapter->driver_vcs_en = 0; - } - else if (arg == 1) { + } else if (arg == 1) { DBG_871X("enable driver ctrl vcs = %d\n", extra_arg); padapter->driver_vcs_en = 1; @@ -3272,8 +3034,7 @@ static int rtw_dbg_port(struct net_device *dev, DBG_871X("dump rx packet (%d)\n", extra_arg); /* pHalData->bDumpRxPkt =extra_arg; */ rtw_hal_set_def_var(padapter, HAL_DEF_DBG_DUMP_RXPKT, &(extra_arg)); - } - else if (arg == 1) { + } else if (arg == 1) { DBG_871X("dump tx packet (%d)\n", extra_arg); rtw_hal_set_def_var(padapter, HAL_DEF_DBG_DUMP_TXPKT, &(extra_arg)); } @@ -3284,8 +3045,7 @@ static int rtw_dbg_port(struct net_device *dev, if (arg == 0) { DBG_871X("disable driver ctrl rx_ampdu_factor\n"); padapter->driver_rx_ampdu_factor = 0xFF; - } - else if (arg == 1) { + } else if (arg == 1) { DBG_871X("enable driver ctrl rx_ampdu_factor = %d\n", extra_arg); @@ -3310,12 +3070,10 @@ static int rtw_dbg_port(struct net_device *dev, struct registry_priv *pregpriv = &padapter->registrypriv; /* 0: disable, bit(0):enable 2.4g, bit(1):enable 5g, 0x3: enable both 2.4g and 5g */ /* default is set to enable 2.4GHZ for IOT issue with bufflao's AP at 5GHZ */ - if (pregpriv && (extra_arg == 0 || extra_arg == 1|| extra_arg == 2 || extra_arg == 3)) - { + if (pregpriv && (extra_arg == 0 || extra_arg == 1|| extra_arg == 2 || extra_arg == 3)) { pregpriv->rx_stbc = extra_arg; DBG_871X("set rx_stbc =%d\n", pregpriv->rx_stbc); - } - else + } else DBG_871X("get rx_stbc =%d\n", pregpriv->rx_stbc); } @@ -3324,12 +3082,10 @@ static int rtw_dbg_port(struct net_device *dev, { struct registry_priv *pregpriv = &padapter->registrypriv; /* 0: disable, 0x1:enable (but wifi_spec should be 0), 0x2: force enable (don't care wifi_spec) */ - if (pregpriv && extra_arg < 3) - { + if (pregpriv && extra_arg < 3) { pregpriv->ampdu_enable = extra_arg; DBG_871X("set ampdu_enable =%d\n", pregpriv->ampdu_enable); - } - else + } else DBG_871X("get ampdu_enable =%d\n", pregpriv->ampdu_enable); } @@ -3343,8 +3099,7 @@ static int rtw_dbg_port(struct net_device *dev, { if (arg == 0xff) { rtw_odm_dbg_comp_msg(RTW_DBGDUMP, padapter); - } - else { + } else { u64 dbg_comp = (u64)extra_arg; rtw_odm_dbg_comp_set(padapter, dbg_comp); } @@ -3375,8 +3130,7 @@ static int rtw_dbg_port(struct net_device *dev, if (arg == 0) { DBG_871X("driver disable LDPC\n"); pregistrypriv->ldpc_cap = 0x00; - } - else if (arg == 1) { + } else if (arg == 1) { DBG_871X("driver set LDPC cap = 0x%x\n", extra_arg); pregistrypriv->ldpc_cap = (u8)(extra_arg&0x33); } @@ -3391,8 +3145,7 @@ static int rtw_dbg_port(struct net_device *dev, if (arg == 0) { DBG_871X("driver disable STBC\n"); pregistrypriv->stbc_cap = 0x00; - } - else if (arg == 1) { + } else if (arg == 1) { DBG_871X("driver set STBC cap = 0x%x\n", extra_arg); pregistrypriv->stbc_cap = (u8)(extra_arg&0x33); } @@ -3406,8 +3159,7 @@ static int rtw_dbg_port(struct net_device *dev, DBG_871X("disable driver ctrl max_rx_rate, reset to default_rate_set\n"); init_mlme_default_rate_set(padapter); pregistrypriv->ht_enable = (u8)rtw_ht_enable; - } - else if (arg == 1) { + } else if (arg == 1) { int i; u8 max_rx_rate; @@ -3416,18 +3168,15 @@ static int rtw_dbg_port(struct net_device *dev, max_rx_rate = (u8)extra_arg; - if (max_rx_rate < 0xc) /* max_rx_rate < MSC0 -> B or G -> disable HT */ - { + if (max_rx_rate < 0xc) { /* max_rx_rate < MSC0 -> B or G -> disable HT */ pregistrypriv->ht_enable = 0; - for (i = 0; idatarate[i] > max_rx_rate) pmlmeext->datarate[i] = 0xff; } } - else if (max_rx_rate < 0x1c) /* mcs0~mcs15 */ - { + else if (max_rx_rate < 0x1c) { /* mcs0~mcs15 */ u32 mcs_bitmap = 0x0; for (i = 0; i<((max_rx_rate+1)-0xc); i++) @@ -3443,8 +3192,7 @@ static int rtw_dbg_port(struct net_device *dev, if (arg == 0) { DBG_871X("disable driver ctrl ampdu density\n"); padapter->driver_ampdu_spacing = 0xFF; - } - else if (arg == 1) { + } else if (arg == 1) { DBG_871X("enable driver ctrl ampdu density = %d\n", extra_arg); @@ -3531,15 +3279,12 @@ static int rtw_dbg_port(struct net_device *dev, break; case 0xdd:/* registers dump , 0 for mac reg, 1 for bb reg, 2 for rf reg */ { - if (extra_arg == 0) { + if (extra_arg == 0) mac_reg_dump(RTW_DBGDUMP, padapter); - } - else if (extra_arg == 1) { + else if (extra_arg == 1) bb_reg_dump(RTW_DBGDUMP, padapter); - } - else if (extra_arg ==2) { + else if (extra_arg ==2) rf_reg_dump(RTW_DBGDUMP, padapter); - } } break; @@ -3557,8 +3302,7 @@ static int rtw_dbg_port(struct net_device *dev, DBG_871X("extra_arg = 4 - disable BT coexistence - BIT(3)\n"); DBG_871X("extra_arg = 5 - disable antenna diversity - BIT(4)\n"); DBG_871X("extra_arg = 6 - enable all dynamic func\n"); - } - else { + } else { /*extra_arg = 0 - disable all dynamic func extra_arg = 1 - disable DIG extra_arg = 2 - disable tx power tracking @@ -3634,8 +3378,7 @@ static int wpa_set_param(struct net_device *dev, u8 name, u32 value) /* ret = ieee80211_wpa_enable(ieee, value); */ - switch ((value)&0xff) - { + switch ((value)&0xff) { case 1 : /* WPA */ padapter->securitypriv.ndisauthtype = Ndis802_11AuthModeWPAPSK; /* WPA_PSK */ padapter->securitypriv.ndisencryptstatus = Ndis802_11Encryption2Enabled; @@ -3721,8 +3464,7 @@ static int wpa_mlme(struct net_device *dev, u32 command, u32 reason) int ret = 0; struct adapter *padapter = (struct adapter *)rtw_netdev_priv(dev); - switch (command) - { + switch (command) { case IEEE_MLME_STA_DEAUTH: if (!rtw_set_802_11_disassociate(padapter)) @@ -3759,14 +3501,12 @@ static int wpa_supplicant_ioctl(struct net_device *dev, struct iw_point *p) } param = (struct ieee_param *)rtw_malloc(p->length); - if (param == NULL) - { + if (param == NULL) { ret = -ENOMEM; goto out; } - if (copy_from_user(param, p->pointer, p->length)) - { + if (copy_from_user(param, p->pointer, p->length)) { kfree(param); ret = -EFAULT; goto out; @@ -3829,35 +3569,28 @@ static int rtw_set_encryption(struct net_device *dev, struct ieee_param *param, /* sizeof(struct ieee_param) = 64 bytes; */ /* if (param_len != (u32) ((u8 *) param->u.crypt.key - (u8 *) param) + param->u.crypt.key_len) */ - if (param_len != sizeof(struct ieee_param) + param->u.crypt.key_len) - { + if (param_len != sizeof(struct ieee_param) + param->u.crypt.key_len) { ret = -EINVAL; goto exit; } if (param->sta_addr[0] == 0xff && param->sta_addr[1] == 0xff && param->sta_addr[2] == 0xff && param->sta_addr[3] == 0xff && - param->sta_addr[4] == 0xff && param->sta_addr[5] == 0xff) - { - if (param->u.crypt.idx >= WEP_KEYS) - { + param->sta_addr[4] == 0xff && param->sta_addr[5] == 0xff) { + if (param->u.crypt.idx >= WEP_KEYS) { ret = -EINVAL; goto exit; } - } - else - { + } else { psta = rtw_get_stainfo(pstapriv, param->sta_addr); - if (!psta) - { + if (!psta) { /* ret = -EINVAL; */ DBG_871X("rtw_set_encryption(), sta has already been removed or never been added\n"); goto exit; } } - if (strcmp(param->u.crypt.alg, "none") == 0 && (psta == NULL)) - { + if (strcmp(param->u.crypt.alg, "none") == 0 && (psta == NULL)) { /* todo:clear default encryption keys */ psecuritypriv->dot11AuthAlgrthm = dot11AuthAlgrthm_Open; @@ -3871,8 +3604,7 @@ static int rtw_set_encryption(struct net_device *dev, struct ieee_param *param, } - if (strcmp(param->u.crypt.alg, "WEP") == 0 && (psta == NULL)) - { + if (strcmp(param->u.crypt.alg, "WEP") == 0 && (psta == NULL)) { DBG_871X("r871x_set_encryption, crypt.alg = WEP\n"); wep_key_idx = param->u.crypt.idx; @@ -3880,15 +3612,13 @@ static int rtw_set_encryption(struct net_device *dev, struct ieee_param *param, DBG_871X("r871x_set_encryption, wep_key_idx =%d, len =%d\n", wep_key_idx, wep_key_len); - if ((wep_key_idx >= WEP_KEYS) || (wep_key_len<= 0)) - { + if ((wep_key_idx >= WEP_KEYS) || (wep_key_len<= 0)) { ret = -EINVAL; goto exit; } - if (wep_key_len > 0) - { + if (wep_key_len > 0) { wep_key_len = wep_key_len <= 5 ? 5 : 13; wep_total_len = wep_key_len + FIELD_OFFSET(struct ndis_802_11_wep, KeyMaterial); pwep =(struct ndis_802_11_wep *)rtw_malloc(wep_total_len); @@ -3908,8 +3638,7 @@ static int rtw_set_encryption(struct net_device *dev, struct ieee_param *param, memcpy(pwep->KeyMaterial, param->u.crypt.key, pwep->KeyLength); - if (param->u.crypt.set_tx) - { + if (param->u.crypt.set_tx) { DBG_871X("wep, set_tx = 1\n"); psecuritypriv->dot11AuthAlgrthm = dot11AuthAlgrthm_Auto; @@ -3917,8 +3646,7 @@ static int rtw_set_encryption(struct net_device *dev, struct ieee_param *param, psecuritypriv->dot11PrivacyAlgrthm = _WEP40_; psecuritypriv->dot118021XGrpPrivacy = _WEP40_; - if (pwep->KeyLength == 13) - { + if (pwep->KeyLength == 13) { psecuritypriv->dot11PrivacyAlgrthm = _WEP104_; psecuritypriv->dot118021XGrpPrivacy = _WEP104_; } @@ -3931,9 +3659,7 @@ static int rtw_set_encryption(struct net_device *dev, struct ieee_param *param, psecuritypriv->dot11DefKeylen[wep_key_idx]=pwep->KeyLength; rtw_ap_set_wep_key(padapter, pwep->KeyMaterial, pwep->KeyLength, wep_key_idx, 1); - } - else - { + } else { DBG_871X("wep, set_tx = 0\n"); /* don't update "psecuritypriv->dot11PrivacyAlgrthm" and */ @@ -3951,25 +3677,18 @@ static int rtw_set_encryption(struct net_device *dev, struct ieee_param *param, } - if (!psta && check_fwstate(pmlmepriv, WIFI_AP_STATE)) /* group key */ - { - if (param->u.crypt.set_tx == 1) - { - if (strcmp(param->u.crypt.alg, "WEP") == 0) - { + if (!psta && check_fwstate(pmlmepriv, WIFI_AP_STATE)) { /* group key */ + if (param->u.crypt.set_tx == 1) { + if (strcmp(param->u.crypt.alg, "WEP") == 0) { DBG_871X("%s, set group_key, WEP\n", __func__); memcpy(psecuritypriv->dot118021XGrpKey[param->u.crypt.idx].skey, param->u.crypt.key, (param->u.crypt.key_len>16 ?16:param->u.crypt.key_len)); psecuritypriv->dot118021XGrpPrivacy = _WEP40_; if (param->u.crypt.key_len == 13) - { psecuritypriv->dot118021XGrpPrivacy = _WEP104_; - } - } - else if (strcmp(param->u.crypt.alg, "TKIP") == 0) - { + } else if (strcmp(param->u.crypt.alg, "TKIP") == 0) { DBG_871X("%s, set group_key, TKIP\n", __func__); psecuritypriv->dot118021XGrpPrivacy = _TKIP_; @@ -3984,16 +3703,13 @@ static int rtw_set_encryption(struct net_device *dev, struct ieee_param *param, psecuritypriv->busetkipkey = true; } - else if (strcmp(param->u.crypt.alg, "CCMP") == 0) - { + else if (strcmp(param->u.crypt.alg, "CCMP") == 0) { DBG_871X("%s, set group_key, CCMP\n", __func__); psecuritypriv->dot118021XGrpPrivacy = _AES_; memcpy(psecuritypriv->dot118021XGrpKey[param->u.crypt.idx].skey, param->u.crypt.key, (param->u.crypt.key_len>16 ?16:param->u.crypt.key_len)); - } - else - { + } else { DBG_871X("%s, set group_key, none\n", __func__); psecuritypriv->dot118021XGrpPrivacy = _NO_PRIVACY_; @@ -4008,38 +3724,28 @@ static int rtw_set_encryption(struct net_device *dev, struct ieee_param *param, rtw_ap_set_group_key(padapter, param->u.crypt.key, psecuritypriv->dot118021XGrpPrivacy, param->u.crypt.idx); pbcmc_sta =rtw_get_bcmc_stainfo(padapter); - if (pbcmc_sta) - { + if (pbcmc_sta) { pbcmc_sta->ieee8021x_blocked = false; pbcmc_sta->dot118021XPrivacy = psecuritypriv->dot118021XGrpPrivacy;/* rx will use bmc_sta's dot118021XPrivacy */ } - } goto exit; } - if (psecuritypriv->dot11AuthAlgrthm == dot11AuthAlgrthm_8021X && psta) /* psk/802_1x */ - { - if (check_fwstate(pmlmepriv, WIFI_AP_STATE)) - { - if (param->u.crypt.set_tx == 1) - { + if (psecuritypriv->dot11AuthAlgrthm == dot11AuthAlgrthm_8021X && psta) { /* psk/802_1x */ + if (check_fwstate(pmlmepriv, WIFI_AP_STATE)) { + if (param->u.crypt.set_tx == 1) { memcpy(psta->dot118021x_UncstKey.skey, param->u.crypt.key, (param->u.crypt.key_len>16 ?16:param->u.crypt.key_len)); - if (strcmp(param->u.crypt.alg, "WEP") == 0) - { + if (strcmp(param->u.crypt.alg, "WEP") == 0) { DBG_871X("%s, set pairwise key, WEP\n", __func__); psta->dot118021XPrivacy = _WEP40_; if (param->u.crypt.key_len == 13) - { psta->dot118021XPrivacy = _WEP104_; - } - } - else if (strcmp(param->u.crypt.alg, "TKIP") == 0) - { + } else if (strcmp(param->u.crypt.alg, "TKIP") == 0) { DBG_871X("%s, set pairwise key, TKIP\n", __func__); psta->dot118021XPrivacy = _TKIP_; @@ -4051,16 +3757,12 @@ static int rtw_set_encryption(struct net_device *dev, struct ieee_param *param, psecuritypriv->busetkipkey = true; - } - else if (strcmp(param->u.crypt.alg, "CCMP") == 0) - { + } else if (strcmp(param->u.crypt.alg, "CCMP") == 0) { DBG_871X("%s, set pairwise key, CCMP\n", __func__); psta->dot118021XPrivacy = _AES_; - } - else - { + } else { DBG_871X("%s, set pairwise key, none\n", __func__); psta->dot118021XPrivacy = _NO_PRIVACY_; @@ -4070,21 +3772,14 @@ static int rtw_set_encryption(struct net_device *dev, struct ieee_param *param, psta->ieee8021x_blocked = false; - } - else/* group key??? */ - { - if (strcmp(param->u.crypt.alg, "WEP") == 0) - { + } else { /* group key??? */ + if (strcmp(param->u.crypt.alg, "WEP") == 0) { memcpy(psecuritypriv->dot118021XGrpKey[param->u.crypt.idx].skey, param->u.crypt.key, (param->u.crypt.key_len>16 ?16:param->u.crypt.key_len)); psecuritypriv->dot118021XGrpPrivacy = _WEP40_; if (param->u.crypt.key_len == 13) - { psecuritypriv->dot118021XGrpPrivacy = _WEP104_; - } - } - else if (strcmp(param->u.crypt.alg, "TKIP") == 0) - { + } else if (strcmp(param->u.crypt.alg, "TKIP") == 0) { psecuritypriv->dot118021XGrpPrivacy = _TKIP_; memcpy(psecuritypriv->dot118021XGrpKey[param->u.crypt.idx].skey, param->u.crypt.key, (param->u.crypt.key_len>16 ?16:param->u.crypt.key_len)); @@ -4096,15 +3791,11 @@ static int rtw_set_encryption(struct net_device *dev, struct ieee_param *param, psecuritypriv->busetkipkey = true; - } - else if (strcmp(param->u.crypt.alg, "CCMP") == 0) - { + } else if (strcmp(param->u.crypt.alg, "CCMP") == 0) { psecuritypriv->dot118021XGrpPrivacy = _AES_; memcpy(psecuritypriv->dot118021XGrpKey[param->u.crypt.idx].skey, param->u.crypt.key, (param->u.crypt.key_len>16 ?16:param->u.crypt.key_len)); - } - else - { + } else { psecuritypriv->dot118021XGrpPrivacy = _NO_PRIVACY_; } @@ -4117,16 +3808,12 @@ static int rtw_set_encryption(struct net_device *dev, struct ieee_param *param, rtw_ap_set_group_key(padapter, param->u.crypt.key, psecuritypriv->dot118021XGrpPrivacy, param->u.crypt.idx); pbcmc_sta =rtw_get_bcmc_stainfo(padapter); - if (pbcmc_sta) - { + if (pbcmc_sta) { pbcmc_sta->ieee8021x_blocked = false; pbcmc_sta->dot118021XPrivacy = psecuritypriv->dot118021XGrpPrivacy;/* rx will use bmc_sta's dot118021XPrivacy */ } - } - } - } exit: @@ -4196,14 +3883,11 @@ static int rtw_add_sta(struct net_device *dev, struct ieee_param *param) DBG_871X("rtw_add_sta(aid =%d) =" MAC_FMT "\n", param->u.add_sta.aid, MAC_ARG(param->sta_addr)); if (check_fwstate(pmlmepriv, (_FW_LINKED|WIFI_AP_STATE)) != true) - { return -EINVAL; - } if (param->sta_addr[0] == 0xff && param->sta_addr[1] == 0xff && param->sta_addr[2] == 0xff && param->sta_addr[3] == 0xff && - param->sta_addr[4] == 0xff && param->sta_addr[5] == 0xff) - { + param->sta_addr[4] == 0xff && param->sta_addr[5] == 0xff) { return -EINVAL; } @@ -4221,8 +3905,7 @@ static int rtw_add_sta(struct net_device *dev, struct ieee_param *param) */ /* psta = rtw_alloc_stainfo(pstapriv, param->sta_addr); */ psta = rtw_get_stainfo(pstapriv, param->sta_addr); - if (psta) - { + if (psta) { int flags = param->u.add_sta.flags; /* DBG_871X("rtw_add_sta(), init sta's variables, psta =%p\n", psta); */ @@ -4242,14 +3925,11 @@ static int rtw_add_sta(struct net_device *dev, struct ieee_param *param) psta->qos_option = 0; /* chec 802.11n ht cap. */ - if (WLAN_STA_HT&flags) - { + if (WLAN_STA_HT&flags) { psta->htpriv.ht_option = true; psta->qos_option = 1; memcpy((void*)&psta->htpriv.ht_cap, (void*)¶m->u.add_sta.ht_cap, sizeof(struct rtw_ieee80211_ht_cap)); - } - else - { + } else { psta->htpriv.ht_option = false; } @@ -4259,9 +3939,7 @@ static int rtw_add_sta(struct net_device *dev, struct ieee_param *param) update_sta_info_apmode(padapter, psta); - } - else - { + } else { ret = -ENOMEM; } @@ -4280,27 +3958,22 @@ static int rtw_del_sta(struct net_device *dev, struct ieee_param *param) DBG_871X("rtw_del_sta =" MAC_FMT "\n", MAC_ARG(param->sta_addr)); if (check_fwstate(pmlmepriv, (_FW_LINKED|WIFI_AP_STATE)) != true) - { return -EINVAL; - } if (param->sta_addr[0] == 0xff && param->sta_addr[1] == 0xff && param->sta_addr[2] == 0xff && param->sta_addr[3] == 0xff && - param->sta_addr[4] == 0xff && param->sta_addr[5] == 0xff) - { + param->sta_addr[4] == 0xff && param->sta_addr[5] == 0xff) { return -EINVAL; } psta = rtw_get_stainfo(pstapriv, param->sta_addr); - if (psta) - { + if (psta) { u8 updated =false; /* DBG_871X("free psta =%p, aid =%d\n", psta, psta->aid); */ spin_lock_bh(&pstapriv->asoc_list_lock); - if (list_empty(&psta->asoc_list) ==false) - { + if (list_empty(&psta->asoc_list) ==false) { list_del_init(&psta->asoc_list); pstapriv->asoc_list_cnt--; updated = ap_free_sta(padapter, psta, true, WLAN_REASON_DEAUTH_LEAVING); @@ -4312,9 +3985,7 @@ static int rtw_del_sta(struct net_device *dev, struct ieee_param *param) psta = NULL; - } - else - { + } else { DBG_871X("rtw_del_sta(), sta has already been removed or never been added\n"); /* ret = -1; */ @@ -4338,20 +4009,16 @@ static int rtw_ioctl_get_sta_data(struct net_device *dev, struct ieee_param *par DBG_871X("rtw_ioctl_get_sta_info, sta_addr: " MAC_FMT "\n", MAC_ARG(param_ex->sta_addr)); if (check_fwstate(pmlmepriv, (_FW_LINKED|WIFI_AP_STATE)) != true) - { return -EINVAL; - } if (param_ex->sta_addr[0] == 0xff && param_ex->sta_addr[1] == 0xff && param_ex->sta_addr[2] == 0xff && param_ex->sta_addr[3] == 0xff && - param_ex->sta_addr[4] == 0xff && param_ex->sta_addr[5] == 0xff) - { + param_ex->sta_addr[4] == 0xff && param_ex->sta_addr[5] == 0xff) { return -EINVAL; } psta = rtw_get_stainfo(pstapriv, param_ex->sta_addr); - if (psta) - { + if (psta) { psta_data->aid = (u16)psta->aid; psta_data->capability = psta->capability; psta_data->flags = psta->flags; @@ -4384,9 +4051,7 @@ static int rtw_ioctl_get_sta_data(struct net_device *dev, struct ieee_param *par psta_data->tx_drops = psta->sta_stats.tx_drops; - } - else - { + } else { ret = -1; } @@ -4405,22 +4070,17 @@ static int rtw_get_sta_wpaie(struct net_device *dev, struct ieee_param *param) DBG_871X("rtw_get_sta_wpaie, sta_addr: " MAC_FMT "\n", MAC_ARG(param->sta_addr)); if (check_fwstate(pmlmepriv, (_FW_LINKED|WIFI_AP_STATE)) != true) - { return -EINVAL; - } if (param->sta_addr[0] == 0xff && param->sta_addr[1] == 0xff && param->sta_addr[2] == 0xff && param->sta_addr[3] == 0xff && - param->sta_addr[4] == 0xff && param->sta_addr[5] == 0xff) - { + param->sta_addr[4] == 0xff && param->sta_addr[5] == 0xff) { return -EINVAL; } psta = rtw_get_stainfo(pstapriv, param->sta_addr); - if (psta) - { - if ((psta->wpa_ie[0] == WLAN_EID_RSN) || (psta->wpa_ie[0] == WLAN_EID_GENERIC)) - { + if (psta) { + if ((psta->wpa_ie[0] == WLAN_EID_RSN) || (psta->wpa_ie[0] == WLAN_EID_GENERIC)) { int wpa_ie_len; int copy_len; @@ -4431,15 +4091,11 @@ static int rtw_get_sta_wpaie(struct net_device *dev, struct ieee_param *param) param->u.wpa_ie.len = copy_len; memcpy(param->u.wpa_ie.reserved, psta->wpa_ie, copy_len); - } - else - { + } else { /* ret = -1; */ DBG_871X("sta's wpa_ie is NONE\n"); } - } - else - { + } else { ret = -1; } @@ -4464,14 +4120,12 @@ static int rtw_set_wps_beacon(struct net_device *dev, struct ieee_param *param, ie_len = len-12-2;/* 12 = param header, 2:no packed */ - if (pmlmepriv->wps_beacon_ie) - { + if (pmlmepriv->wps_beacon_ie) { kfree(pmlmepriv->wps_beacon_ie); pmlmepriv->wps_beacon_ie = NULL; } - if (ie_len>0) - { + if (ie_len>0) { pmlmepriv->wps_beacon_ie = rtw_malloc(ie_len); pmlmepriv->wps_beacon_ie_len = ie_len; if (pmlmepriv->wps_beacon_ie == NULL) { @@ -4484,7 +4138,6 @@ static int rtw_set_wps_beacon(struct net_device *dev, struct ieee_param *param, update_beacon(padapter, _VENDOR_SPECIFIC_IE_, wps_oui, true); pmlmeext->bstart_bss = true; - } @@ -4507,14 +4160,12 @@ static int rtw_set_wps_probe_resp(struct net_device *dev, struct ieee_param *par ie_len = len-12-2;/* 12 = param header, 2:no packed */ - if (pmlmepriv->wps_probe_resp_ie) - { + if (pmlmepriv->wps_probe_resp_ie) { kfree(pmlmepriv->wps_probe_resp_ie); pmlmepriv->wps_probe_resp_ie = NULL; } - if (ie_len>0) - { + if (ie_len>0) { pmlmepriv->wps_probe_resp_ie = rtw_malloc(ie_len); pmlmepriv->wps_probe_resp_ie_len = ie_len; if (pmlmepriv->wps_probe_resp_ie == NULL) { @@ -4544,14 +4195,12 @@ static int rtw_set_wps_assoc_resp(struct net_device *dev, struct ieee_param *par ie_len = len-12-2;/* 12 = param header, 2:no packed */ - if (pmlmepriv->wps_assoc_resp_ie) - { + if (pmlmepriv->wps_assoc_resp_ie) { kfree(pmlmepriv->wps_assoc_resp_ie); pmlmepriv->wps_assoc_resp_ie = NULL; } - if (ie_len>0) - { + if (ie_len>0) { pmlmepriv->wps_assoc_resp_ie = rtw_malloc(ie_len); pmlmepriv->wps_assoc_resp_ie_len = ie_len; if (pmlmepriv->wps_assoc_resp_ie == NULL) { @@ -4632,8 +4281,7 @@ static int rtw_ioctl_acl_remove_sta(struct net_device *dev, struct ieee_param *p if (param->sta_addr[0] == 0xff && param->sta_addr[1] == 0xff && param->sta_addr[2] == 0xff && param->sta_addr[3] == 0xff && - param->sta_addr[4] == 0xff && param->sta_addr[5] == 0xff) - { + param->sta_addr[4] == 0xff && param->sta_addr[5] == 0xff) { return -EINVAL; } @@ -4654,8 +4302,7 @@ static int rtw_ioctl_acl_add_sta(struct net_device *dev, struct ieee_param *para if (param->sta_addr[0] == 0xff && param->sta_addr[1] == 0xff && param->sta_addr[2] == 0xff && param->sta_addr[3] == 0xff && - param->sta_addr[4] == 0xff && param->sta_addr[5] == 0xff) - { + param->sta_addr[4] == 0xff && param->sta_addr[5] == 0xff) { return -EINVAL; } @@ -4705,14 +4352,12 @@ static int rtw_hostapd_ioctl(struct net_device *dev, struct iw_point *p) } param = (struct ieee_param *)rtw_malloc(p->length); - if (param == NULL) - { + if (param == NULL) { ret = -ENOMEM; goto out; } - if (copy_from_user(param, p->pointer, p->length)) - { + if (copy_from_user(param, p->pointer, p->length)) { kfree(param); ret = -EFAULT; goto out; @@ -4720,8 +4365,7 @@ static int rtw_hostapd_ioctl(struct net_device *dev, struct iw_point *p) /* DBG_871X("%s, cmd =%d\n", __func__, param->cmd); */ - switch (param->cmd) - { + switch (param->cmd) { case RTL871X_HOSTAPD_FLUSH: ret = rtw_hostapd_sta_flush(dev); @@ -4861,8 +4505,7 @@ static int rtw_wx_set_priv(struct net_device *dev, /* dev->name, ext)); */ #ifdef DEBUG_RTW_WX_SET_PRIV - if (!(ext_dbg = vmalloc(len))) - { + if (!(ext_dbg = vmalloc(len))) { vfree(ext, len); return -ENOMEM; } @@ -4871,8 +4514,7 @@ static int rtw_wx_set_priv(struct net_device *dev, #endif /* added for wps2.0 @20110524 */ - if (dwrq->flags == 0x8766 && len > 8) - { + if (dwrq->flags == 0x8766 && len > 8) { u32 cp_sz; struct mlme_priv *pmlmepriv = &(padapter->mlmepriv); u8 *probereq_wpsie = ext; @@ -4880,12 +4522,10 @@ static int rtw_wx_set_priv(struct net_device *dev, u8 wps_oui[4]={0x0, 0x50, 0xf2, 0x04}; if ((_VENDOR_SPECIFIC_IE_ == probereq_wpsie[0]) && - (!memcmp(&probereq_wpsie[2], wps_oui, 4))) - { + (!memcmp(&probereq_wpsie[2], wps_oui, 4))) { cp_sz = probereq_wpsie_len>MAX_WPS_IE_LEN ? MAX_WPS_IE_LEN:probereq_wpsie_len; - if (pmlmepriv->wps_probe_req_ie) - { + if (pmlmepriv->wps_probe_req_ie) { pmlmepriv->wps_probe_req_ie_len = 0; kfree(pmlmepriv->wps_probe_req_ie); pmlmepriv->wps_probe_req_ie = NULL; @@ -4909,8 +4549,7 @@ static int rtw_wx_set_priv(struct net_device *dev, } if (len >= WEXT_CSCAN_HEADER_SIZE - && !memcmp(ext, WEXT_CSCAN_HEADER, WEXT_CSCAN_HEADER_SIZE) - ) { + && !memcmp(ext, WEXT_CSCAN_HEADER, WEXT_CSCAN_HEADER_SIZE)) { ret = rtw_wx_set_scan(dev, info, awrq, ext); goto FREE_EXT; } @@ -4939,17 +4578,13 @@ static int rtw_pm_set(struct net_device *dev, DBG_871X("[%s] extra = %s\n", __func__, extra); - if (!memcmp(extra, "lps =", 4)) - { + if (!memcmp(extra, "lps =", 4)) { sscanf(extra+4, "%u", &mode); ret = rtw_pm_set_lps(padapter, mode); - } - else if (!memcmp(extra, "ips =", 4)) - { + } else if (!memcmp(extra, "ips =", 4)) { sscanf(extra+4, "%u", &mode); ret = rtw_pm_set_ips(padapter, mode); - } - else { + } else { ret = -EINVAL; } @@ -5015,8 +4650,7 @@ static int rtw_widi_set_probe_request(struct net_device *dev, struct adapter *padapter = (struct adapter *)rtw_netdev_priv(dev); pbuf = rtw_malloc(sizeof(l2_msg_t)); - if (pbuf) - { + if (pbuf) { if (copy_from_user(pbuf, wrqu->data.pointer, wrqu->data.length)) ret = -EFAULT; /* memcpy(pbuf, wrqu->data.pointer, wrqu->data.length); */ @@ -5067,17 +4701,12 @@ static int rtw_test( } if (strcmp(pch, "bton") == 0) - { rtw_btcoex_SetManualControl(padapter, false); - } if (strcmp(pch, "btoff") == 0) - { rtw_btcoex_SetManualControl(padapter, true); - } - if (strcmp(pch, "h2c") == 0) - { + if (strcmp(pch, "h2c") == 0) { u8 param[8]; u8 count = 0; u32 tmp; @@ -5104,9 +4733,8 @@ static int rtw_test( ret = rtw_hal_fill_h2c_cmd(padapter, param[0], count-1, ¶m[1]); pos = sprintf(extra, "H2C ID = 0x%02x content =", param[0]); - for (i = 1; imlmepriv, _FW_LINKED) != true) - { + if (check_fwstate(&padapter->mlmepriv, _FW_LINKED) != true) { piwstats->qual.qual = 0; piwstats->qual.level = 0; piwstats->qual.noise = 0; /* DBG_871X("No link level:%d, qual:%d, noise:%d\n", tmp_level, tmp_qual, tmp_noise); */ - } - else { + } else { #ifdef CONFIG_SIGNAL_DISPLAY_DBM tmp_level = translate_percentage_to_dbm(padapter->recvpriv.signal_strength); #else @@ -5409,8 +5033,7 @@ static struct iw_statistics *rtw_get_wireless_stats(struct net_device *dev) return &padapter->iwstats; } -struct iw_handler_def rtw_handlers_def = -{ +struct iw_handler_def rtw_handlers_def = { .standard = rtw_handlers, .num_standard = sizeof(rtw_handlers) / sizeof(iw_handler), #if defined(CONFIG_WEXT_PRIV) @@ -5523,8 +5146,7 @@ static int rtw_ioctl_wext_private(struct net_device *dev, union iwreq_data *wrq_ } /* Watch out for sub-ioctls ! */ - if (priv_args[k].cmd < SIOCDEVPRIVATE) - { + if (priv_args[k].cmd < SIOCDEVPRIVATE) { int j = -1; /* Find the matching *real* ioctl */ @@ -5554,12 +5176,10 @@ static int rtw_ioctl_wext_private(struct net_device *dev, union iwreq_data *wrq_ /* If we have to set some data */ if ((priv_args[k].set_args & IW_PRIV_TYPE_MASK) && - (priv_args[k].set_args & IW_PRIV_SIZE_MASK)) - { + (priv_args[k].set_args & IW_PRIV_SIZE_MASK)) { u8 *str; - switch (priv_args[k].set_args & IW_PRIV_TYPE_MASK) - { + switch (priv_args[k].set_args & IW_PRIV_TYPE_MASK) { case IW_PRIV_TYPE_BYTE: /* Fetch args */ count = 0; @@ -5597,8 +5217,7 @@ static int rtw_ioctl_wext_private(struct net_device *dev, union iwreq_data *wrq_ break; case IW_PRIV_TYPE_CHAR: - if (len > 0) - { + if (len > 0) { /* Size of the string to fetch */ wdata.data.length = len; if (wdata.data.length > (priv_args[k].set_args & IW_PRIV_SIZE_MASK)) @@ -5606,9 +5225,7 @@ static int rtw_ioctl_wext_private(struct net_device *dev, union iwreq_data *wrq_ /* Fetch string */ memcpy(buffer, ptr, wdata.data.length); - } - else - { + } else { wdata.data.length = 1; buffer[0] = '\0'; } @@ -5622,41 +5239,32 @@ static int rtw_ioctl_wext_private(struct net_device *dev, union iwreq_data *wrq_ } if ((priv_args[k].set_args & IW_PRIV_SIZE_FIXED) && - (wdata.data.length != (priv_args[k].set_args & IW_PRIV_SIZE_MASK))) - { + (wdata.data.length != (priv_args[k].set_args & IW_PRIV_SIZE_MASK))) { DBG_8192C("%s: The command %s needs exactly %d argument(s)...\n", __func__, cmdname, priv_args[k].set_args & IW_PRIV_SIZE_MASK); err = -EINVAL; goto exit; } - } /* if args to set */ - else - { + } else { /* if args to set */ wdata.data.length = 0L; } /* Those two tests are important. They define how the driver * will have to handle the data */ if ((priv_args[k].set_args & IW_PRIV_SIZE_FIXED) && - ((get_priv_size(priv_args[k].set_args) + offset) <= IFNAMSIZ)) - { + ((get_priv_size(priv_args[k].set_args) + offset) <= IFNAMSIZ)) { /* First case : all SET args fit within wrq */ if (offset) wdata.mode = subcmd; memcpy(wdata.name + offset, buffer, IFNAMSIZ - offset); - } - else - { + } else { if ((priv_args[k].set_args == 0) && (priv_args[k].get_args & IW_PRIV_SIZE_FIXED) && - (get_priv_size(priv_args[k].get_args) <= IFNAMSIZ)) - { + (get_priv_size(priv_args[k].get_args) <= IFNAMSIZ)) { /* Second case : no SET args, GET args fit within wrq */ if (offset) wdata.mode = subcmd; - } - else - { + } else { /* Third case : args won't fit in wrq, or variable number of args */ if (copy_to_user(wdata.data.pointer, buffer, buffer_len)) { err = -EFAULT; @@ -5670,8 +5278,7 @@ static int rtw_ioctl_wext_private(struct net_device *dev, union iwreq_data *wrq_ input = NULL; extra_size = 0; - if (IW_IS_SET(priv_args[k].cmd)) - { + if (IW_IS_SET(priv_args[k].cmd)) { /* Size of set arguments */ extra_size = get_priv_size(priv_args[k].set_args); @@ -5701,8 +5308,7 @@ static int rtw_ioctl_wext_private(struct net_device *dev, union iwreq_data *wrq_ /* If we have to get some data */ if ((priv_args[k].get_args & IW_PRIV_TYPE_MASK) && - (priv_args[k].get_args & IW_PRIV_SIZE_MASK)) - { + (priv_args[k].get_args & IW_PRIV_SIZE_MASK)) { int j; int n = 0; /* number of args */ u8 str[20] = {0}; @@ -5720,12 +5326,10 @@ static int rtw_ioctl_wext_private(struct net_device *dev, union iwreq_data *wrq_ goto exit; } - switch (priv_args[k].get_args & IW_PRIV_TYPE_MASK) - { + switch (priv_args[k].get_args & IW_PRIV_TYPE_MASK) { case IW_PRIV_TYPE_BYTE: /* Display args */ - for (j = 0; j < n; j++) - { + for (j = 0; j < n; j++) { sprintf(str, "%d ", extra[j]); len = strlen(str); output_len = strlen(output); @@ -5739,8 +5343,7 @@ static int rtw_ioctl_wext_private(struct net_device *dev, union iwreq_data *wrq_ case IW_PRIV_TYPE_INT: /* Display args */ - for (j = 0; j < n; j++) - { + for (j = 0; j < n; j++) { sprintf(str, "%d ", ((__s32*)extra)[j]); len = strlen(str); output_len = strlen(output); @@ -5769,9 +5372,7 @@ static int rtw_ioctl_wext_private(struct net_device *dev, union iwreq_data *wrq_ err = -EFAULT; goto exit; } - } /* if args to set */ - else - { + } else { /* if args to set */ wrq_data->data.length = 0; } @@ -5788,8 +5389,7 @@ int rtw_ioctl(struct net_device *dev, struct ifreq *rq, int cmd) struct iwreq *wrq = (struct iwreq *)rq; int ret = 0; - switch (cmd) - { + switch (cmd) { case RTL_IOCTL_WPA_SUPPLICANT: ret = wpa_supplicant_ioctl(dev, &wrq->u.data); break;