All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH v3] staging: rtl8723bs: clean up conditionals
@ 2018-02-18  7:26 Dafna Hirschfeld
  2018-02-18 13:00 ` [Outreachy kernel] " Julia Lawall
  0 siblings, 1 reply; 4+ messages in thread
From: Dafna Hirschfeld @ 2018-02-18  7:26 UTC (permalink / raw)
  To: gregkh; +Cc: outreachy-kernel

Move all closing braces and parentheses to the end of the line.
Remove braces from 'if' statements with a single 'then' line.
Move logical operators to the end of lines in multiline conditional.
Remove unnecessary parentheses.
Issues found with checkpatch.pl

Signed-off-by: Dafna Hirschfeld <dafna3@gmail.com>
---
Changes in v2:
- Fix commit body spelling and lines 

 drivers/staging/rtl8723bs/os_dep/xmit_linux.c | 24 +++++++-----------------
 1 file changed, 7 insertions(+), 17 deletions(-)

diff --git a/drivers/staging/rtl8723bs/os_dep/xmit_linux.c b/drivers/staging/rtl8723bs/os_dep/xmit_linux.c
index f29e110..21e1b81 100644
--- a/drivers/staging/rtl8723bs/os_dep/xmit_linux.c
+++ b/drivers/staging/rtl8723bs/os_dep/xmit_linux.c
@@ -64,9 +64,7 @@ int rtw_os_xmit_resource_alloc(struct adapter *padapter, struct xmit_buf *pxmitb
 	if (alloc_sz > 0) {
 		pxmitbuf->pallocated_buf = rtw_zmalloc(alloc_sz);
 		if (pxmitbuf->pallocated_buf == NULL)
-		{
 			return _FAIL;
-		}
 
 		pxmitbuf->pbuf = (u8 *)N_BYTE_ALIGMENT((SIZE_PTR)(pxmitbuf->pallocated_buf), XMITBUF_ALIGN_SZ);
 	}
@@ -90,10 +88,8 @@ void rtw_os_pkt_complete(struct adapter *padapter, _pkt *pkt)
 	queue = skb_get_queue_mapping(pkt);
 	if (padapter->registrypriv.wifi_spec) {
 		if (__netif_subqueue_stopped(padapter->pnetdev, queue) &&
-			(pxmitpriv->hwxmits[queue].accnt < WMM_XMIT_THRESHOLD))
-		{
+		    (pxmitpriv->hwxmits[queue].accnt < WMM_XMIT_THRESHOLD))
 			netif_wake_subqueue(padapter->pnetdev, queue);
-		}
 	} else {
 		if (__netif_subqueue_stopped(padapter->pnetdev, queue))
 			netif_wake_subqueue(padapter->pnetdev, queue);
@@ -177,18 +173,15 @@ static int rtw_mlcst2unicst(struct adapter *padapter, struct sk_buff *skb)
 
 	for (i = 0; i < chk_alive_num; i++) {
 		psta = rtw_get_stainfo_by_offset(pstapriv, chk_alive_list[i]);
-		if (!(psta->state & _FW_LINKED))
-		{
+		if (!(psta->state & _FW_LINKED)) {
 			DBG_COUNTER(padapter->tx_logs.os_tx_m2u_ignore_fw_linked);
 			continue;
 		}
 
 		/* avoid come from STA1 and send back STA1 */
-		if (!memcmp(psta->hwaddr, &skb->data[6], 6)
-			|| !memcmp(psta->hwaddr, null_addr, 6)
-			|| !memcmp(psta->hwaddr, bc_addr, 6)
-		)
-		{
+		if (!memcmp(psta->hwaddr, &skb->data[6], 6) ||
+		    !memcmp(psta->hwaddr, null_addr, 6) ||
+		    !memcmp(psta->hwaddr, bc_addr, 6)) {
 			DBG_COUNTER(padapter->tx_logs.os_tx_m2u_ignore_self);
 			continue;
 		}
@@ -248,14 +241,11 @@ int _rtw_xmit_entry(_pkt *pkt, _nic_hdl pnetdev)
 			|| is_broadcast_mac_addr(pkt->data)
 			#endif
 			)
-		&& (padapter->registrypriv.wifi_spec == 0)
-		)
-	{
+		&& padapter->registrypriv.wifi_spec == 0) {
 		if (pxmitpriv->free_xmitframe_cnt > (NR_XMITFRAME/4)) {
 			res = rtw_mlcst2unicst(padapter, pkt);
-			if (res == true) {
+			if (res == true)
 				goto exit;
-			}
 		} else {
 			/* DBG_871X("Stop M2U(%d, %d)! ", pxmitpriv->free_xmitframe_cnt, pxmitpriv->free_xmitbuf_cnt); */
 			/* DBG_871X("!m2u); */
-- 
2.7.4



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

* Re: [Outreachy kernel] [PATCH v3] staging: rtl8723bs: clean up conditionals
  2018-02-18  7:26 [PATCH v3] staging: rtl8723bs: clean up conditionals Dafna Hirschfeld
@ 2018-02-18 13:00 ` Julia Lawall
  2018-02-18 16:24   ` Dafna Hirschfeld
  0 siblings, 1 reply; 4+ messages in thread
From: Julia Lawall @ 2018-02-18 13:00 UTC (permalink / raw)
  To: Dafna Hirschfeld; +Cc: gregkh, outreachy-kernel



On Sun, 18 Feb 2018, Dafna Hirschfeld wrote:

> Move all closing braces and parentheses to the end of the line.
> Remove braces from 'if' statements with a single 'then' line.
> Move logical operators to the end of lines in multiline conditional.
> Remove unnecessary parentheses.
> Issues found with checkpatch.pl
>
> Signed-off-by: Dafna Hirschfeld <dafna3@gmail.com>
> ---
> Changes in v2:
> - Fix commit body spelling and lines

Since this is v3, you need to explain what has changed in v3.

julia

>
>  drivers/staging/rtl8723bs/os_dep/xmit_linux.c | 24 +++++++-----------------
>  1 file changed, 7 insertions(+), 17 deletions(-)
>
> diff --git a/drivers/staging/rtl8723bs/os_dep/xmit_linux.c b/drivers/staging/rtl8723bs/os_dep/xmit_linux.c
> index f29e110..21e1b81 100644
> --- a/drivers/staging/rtl8723bs/os_dep/xmit_linux.c
> +++ b/drivers/staging/rtl8723bs/os_dep/xmit_linux.c
> @@ -64,9 +64,7 @@ int rtw_os_xmit_resource_alloc(struct adapter *padapter, struct xmit_buf *pxmitb
>  	if (alloc_sz > 0) {
>  		pxmitbuf->pallocated_buf = rtw_zmalloc(alloc_sz);
>  		if (pxmitbuf->pallocated_buf == NULL)
> -		{
>  			return _FAIL;
> -		}
>
>  		pxmitbuf->pbuf = (u8 *)N_BYTE_ALIGMENT((SIZE_PTR)(pxmitbuf->pallocated_buf), XMITBUF_ALIGN_SZ);
>  	}
> @@ -90,10 +88,8 @@ void rtw_os_pkt_complete(struct adapter *padapter, _pkt *pkt)
>  	queue = skb_get_queue_mapping(pkt);
>  	if (padapter->registrypriv.wifi_spec) {
>  		if (__netif_subqueue_stopped(padapter->pnetdev, queue) &&
> -			(pxmitpriv->hwxmits[queue].accnt < WMM_XMIT_THRESHOLD))
> -		{
> +		    (pxmitpriv->hwxmits[queue].accnt < WMM_XMIT_THRESHOLD))
>  			netif_wake_subqueue(padapter->pnetdev, queue);
> -		}
>  	} else {
>  		if (__netif_subqueue_stopped(padapter->pnetdev, queue))
>  			netif_wake_subqueue(padapter->pnetdev, queue);
> @@ -177,18 +173,15 @@ static int rtw_mlcst2unicst(struct adapter *padapter, struct sk_buff *skb)
>
>  	for (i = 0; i < chk_alive_num; i++) {
>  		psta = rtw_get_stainfo_by_offset(pstapriv, chk_alive_list[i]);
> -		if (!(psta->state & _FW_LINKED))
> -		{
> +		if (!(psta->state & _FW_LINKED)) {
>  			DBG_COUNTER(padapter->tx_logs.os_tx_m2u_ignore_fw_linked);
>  			continue;
>  		}
>
>  		/* avoid come from STA1 and send back STA1 */
> -		if (!memcmp(psta->hwaddr, &skb->data[6], 6)
> -			|| !memcmp(psta->hwaddr, null_addr, 6)
> -			|| !memcmp(psta->hwaddr, bc_addr, 6)
> -		)
> -		{
> +		if (!memcmp(psta->hwaddr, &skb->data[6], 6) ||
> +		    !memcmp(psta->hwaddr, null_addr, 6) ||
> +		    !memcmp(psta->hwaddr, bc_addr, 6)) {
>  			DBG_COUNTER(padapter->tx_logs.os_tx_m2u_ignore_self);
>  			continue;
>  		}
> @@ -248,14 +241,11 @@ int _rtw_xmit_entry(_pkt *pkt, _nic_hdl pnetdev)
>  			|| is_broadcast_mac_addr(pkt->data)
>  			#endif
>  			)
> -		&& (padapter->registrypriv.wifi_spec == 0)
> -		)
> -	{
> +		&& padapter->registrypriv.wifi_spec == 0) {
>  		if (pxmitpriv->free_xmitframe_cnt > (NR_XMITFRAME/4)) {
>  			res = rtw_mlcst2unicst(padapter, pkt);
> -			if (res == true) {
> +			if (res == true)
>  				goto exit;
> -			}
>  		} else {
>  			/* DBG_871X("Stop M2U(%d, %d)! ", pxmitpriv->free_xmitframe_cnt, pxmitpriv->free_xmitbuf_cnt); */
>  			/* DBG_871X("!m2u); */
> --
> 2.7.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/20180218072644.GA18258%40gmail.com.
> For more options, visit https://groups.google.com/d/optout.
>


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

* Re: [Outreachy kernel] [PATCH v3] staging: rtl8723bs: clean up conditionals
  2018-02-18 13:00 ` [Outreachy kernel] " Julia Lawall
@ 2018-02-18 16:24   ` Dafna Hirschfeld
  2018-02-18 16:27     ` Julia Lawall
  0 siblings, 1 reply; 4+ messages in thread
From: Dafna Hirschfeld @ 2018-02-18 16:24 UTC (permalink / raw)
  To: Julia Lawall; +Cc: outreachy-kernel

On Sun, Feb 18, 2018 at 02:00:59PM +0100, Julia Lawall wrote:
> 
> 
> On Sun, 18 Feb 2018, Dafna Hirschfeld wrote:
> 
> > Move all closing braces and parentheses to the end of the line.
> > Remove braces from 'if' statements with a single 'then' line.
> > Move logical operators to the end of lines in multiline conditional.
> > Remove unnecessary parentheses.
> > Issues found with checkpatch.pl
> >
> > Signed-off-by: Dafna Hirschfeld <dafna3@gmail.com>
> > ---
> > Changes in v2:
> > - Fix commit body spelling and lines
> 
> Since this is v3, you need to explain what has changed in v3.
> 
> julia
Hi, it's a mistake, I had to write "Changes in v3", but the description does
describe the changes in v3.
>
> >
> >  drivers/staging/rtl8723bs/os_dep/xmit_linux.c | 24 +++++++-----------------
> >  1 file changed, 7 insertions(+), 17 deletions(-)
> >
> > diff --git a/drivers/staging/rtl8723bs/os_dep/xmit_linux.c b/drivers/staging/rtl8723bs/os_dep/xmit_linux.c
> > index f29e110..21e1b81 100644
> > --- a/drivers/staging/rtl8723bs/os_dep/xmit_linux.c
> > +++ b/drivers/staging/rtl8723bs/os_dep/xmit_linux.c
> > @@ -64,9 +64,7 @@ int rtw_os_xmit_resource_alloc(struct adapter *padapter, struct xmit_buf *pxmitb
> >  	if (alloc_sz > 0) {
> >  		pxmitbuf->pallocated_buf = rtw_zmalloc(alloc_sz);
> >  		if (pxmitbuf->pallocated_buf == NULL)
> > -		{
> >  			return _FAIL;
> > -		}
> >
> >  		pxmitbuf->pbuf = (u8 *)N_BYTE_ALIGMENT((SIZE_PTR)(pxmitbuf->pallocated_buf), XMITBUF_ALIGN_SZ);
> >  	}
> > @@ -90,10 +88,8 @@ void rtw_os_pkt_complete(struct adapter *padapter, _pkt *pkt)
> >  	queue = skb_get_queue_mapping(pkt);
> >  	if (padapter->registrypriv.wifi_spec) {
> >  		if (__netif_subqueue_stopped(padapter->pnetdev, queue) &&
> > -			(pxmitpriv->hwxmits[queue].accnt < WMM_XMIT_THRESHOLD))
> > -		{
> > +		    (pxmitpriv->hwxmits[queue].accnt < WMM_XMIT_THRESHOLD))
> >  			netif_wake_subqueue(padapter->pnetdev, queue);
> > -		}
> >  	} else {
> >  		if (__netif_subqueue_stopped(padapter->pnetdev, queue))
> >  			netif_wake_subqueue(padapter->pnetdev, queue);
> > @@ -177,18 +173,15 @@ static int rtw_mlcst2unicst(struct adapter *padapter, struct sk_buff *skb)
> >
> >  	for (i = 0; i < chk_alive_num; i++) {
> >  		psta = rtw_get_stainfo_by_offset(pstapriv, chk_alive_list[i]);
> > -		if (!(psta->state & _FW_LINKED))
> > -		{
> > +		if (!(psta->state & _FW_LINKED)) {
> >  			DBG_COUNTER(padapter->tx_logs.os_tx_m2u_ignore_fw_linked);
> >  			continue;
> >  		}
> >
> >  		/* avoid come from STA1 and send back STA1 */
> > -		if (!memcmp(psta->hwaddr, &skb->data[6], 6)
> > -			|| !memcmp(psta->hwaddr, null_addr, 6)
> > -			|| !memcmp(psta->hwaddr, bc_addr, 6)
> > -		)
> > -		{
> > +		if (!memcmp(psta->hwaddr, &skb->data[6], 6) ||
> > +		    !memcmp(psta->hwaddr, null_addr, 6) ||
> > +		    !memcmp(psta->hwaddr, bc_addr, 6)) {
> >  			DBG_COUNTER(padapter->tx_logs.os_tx_m2u_ignore_self);
> >  			continue;
> >  		}
> > @@ -248,14 +241,11 @@ int _rtw_xmit_entry(_pkt *pkt, _nic_hdl pnetdev)
> >  			|| is_broadcast_mac_addr(pkt->data)
> >  			#endif
> >  			)
> > -		&& (padapter->registrypriv.wifi_spec == 0)
> > -		)
> > -	{
> > +		&& padapter->registrypriv.wifi_spec == 0) {
> >  		if (pxmitpriv->free_xmitframe_cnt > (NR_XMITFRAME/4)) {
> >  			res = rtw_mlcst2unicst(padapter, pkt);
> > -			if (res == true) {
> > +			if (res == true)
> >  				goto exit;
> > -			}
> >  		} else {
> >  			/* DBG_871X("Stop M2U(%d, %d)! ", pxmitpriv->free_xmitframe_cnt, pxmitpriv->free_xmitbuf_cnt); */
> >  			/* DBG_871X("!m2u); */
> > --
> > 2.7.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/20180218072644.GA18258%40gmail.com.
> > For more options, visit https://groups.google.com/d/optout.
> >


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

* Re: [Outreachy kernel] [PATCH v3] staging: rtl8723bs: clean up conditionals
  2018-02-18 16:24   ` Dafna Hirschfeld
@ 2018-02-18 16:27     ` Julia Lawall
  0 siblings, 0 replies; 4+ messages in thread
From: Julia Lawall @ 2018-02-18 16:27 UTC (permalink / raw)
  To: Dafna Hirschfeld; +Cc: outreachy-kernel



On Sun, 18 Feb 2018, Dafna Hirschfeld wrote:

> On Sun, Feb 18, 2018 at 02:00:59PM +0100, Julia Lawall wrote:
> >
> >
> > On Sun, 18 Feb 2018, Dafna Hirschfeld wrote:
> >
> > > Move all closing braces and parentheses to the end of the line.
> > > Remove braces from 'if' statements with a single 'then' line.
> > > Move logical operators to the end of lines in multiline conditional.
> > > Remove unnecessary parentheses.
> > > Issues found with checkpatch.pl
> > >
> > > Signed-off-by: Dafna Hirschfeld <dafna3@gmail.com>
> > > ---
> > > Changes in v2:
> > > - Fix commit body spelling and lines
> >
> > Since this is v3, you need to explain what has changed in v3.
> >
> > julia
> Hi, it's a mistake, I had to write "Changes in v3", but the description does
> describe the changes in v3.

OK, to avoid confusion for Greg when he will apply your patch sometime in
the future, could you send a v4 with a v4 description under the ---.  Then
everything will be coherent.

thanks,
julia

> >
> > >
> > >  drivers/staging/rtl8723bs/os_dep/xmit_linux.c | 24 +++++++-----------------
> > >  1 file changed, 7 insertions(+), 17 deletions(-)
> > >
> > > diff --git a/drivers/staging/rtl8723bs/os_dep/xmit_linux.c b/drivers/staging/rtl8723bs/os_dep/xmit_linux.c
> > > index f29e110..21e1b81 100644
> > > --- a/drivers/staging/rtl8723bs/os_dep/xmit_linux.c
> > > +++ b/drivers/staging/rtl8723bs/os_dep/xmit_linux.c
> > > @@ -64,9 +64,7 @@ int rtw_os_xmit_resource_alloc(struct adapter *padapter, struct xmit_buf *pxmitb
> > >  	if (alloc_sz > 0) {
> > >  		pxmitbuf->pallocated_buf = rtw_zmalloc(alloc_sz);
> > >  		if (pxmitbuf->pallocated_buf == NULL)
> > > -		{
> > >  			return _FAIL;
> > > -		}
> > >
> > >  		pxmitbuf->pbuf = (u8 *)N_BYTE_ALIGMENT((SIZE_PTR)(pxmitbuf->pallocated_buf), XMITBUF_ALIGN_SZ);
> > >  	}
> > > @@ -90,10 +88,8 @@ void rtw_os_pkt_complete(struct adapter *padapter, _pkt *pkt)
> > >  	queue = skb_get_queue_mapping(pkt);
> > >  	if (padapter->registrypriv.wifi_spec) {
> > >  		if (__netif_subqueue_stopped(padapter->pnetdev, queue) &&
> > > -			(pxmitpriv->hwxmits[queue].accnt < WMM_XMIT_THRESHOLD))
> > > -		{
> > > +		    (pxmitpriv->hwxmits[queue].accnt < WMM_XMIT_THRESHOLD))
> > >  			netif_wake_subqueue(padapter->pnetdev, queue);
> > > -		}
> > >  	} else {
> > >  		if (__netif_subqueue_stopped(padapter->pnetdev, queue))
> > >  			netif_wake_subqueue(padapter->pnetdev, queue);
> > > @@ -177,18 +173,15 @@ static int rtw_mlcst2unicst(struct adapter *padapter, struct sk_buff *skb)
> > >
> > >  	for (i = 0; i < chk_alive_num; i++) {
> > >  		psta = rtw_get_stainfo_by_offset(pstapriv, chk_alive_list[i]);
> > > -		if (!(psta->state & _FW_LINKED))
> > > -		{
> > > +		if (!(psta->state & _FW_LINKED)) {
> > >  			DBG_COUNTER(padapter->tx_logs.os_tx_m2u_ignore_fw_linked);
> > >  			continue;
> > >  		}
> > >
> > >  		/* avoid come from STA1 and send back STA1 */
> > > -		if (!memcmp(psta->hwaddr, &skb->data[6], 6)
> > > -			|| !memcmp(psta->hwaddr, null_addr, 6)
> > > -			|| !memcmp(psta->hwaddr, bc_addr, 6)
> > > -		)
> > > -		{
> > > +		if (!memcmp(psta->hwaddr, &skb->data[6], 6) ||
> > > +		    !memcmp(psta->hwaddr, null_addr, 6) ||
> > > +		    !memcmp(psta->hwaddr, bc_addr, 6)) {
> > >  			DBG_COUNTER(padapter->tx_logs.os_tx_m2u_ignore_self);
> > >  			continue;
> > >  		}
> > > @@ -248,14 +241,11 @@ int _rtw_xmit_entry(_pkt *pkt, _nic_hdl pnetdev)
> > >  			|| is_broadcast_mac_addr(pkt->data)
> > >  			#endif
> > >  			)
> > > -		&& (padapter->registrypriv.wifi_spec == 0)
> > > -		)
> > > -	{
> > > +		&& padapter->registrypriv.wifi_spec == 0) {
> > >  		if (pxmitpriv->free_xmitframe_cnt > (NR_XMITFRAME/4)) {
> > >  			res = rtw_mlcst2unicst(padapter, pkt);
> > > -			if (res == true) {
> > > +			if (res == true)
> > >  				goto exit;
> > > -			}
> > >  		} else {
> > >  			/* DBG_871X("Stop M2U(%d, %d)! ", pxmitpriv->free_xmitframe_cnt, pxmitpriv->free_xmitbuf_cnt); */
> > >  			/* DBG_871X("!m2u); */
> > > --
> > > 2.7.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/20180218072644.GA18258%40gmail.com.
> > > For more options, visit https://groups.google.com/d/optout.
> > >
>
> --
> 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/20180218162431.GA11471%40gmail.com.
> For more options, visit https://groups.google.com/d/optout.
>


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

end of thread, other threads:[~2018-02-18 16:27 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2018-02-18  7:26 [PATCH v3] staging: rtl8723bs: clean up conditionals Dafna Hirschfeld
2018-02-18 13:00 ` [Outreachy kernel] " Julia Lawall
2018-02-18 16:24   ` Dafna Hirschfeld
2018-02-18 16:27     ` 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.