All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH v2] staging: rtl8712: Remove the unnecessary parantheses
@ 2016-03-06  9:13 G Pooja Shamili
  2016-03-06  9:19 ` [Outreachy kernel] " Julia Lawall
  0 siblings, 1 reply; 2+ messages in thread
From: G Pooja Shamili @ 2016-03-06  9:13 UTC (permalink / raw)
  To: outreachy-kernel

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
-)
)
;

Signed-off-by: G Pooja Shamili <poojashamili@gmail.com>
---
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(-)

diff --git a/drivers/staging/rtl8712/rtl871x_mlme.c b/drivers/staging/rtl8712/rtl871x_mlme.c
index 1b022db..604ef58 100644
--- a/drivers/staging/rtl8712/rtl871x_mlme.c
+++ b/drivers/staging/rtl8712/rtl871x_mlme.c
@@ -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



^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [Outreachy kernel] [PATCH v2] staging: rtl8712: Remove the unnecessary parantheses
  2016-03-06  9:13 [PATCH v2] staging: rtl8712: Remove the unnecessary parantheses G Pooja Shamili
@ 2016-03-06  9:19 ` Julia Lawall
  0 siblings, 0 replies; 2+ messages in thread
From: Julia Lawall @ 2016-03-06  9:19 UTC (permalink / raw)
  To: G Pooja Shamili; +Cc: outreachy-kernel



On Sun, 6 Mar 2016, G Pooja Shamili wrote:

> 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
> -)
> +)

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

> |
> -(
> E2
> -)
> )
> ;
>
> Signed-off-by: G Pooja Shamili <poojashamili@gmail.com>
> ---
> 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(-)
>
> diff --git a/drivers/staging/rtl8712/rtl871x_mlme.c b/drivers/staging/rtl8712/rtl871x_mlme.c
> index 1b022db..604ef58 100644
> --- a/drivers/staging/rtl8712/rtl871x_mlme.c
> +++ b/drivers/staging/rtl8712/rtl871x_mlme.c
> @@ -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 outreachy-kernel+unsubscribe@googlegroups.com.
> To post to this group, send email to outreachy-kernel@googlegroups.com.
> 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.
>


^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2016-03-06  9:19 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2016-03-06  9:13 [PATCH v2] staging: rtl8712: Remove the unnecessary parantheses G Pooja Shamili
2016-03-06  9:19 ` [Outreachy kernel] " Julia Lawall

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.