Skip to contentSkip to conversation

staging: rtl8712: Remove the unnecessary parantheses

PATCH Superseded G Pooja Shamili 2 participants 2 messages Mar 6, 2016 Staging

v2 of 3 Superseded Latest is v3 →

lore
Share & tools
lore
#0 lore raw

PATCH v2 1/1 staging: rtl8712: Remove the unnecessary parantheses

The unnecessary parantheses on the right side of assignments were remove as in most cases (expect for ==, >=, <=, !=), they are futile.

This was done using Coccinelle, the semantic patch being:

@@
expression E1,E2,E3;
binary operator bin_op = {==,>=,<=,!=};
@@

E1 =
(
-(
+(
E2 bin_op E3
-)
+)
|
-(
E2
-)
)
;

---
Changes from Version 1:
* Changed the name in the From: and Signed-off-by: to full
name.

 drivers/staging/rtl8712/rtl871x_mlme.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)
drivers/staging/rtl8712/rtl871x_mlme.c +3 -3
index 1b022db..604ef58 100644
@@ -1285,7 +1285,7 @@ sint r8712_set_key(struct _adapter *adapter,
 	}
 	pcmd->cmdcode = _SetKey_CMD_;
 	pcmd->parmbuf = (u8 *)psetkeyparm;
-	pcmd->cmdsz =  (sizeof(struct setkey_parm));
+	pcmd->cmdsz =  sizeof(struct setkey_parm);
 	pcmd->rsp = NULL;
 	pcmd->rspsz = 0;
 	INIT_LIST_HEAD(&pcmd->list);
@@ -1748,8 +1748,8 @@ static void update_ht_cap(struct _adapter *padapter, u8 *pie, uint ie_len)
 				sizeof(struct NDIS_802_11_FIXED_IEs));
 	if (p && len > 0) {
 		pht_capie = (struct ieee80211_ht_cap *)(p + 2);
-		max_ampdu_sz = (pht_capie->ampdu_params_info &
-				IEEE80211_HT_CAP_AMPDU_FACTOR);
+		max_ampdu_sz = pht_capie->ampdu_params_info &
+				IEEE80211_HT_CAP_AMPDU_FACTOR;
 		/* max_ampdu_sz (kbytes); */
 		max_ampdu_sz = 1 << (max_ampdu_sz + 3);
 		phtpriv->rx_ampdu_maxlen = max_ampdu_sz;
Signature · 1 line
2.1.4
#1 lore raw
Quoted 15 lines · G Pooja Shamili

The unnecessary parantheses on the right side of assignments were remove as in most cases (expect for ==, >=, <=, !=), they are futile.

This was done using Coccinelle, the semantic patch being:

@@
expression E1,E2,E3;
binary operator bin_op = {==,>=,<=,!=};
@@

E1 =
(

(quoted diff) +1 -1
-(
+(

E2 bin_op E3

Review

Quoted 2 lines
(quoted diff) +1 -1
-)
+)

You don't really need toremove the parentheses and then add them back. You can just put E2 bin_op E3 with no annotation at all, and then it will do nothing in those cases.

julia

Quoted 50 lines

|
-(
E2
-)
)
;

---
Changes from Version 1:
* Changed the name in the From: and Signed-off-by: to full
name.

 drivers/staging/rtl8712/rtl871x_mlme.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)
drivers/staging/rtl8712/rtl871x_mlme.c +3 -4
index 1b022db..604ef58 100644
@@ -1285,7 +1285,7 @@ sint r8712_set_key(struct _adapter *adapter,
 	}
 	pcmd->cmdcode = _SetKey_CMD_;
 	pcmd->parmbuf = (u8 *)psetkeyparm;
-	pcmd->cmdsz =  (sizeof(struct setkey_parm));
+	pcmd->cmdsz =  sizeof(struct setkey_parm);
 	pcmd->rsp = NULL;
 	pcmd->rspsz = 0;
 	INIT_LIST_HEAD(&pcmd->list);
@@ -1748,8 +1748,8 @@ static void update_ht_cap(struct _adapter *padapter, u8 *pie, uint ie_len)
 				sizeof(struct NDIS_802_11_FIXED_IEs));
 	if (p && len > 0) {
 		pht_capie = (struct ieee80211_ht_cap *)(p + 2);
-		max_ampdu_sz = (pht_capie->ampdu_params_info &
-				IEEE80211_HT_CAP_AMPDU_FACTOR);
+		max_ampdu_sz = pht_capie->ampdu_params_info &
+				IEEE80211_HT_CAP_AMPDU_FACTOR;
 		/* max_ampdu_sz (kbytes); */
 		max_ampdu_sz = 1 << (max_ampdu_sz + 3);
 		phtpriv->rx_ampdu_maxlen = max_ampdu_sz;
--

2.1.4

--
You received this message because you are subscribed to the Google Groups "outreachy-kernel" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. To post to this group, send email to [email protected].
To view this discussion on the web visit https://groups.google.com/d/msgid/outreachy-kernel/20160306091309.GA30726%40localhost.
For more options, visit https://groups.google.com/d/optout.