staging: rtl8712: style fix multiple line dereferences

This patch fixes various coding style issues in the rtl8712 module as
noted by checkpatch.pl related to dereferencing over multiple lines.

It fixes the following checkpatch.pl warning:

WARNING: Avoid multiple line dereference - prefer %s

Signed-off-by: Martin Homuth <martin@martinhomuth.de>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
This commit is contained in:
Martin Homuth 2017-12-19 21:16:23 +01:00 committed by Greg Kroah-Hartman
parent 2c5f7348fe
commit b78559b605
5 changed files with 100 additions and 117 deletions

View File

@ -899,6 +899,7 @@ static void process_link_qual(struct _adapter *padapter,
{
u32 last_evm = 0, tmpVal;
struct rx_pkt_attrib *pattrib;
struct smooth_rssi_data *sqd = &padapter->recvpriv.signal_qual_data;
if (prframe == NULL || padapter == NULL)
return;
@ -907,27 +908,18 @@ static void process_link_qual(struct _adapter *padapter,
/*
* 1. Record the general EVM to the sliding window.
*/
if (padapter->recvpriv.signal_qual_data.total_num++ >=
PHY_LINKQUALITY_SLID_WIN_MAX) {
padapter->recvpriv.signal_qual_data.total_num =
PHY_LINKQUALITY_SLID_WIN_MAX;
last_evm = padapter->recvpriv.signal_qual_data.elements
[padapter->recvpriv.signal_qual_data.index];
padapter->recvpriv.signal_qual_data.total_val -=
last_evm;
if (sqd->total_num++ >= PHY_LINKQUALITY_SLID_WIN_MAX) {
sqd->total_num = PHY_LINKQUALITY_SLID_WIN_MAX;
last_evm = sqd->elements[sqd->index];
sqd->total_val -= last_evm;
}
padapter->recvpriv.signal_qual_data.total_val +=
pattrib->signal_qual;
padapter->recvpriv.signal_qual_data.elements[padapter->
recvpriv.signal_qual_data.index++] =
pattrib->signal_qual;
if (padapter->recvpriv.signal_qual_data.index >=
PHY_LINKQUALITY_SLID_WIN_MAX)
padapter->recvpriv.signal_qual_data.index = 0;
sqd->total_val += pattrib->signal_qual;
sqd->elements[sqd->index++] = pattrib->signal_qual;
if (sqd->index >= PHY_LINKQUALITY_SLID_WIN_MAX)
sqd->index = 0;
/* <1> Showed on UI for user, in percentage. */
tmpVal = padapter->recvpriv.signal_qual_data.total_val /
padapter->recvpriv.signal_qual_data.total_num;
tmpVal = sqd->total_val / sqd->total_num;
padapter->recvpriv.signal = (u8)tmpVal;
}
}
@ -936,25 +928,18 @@ static void process_rssi(struct _adapter *padapter, union recv_frame *prframe)
{
u32 last_rssi, tmp_val;
struct rx_pkt_attrib *pattrib = &prframe->u.hdr.attrib;
struct smooth_rssi_data *ssd = &padapter->recvpriv.signal_strength_data;
if (padapter->recvpriv.signal_strength_data.total_num++ >=
PHY_RSSI_SLID_WIN_MAX) {
padapter->recvpriv.signal_strength_data.total_num =
PHY_RSSI_SLID_WIN_MAX;
last_rssi = padapter->recvpriv.signal_strength_data.elements
[padapter->recvpriv.signal_strength_data.index];
padapter->recvpriv.signal_strength_data.total_val -= last_rssi;
if (ssd->total_num++ >= PHY_RSSI_SLID_WIN_MAX) {
ssd->total_num = PHY_RSSI_SLID_WIN_MAX;
last_rssi = ssd->elements[ssd->index];
ssd->total_val -= last_rssi;
}
padapter->recvpriv.signal_strength_data.total_val +=
pattrib->signal_strength;
padapter->recvpriv.signal_strength_data.elements[padapter->recvpriv.
signal_strength_data.index++] =
pattrib->signal_strength;
if (padapter->recvpriv.signal_strength_data.index >=
PHY_RSSI_SLID_WIN_MAX)
padapter->recvpriv.signal_strength_data.index = 0;
tmp_val = padapter->recvpriv.signal_strength_data.total_val /
padapter->recvpriv.signal_strength_data.total_num;
ssd->total_val += pattrib->signal_strength;
ssd->elements[ssd->index++] = pattrib->signal_strength;
if (ssd->index >= PHY_RSSI_SLID_WIN_MAX)
ssd->index = 0;
tmp_val = ssd->total_val / ssd->total_num;
padapter->recvpriv.rssi = (s8)translate2dbm(padapter, (u8)tmp_val);
}

View File

@ -455,8 +455,8 @@ u8 r8712_joinbss_cmd(struct _adapter *padapter, struct wlan_network *pnetwork)
struct qos_priv *pqospriv = &pmlmepriv->qospriv;
struct security_priv *psecuritypriv = &padapter->securitypriv;
struct registry_priv *pregistrypriv = &padapter->registrypriv;
enum NDIS_802_11_NETWORK_INFRASTRUCTURE ndis_network_mode = pnetwork->
network.InfrastructureMode;
enum NDIS_802_11_NETWORK_INFRASTRUCTURE ndis_network_mode =
pnetwork->network.InfrastructureMode;
padapter->ledpriv.LedControlHandler(padapter, LED_CTL_START_TO_LINK);
pcmd = kmalloc(sizeof(*pcmd), GFP_ATOMIC);
@ -862,22 +862,22 @@ void r8712_createbss_cmd_callback(struct _adapter *padapter,
pnetwork->Privacy = le32_to_cpu(pnetwork->Privacy);
pnetwork->Rssi = le32_to_cpu(pnetwork->Rssi);
pnetwork->NetworkTypeInUse = le32_to_cpu(pnetwork->NetworkTypeInUse);
pnetwork->Configuration.ATIMWindow = le32_to_cpu(pnetwork->
Configuration.ATIMWindow);
pnetwork->Configuration.DSConfig = le32_to_cpu(pnetwork->
Configuration.DSConfig);
pnetwork->Configuration.FHConfig.DwellTime = le32_to_cpu(pnetwork->
Configuration.FHConfig.DwellTime);
pnetwork->Configuration.FHConfig.HopPattern = le32_to_cpu(pnetwork->
Configuration.FHConfig.HopPattern);
pnetwork->Configuration.FHConfig.HopSet = le32_to_cpu(pnetwork->
Configuration.FHConfig.HopSet);
pnetwork->Configuration.FHConfig.Length = le32_to_cpu(pnetwork->
Configuration.FHConfig.Length);
pnetwork->Configuration.Length = le32_to_cpu(pnetwork->
Configuration.Length);
pnetwork->InfrastructureMode = le32_to_cpu(pnetwork->
InfrastructureMode);
pnetwork->Configuration.ATIMWindow =
le32_to_cpu(pnetwork->Configuration.ATIMWindow);
pnetwork->Configuration.DSConfig =
le32_to_cpu(pnetwork->Configuration.DSConfig);
pnetwork->Configuration.FHConfig.DwellTime =
le32_to_cpu(pnetwork->Configuration.FHConfig.DwellTime);
pnetwork->Configuration.FHConfig.HopPattern =
le32_to_cpu(pnetwork->Configuration.FHConfig.HopPattern);
pnetwork->Configuration.FHConfig.HopSet =
le32_to_cpu(pnetwork->Configuration.FHConfig.HopSet);
pnetwork->Configuration.FHConfig.Length =
le32_to_cpu(pnetwork->Configuration.FHConfig.Length);
pnetwork->Configuration.Length =
le32_to_cpu(pnetwork->Configuration.Length);
pnetwork->InfrastructureMode =
le32_to_cpu(pnetwork->InfrastructureMode);
pnetwork->IELength = le32_to_cpu(pnetwork->IELength);
#endif
spin_lock_irqsave(&pmlmepriv->lock, irqL);

View File

@ -114,23 +114,27 @@ static inline void handle_pairwise_key(struct sta_info *psta,
static inline void handle_group_key(struct ieee_param *param,
struct _adapter *padapter)
{
union Keytype *gk = padapter->securitypriv.XGrpKey;
union Keytype *gtk = padapter->securitypriv.XGrptxmickey;
union Keytype *grk = padapter->securitypriv.XGrprxmickey;
if (param->u.crypt.idx > 0 &&
param->u.crypt.idx < 3) {
/* group key idx is 1 or 2 */
memcpy(padapter->securitypriv.XGrpKey[param->u.crypt.
idx - 1].skey, param->u.crypt.key,
(param->u.crypt.key_len > 16 ? 16 :
param->u.crypt.key_len));
memcpy(padapter->securitypriv.XGrptxmickey[param->
u.crypt.idx - 1].skey, &(param->u.crypt.key[16]), 8);
memcpy(padapter->securitypriv. XGrprxmickey[param->
u.crypt.idx - 1].skey, &(param->u.crypt.key[24]), 8);
memcpy(gk[param->u.crypt.idx - 1].skey,
param->u.crypt.key,
(param->u.crypt.key_len > 16 ? 16 :
param->u.crypt.key_len));
memcpy(gtk[param->u.crypt.idx - 1].skey,
&param->u.crypt.key[16], 8);
memcpy(grk[param->u.crypt.idx - 1].skey,
&param->u.crypt.key[24], 8);
padapter->securitypriv.binstallGrpkey = true;
r8712_set_key(padapter, &padapter->securitypriv,
param->u.crypt.idx);
if (padapter->registrypriv.power_mgnt > PS_MODE_ACTIVE) {
if (padapter->registrypriv.power_mgnt != padapter->
pwrctrlpriv.pwr_mode)
if (padapter->registrypriv.power_mgnt !=
padapter->pwrctrlpriv.pwr_mode)
mod_timer(&padapter->mlmepriv.dhcp_timer,
jiffies + msecs_to_jiffies(60000));
}
@ -216,9 +220,9 @@ static noinline_for_stack char *translate_scan(struct _adapter *padapter,
if (dsconfig >= 1 && dsconfig <= sizeof(
ieee80211_wlan_frequencies) / sizeof(long))
iwe.u.freq.m = (s32)(ieee80211_wlan_frequencies[
pnetwork->network.Configuration.
DSConfig - 1] * 100000);
iwe.u.freq.m =
(s32)(ieee80211_wlan_frequencies
[dsconfig - 1] * 100000);
else
iwe.u.freq.m = 0;
}
@ -425,9 +429,9 @@ static int wpa_set_encryption(struct net_device *dev, struct ieee_param *param,
ret = -EOPNOTSUPP;
goto exit;
}
memcpy(&(psecuritypriv->DefKey[wep_key_idx].
skey[0]), pwep->KeyMaterial,
pwep->KeyLength);
memcpy(&psecuritypriv->DefKey[wep_key_idx].skey[0],
pwep->KeyMaterial,
pwep->KeyLength);
psecuritypriv->DefKeylen[wep_key_idx] =
pwep->KeyLength;
r8712_set_key(padapter, psecuritypriv, wep_key_idx);
@ -437,6 +441,7 @@ static int wpa_set_encryption(struct net_device *dev, struct ieee_param *param,
if (padapter->securitypriv.AuthAlgrthm == 2) { /* 802_1x */
struct sta_info *psta, *pbcmc_sta;
struct sta_priv *pstapriv = &padapter->stapriv;
struct security_priv *spriv = &padapter->securitypriv;
if (check_fwstate(pmlmepriv, WIFI_STATION_STATE |
WIFI_MP_STATE)) { /* sta mode */
@ -444,12 +449,11 @@ static int wpa_set_encryption(struct net_device *dev, struct ieee_param *param,
get_bssid(pmlmepriv));
if (psta) {
psta->ieee8021x_blocked = false;
if ((padapter->securitypriv.ndisencryptstatus ==
Ndis802_11Encryption2Enabled) ||
(padapter->securitypriv.ndisencryptstatus ==
Ndis802_11Encryption3Enabled))
psta->XPrivacy = padapter->
securitypriv.PrivacyAlgrthm;
if (spriv->ndisencryptstatus ==
Ndis802_11Encryption2Enabled ||
spriv->ndisencryptstatus ==
Ndis802_11Encryption3Enabled)
psta->XPrivacy = spriv->PrivacyAlgrthm;
if (param->u.crypt.set_tx == 1)
handle_pairwise_key(psta, param,
padapter);
@ -459,13 +463,12 @@ static int wpa_set_encryption(struct net_device *dev, struct ieee_param *param,
pbcmc_sta = r8712_get_bcmc_stainfo(padapter);
if (pbcmc_sta) {
pbcmc_sta->ieee8021x_blocked = false;
if ((padapter->securitypriv.ndisencryptstatus ==
Ndis802_11Encryption2Enabled) ||
(padapter->securitypriv.ndisencryptstatus ==
Ndis802_11Encryption3Enabled))
if (spriv->ndisencryptstatus ==
Ndis802_11Encryption2Enabled ||
spriv->ndisencryptstatus ==
Ndis802_11Encryption3Enabled)
pbcmc_sta->XPrivacy =
padapter->securitypriv.
PrivacyAlgrthm;
spriv->PrivacyAlgrthm;
}
}
}
@ -763,6 +766,7 @@ static int r871x_wx_set_pmkid(struct net_device *dev,
struct _adapter *padapter = netdev_priv(dev);
struct security_priv *psecuritypriv = &padapter->securitypriv;
struct iw_pmksa *pPMK = (struct iw_pmksa *) extra;
struct RT_PMKID_LIST *pl = psecuritypriv->PMKIDList;
u8 strZeroMacAddress[ETH_ALEN] = {0x00};
u8 strIssueBssid[ETH_ALEN] = {0x00};
u8 j, blInserted = false;
@ -787,16 +791,14 @@ static int r871x_wx_set_pmkid(struct net_device *dev,
blInserted = false;
/* overwrite PMKID */
for (j = 0; j < NUM_PMKID_CACHE; j++) {
if (!memcmp(psecuritypriv->PMKIDList[j].Bssid,
strIssueBssid, ETH_ALEN)) {
if (!memcmp(pl[j].Bssid, strIssueBssid, ETH_ALEN)) {
/* BSSID is matched, the same AP => rewrite
* with new PMKID.
*/
netdev_info(dev, "r8712u: %s: BSSID exists in the PMKList.\n",
__func__);
memcpy(psecuritypriv->PMKIDList[j].PMKID,
pPMK->pmkid, IW_PMKID_LEN);
psecuritypriv->PMKIDList[j].bUsed = true;
memcpy(pl[j].PMKID, pPMK->pmkid, IW_PMKID_LEN);
pl[j].bUsed = true;
psecuritypriv->PMKIDIndex = j + 1;
blInserted = true;
break;
@ -806,12 +808,11 @@ static int r871x_wx_set_pmkid(struct net_device *dev,
/* Find a new entry */
netdev_info(dev, "r8712u: %s: Use the new entry index = %d for this PMKID.\n",
__func__, psecuritypriv->PMKIDIndex);
memcpy(psecuritypriv->PMKIDList[psecuritypriv->
PMKIDIndex].Bssid, strIssueBssid, ETH_ALEN);
memcpy(psecuritypriv->PMKIDList[psecuritypriv->
PMKIDIndex].PMKID, pPMK->pmkid, IW_PMKID_LEN);
psecuritypriv->PMKIDList[psecuritypriv->PMKIDIndex].
bUsed = true;
memcpy(pl[psecuritypriv->PMKIDIndex].Bssid,
strIssueBssid, ETH_ALEN);
memcpy(pl[psecuritypriv->PMKIDIndex].PMKID,
pPMK->pmkid, IW_PMKID_LEN);
pl[psecuritypriv->PMKIDIndex].bUsed = true;
psecuritypriv->PMKIDIndex++;
if (psecuritypriv->PMKIDIndex == NUM_PMKID_CACHE)
psecuritypriv->PMKIDIndex = 0;
@ -820,13 +821,12 @@ static int r871x_wx_set_pmkid(struct net_device *dev,
case IW_PMKSA_REMOVE:
intReturn = true;
for (j = 0; j < NUM_PMKID_CACHE; j++) {
if (!memcmp(psecuritypriv->PMKIDList[j].Bssid,
strIssueBssid, ETH_ALEN)) {
if (!memcmp(pl[j].Bssid, strIssueBssid, ETH_ALEN)) {
/* BSSID is matched, the same AP => Remove
* this PMKID information and reset it.
*/
eth_zero_addr(psecuritypriv->PMKIDList[j].Bssid);
psecuritypriv->PMKIDList[j].bUsed = false;
eth_zero_addr(pl[j].Bssid);
pl[j].bUsed = false;
break;
}
}
@ -1598,6 +1598,7 @@ static int r8711_wx_get_enc(struct net_device *dev,
struct _adapter *padapter = netdev_priv(dev);
struct iw_point *erq = &(wrqu->encoding);
struct mlme_priv *pmlmepriv = &(padapter->mlmepriv);
union Keytype *dk = padapter->securitypriv.DefKey;
if (!check_fwstate(pmlmepriv, _FW_LINKED)) {
if (!check_fwstate(pmlmepriv, WIFI_ADHOC_MASTER_STATE)) {
@ -1624,9 +1625,8 @@ static int r8711_wx_get_enc(struct net_device *dev,
case Ndis802_11Encryption1Enabled:
erq->length = padapter->securitypriv.DefKeylen[key];
if (erq->length) {
memcpy(keybuf, padapter->securitypriv.DefKey[
key].skey, padapter->securitypriv.
DefKeylen[key]);
memcpy(keybuf, dk[key].skey,
padapter->securitypriv.DefKeylen[key]);
erq->flags |= IW_ENCODE_ENABLED;
if (padapter->securitypriv.ndisauthtype ==
Ndis802_11AuthModeOpen)

View File

@ -319,6 +319,7 @@ static void update_network(struct wlan_bssid_ex *dst,
struct _adapter *padapter)
{
u32 last_evm = 0, tmpVal;
struct smooth_rssi_data *sqd = &padapter->recvpriv.signal_qual_data;
if (check_fwstate(&padapter->mlmepriv, _FW_LINKED) &&
is_same_network(&(padapter->mlmepriv.cur_network.network), src)) {
@ -326,17 +327,13 @@ static void update_network(struct wlan_bssid_ex *dst,
PHY_LINKQUALITY_SLID_WIN_MAX) {
padapter->recvpriv.signal_qual_data.total_num =
PHY_LINKQUALITY_SLID_WIN_MAX;
last_evm = padapter->recvpriv.signal_qual_data.
elements[padapter->recvpriv.
signal_qual_data.index];
last_evm = sqd->elements[sqd->index];
padapter->recvpriv.signal_qual_data.total_val -=
last_evm;
}
padapter->recvpriv.signal_qual_data.total_val += src->Rssi;
padapter->recvpriv.signal_qual_data.
elements[padapter->recvpriv.signal_qual_data.
index++] = src->Rssi;
sqd->elements[sqd->index++] = src->Rssi;
if (padapter->recvpriv.signal_qual_data.index >=
PHY_LINKQUALITY_SLID_WIN_MAX)
padapter->recvpriv.signal_qual_data.index = 0;

View File

@ -165,7 +165,7 @@ void r8712_wep_encrypt(struct _adapter *padapter, u8 *pxmitframe)
{ /* exclude ICV */
unsigned char crc[4];
struct arc4context mycontext;
u32 curfragnum, length, keylength;
u32 curfragnum, length, keylength, pki;
u8 *pframe, *payload, *iv; /*,*wepkey*/
u8 wepkey[16];
struct pkt_attrib *pattrib = &((struct xmit_frame *)
@ -178,8 +178,8 @@ void r8712_wep_encrypt(struct _adapter *padapter, u8 *pxmitframe)
pframe = ((struct xmit_frame *)pxmitframe)->buf_addr + TXDESC_OFFSET;
/*start to encrypt each fragment*/
if ((pattrib->encrypt == _WEP40_) || (pattrib->encrypt == _WEP104_)) {
keylength = psecuritypriv->DefKeylen[psecuritypriv->
PrivacyKeyIndex];
pki = psecuritypriv->PrivacyKeyIndex;
keylength = psecuritypriv->DefKeylen[pki];
for (curfragnum = 0; curfragnum < pattrib->nr_frags;
curfragnum++) {
iv = pframe + pattrib->hdrlen;
@ -189,9 +189,10 @@ void r8712_wep_encrypt(struct _adapter *padapter, u8 *pxmitframe)
keylength);
payload = pframe + pattrib->iv_len + pattrib->hdrlen;
if ((curfragnum + 1) == pattrib->nr_frags) {
length = pattrib->last_txcmdsz - pattrib->
hdrlen - pattrib->iv_len -
pattrib->icv_len;
length = pattrib->last_txcmdsz -
pattrib->hdrlen -
pattrib->iv_len -
pattrib->icv_len;
*((__le32 *)crc) = cpu_to_le32(getcrc32(
payload, length));
arcfour_init(&mycontext, wepkey, 3 + keylength);
@ -606,8 +607,8 @@ u32 r8712_tkip_encrypt(struct _adapter *padapter, u8 *pxmitframe)
GET_TKIP_PN(iv, txpn);
pnl = (u16)(txpn.val);
pnh = (u32)(txpn.val >> 16);
phase1((u16 *)&ttkey[0], prwskey, &pattrib->
ta[0], pnh);
phase1((u16 *)&ttkey[0], prwskey,
&pattrib->ta[0], pnh);
phase2(&rc4key[0], prwskey, (u16 *)&ttkey[0],
pnl);
if ((curfragnum + 1) == pattrib->nr_frags) {
@ -1185,15 +1186,15 @@ u32 r8712_aes_encrypt(struct _adapter *padapter, u8 *pxmitframe)
pattrib->hdrlen -
pattrib->iv_len -
pattrib->icv_len;
aes_cipher(prwskey, pattrib->
hdrlen, pframe, length);
aes_cipher(prwskey, pattrib->hdrlen,
pframe, length);
} else {
length = pxmitpriv->frag_len -
pattrib->hdrlen -
pattrib->iv_len -
pattrib->icv_len;
aes_cipher(prwskey, pattrib->
hdrlen, pframe, length);
aes_cipher(prwskey, pattrib->hdrlen,
pframe, length);
pframe += pxmitpriv->frag_len;
pframe = (u8 *)RND4((addr_t)(pframe));
}