[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Message-ID: <cf7900c8-c528-a342-0260-73d2ab1735f1@martinhomuth.de>
Date: Mon, 18 Dec 2017 21:36:46 +0100
From: Martin Homuth <martin@...tinhomuth.de>
To: linux-kernel@...r.kernel.org
Subject: [PATCH 2/5] 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@...tinhomuth.de>
---
drivers/staging/rtl8712/rtl8712_recv.c | 8 ++--
drivers/staging/rtl8712/rtl871x_cmd.c | 36 ++++++++---------
drivers/staging/rtl8712/rtl871x_ioctl_linux.c | 58
++++++++++++++-------------
drivers/staging/rtl8712/rtl871x_mlme.c | 6 +--
drivers/staging/rtl8712/rtl871x_security.c | 25 ++++++------
5 files changed, 69 insertions(+), 64 deletions(-)
diff --git a/drivers/staging/rtl8712/rtl8712_recv.c
b/drivers/staging/rtl8712/rtl8712_recv.c
index 8f555e6e1b3f..8395b90d60b6 100644
--- a/drivers/staging/rtl8712/rtl8712_recv.c
+++ b/drivers/staging/rtl8712/rtl8712_recv.c
@@ -918,8 +918,8 @@ static void process_link_qual(struct _adapter *padapter,
}
padapter->recvpriv.signal_qual_data.total_val +=
pattrib->signal_qual;
- padapter->recvpriv.signal_qual_data.elements[padapter->
- recvpriv.signal_qual_data.index++] =
+ 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)
@@ -947,8 +947,8 @@ static void process_rssi(struct _adapter *padapter,
union recv_frame *prframe)
}
padapter->recvpriv.signal_strength_data.total_val +=
pattrib->signal_strength;
- padapter->recvpriv.signal_strength_data.elements[padapter->recvpriv.
- signal_strength_data.index++] =
+ 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)
diff --git a/drivers/staging/rtl8712/rtl871x_cmd.c
b/drivers/staging/rtl8712/rtl871x_cmd.c
index a424f447a725..620cee8b8514 100644
--- a/drivers/staging/rtl8712/rtl871x_cmd.c
+++ b/drivers/staging/rtl8712/rtl871x_cmd.c
@@ -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);
diff --git a/drivers/staging/rtl8712/rtl871x_ioctl_linux.c
b/drivers/staging/rtl8712/rtl871x_ioctl_linux.c
index e30a5be5f318..e339d3ff479e 100644
--- a/drivers/staging/rtl8712/rtl871x_ioctl_linux.c
+++ b/drivers/staging/rtl8712/rtl871x_ioctl_linux.c
@@ -117,20 +117,23 @@ static inline void handle_group_key(struct
ieee_param *param,
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,
+ 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(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);
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 +219,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 +428,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 +440,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 */
@@ -448,8 +452,7 @@ static int wpa_set_encryption(struct net_device
*dev, struct ieee_param *param,
Ndis802_11Encryption2Enabled) ||
(padapter->securitypriv.ndisencryptstatus ==
Ndis802_11Encryption3Enabled))
- psta->XPrivacy = padapter->
- securitypriv.PrivacyAlgrthm;
+ psta->XPrivacy = spriv->PrivacyAlgrthm;
if (param->u.crypt.set_tx == 1)
handle_pairwise_key(psta, param,
padapter);
@@ -464,8 +467,7 @@ static int wpa_set_encryption(struct net_device
*dev, struct ieee_param *param,
(padapter->securitypriv.ndisencryptstatus ==
Ndis802_11Encryption3Enabled))
pbcmc_sta->XPrivacy =
- padapter->securitypriv.
- PrivacyAlgrthm;
+ spriv->PrivacyAlgrthm;
}
}
}
@@ -806,12 +808,14 @@ 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(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;
psecuritypriv->PMKIDIndex++;
if (psecuritypriv->PMKIDIndex == NUM_PMKID_CACHE)
psecuritypriv->PMKIDIndex = 0;
@@ -1624,9 +1628,9 @@ 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, padapter->securitypriv.DefKey
+ [key].skey,
+ padapter->securitypriv.DefKeylen[key]);
erq->flags |= IW_ENCODE_ENABLED;
if (padapter->securitypriv.ndisauthtype ==
Ndis802_11AuthModeOpen)
diff --git a/drivers/staging/rtl8712/rtl871x_mlme.c
b/drivers/staging/rtl8712/rtl871x_mlme.c
index 111c809afc51..c2b445e3c5ec 100644
--- a/drivers/staging/rtl8712/rtl871x_mlme.c
+++ b/drivers/staging/rtl8712/rtl871x_mlme.c
@@ -326,9 +326,9 @@ 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 =
+ padapter->recvpriv.signal_qual_data.elements
+ [padapter->recvpriv.signal_qual_data.index];
padapter->recvpriv.signal_qual_data.total_val -=
last_evm;
}
diff --git a/drivers/staging/rtl8712/rtl871x_security.c
b/drivers/staging/rtl8712/rtl871x_security.c
index f4591529b080..4cea9bacb8e2 100644
--- a/drivers/staging/rtl8712/rtl871x_security.c
+++ b/drivers/staging/rtl8712/rtl871x_security.c
@@ -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, privacyKeyIndex;
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];
+ privacyKeyIndex = psecuritypriv->PrivacyKeyIndex;
+ keylength = psecuritypriv->DefKeylen[privacyKeyIndex];
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));
}
--
2.15.1
Powered by blists - more mailing lists