staging: rtl8712: coding style issues
cover staging: rtl8712: coding style issues
This patchset removes parentheses around a member element before the '&' symbol as it is not necessary. It also renames a variable from camelcase to underscore notation to align more with the Linux kernel coding style. Lastly the patchset reworks an if statement to prevent it from comparing to an arbitrary "true" value.
Branden Bonaby (3):
staging: rtl8712: remove unnecessary parentheses
staging: rtl8712: rename variable to avoid camelcase
staging: rtl8712: Remove comparison to true
drivers/staging/rtl8712/rtl8712_xmit.c | 24 ++++++++++++------------ 1 file changed, 12 insertions(+), 12 deletions(-)
Signature · 1 line
2.17.1
PATCH 1/3 staging: rtl8712: remove unnecessary parentheses
Remove unnecessary parentheses in rtl8712_xmit.c.
Reported by checkpatch.
--- drivers/staging/rtl8712/rtl8712_xmit.c | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-)
drivers/staging/rtl8712/rtl8712_xmit.c +5 -5
@@ -60,20 +60,20 @@ int r8712_txframes_sta_ac_pending(struct _adapter *padapter,switch (priority) {case 1 :case 2 : - ptxservq = &(psta->sta_xmitpriv.bk_q); + ptxservq = &psta->sta_xmitpriv.bk_q;break ;case 4 :case 5 : - ptxservq = &(psta->sta_xmitpriv.vi_q); + ptxservq = &psta->sta_xmitpriv.vi_q;break ;case 6 :case 7 : - ptxservq = &(psta->sta_xmitpriv.vo_q); + ptxservq = &psta->sta_xmitpriv.vo_q;break ;case 0 :case 3 :default : - ptxservq = &(psta->sta_xmitpriv.be_q); + ptxservq = &psta->sta_xmitpriv.be_q;break ; }return ptxservq->qcnt;
@@ -269,7 +269,7 @@ u8 r8712_construct_txaggr_cmd_hdr(struct xmit_buf *pxmitbuf)struct xmit_frame *pxmitframe = (struct xmit_frame *) pxmitbuf->priv_data;struct _adapter *padapter = pxmitframe->padapter; -struct cmd_priv *pcmdpriv = &(padapter->cmdpriv); +struct cmd_priv *pcmdpriv = &padapter->cmdpriv;struct cmd_hdr *pcmd_hdr = (struct cmd_hdr *) (pxmitbuf->pbuf +TXDESC_SIZE );
Signature · 1 line
2.17.1
PATCH 2/3 staging: rtl8712: rename variable to avoid camelcase
In reply to Branden BonabyRename variable blnSetTxDescOffset to bln_set_tx_desc_offset to align with linux kernel coding style in rtl8712_xmit.c. The Warning was produced by checkpatch.pl.
--- drivers/staging/rtl8712/rtl8712_xmit.c | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-)
drivers/staging/rtl8712/rtl8712_xmit.c +6 -6
@@ -418,7 +418,7 @@ static void update_txdesc(struct xmit_frame *pxmitframe, uint *pmem, int sz)#ifdef CONFIG_R8712_TX_AGGR struct cmd_priv *pcmdpriv = &padapter->cmdpriv;#endif -u8 blnSetTxDescOffset; +u8 bln_set_tx_desc_offset;sint bmcst =IS_MCAST (pattrib->ra);struct ht_priv *phtpriv = &pmlmepriv->htpriv;struct tx_desc txdesc_mp;
@@ -429,16 +429,16 @@ static void update_txdesc(struct xmit_frame *pxmitframe, uint *pmem, int sz) ptxdesc->txdw0 |=cpu_to_le32 (sz &0x0000ffff );if (pdvobj->ishighspeed) {if (((sz +TXDESC_SIZE ) %512 ) ==0 ) - blnSetTxDescOffset =1 ; + bln_set_tx_desc_offset =1 ;else - blnSetTxDescOffset =0 ; + bln_set_tx_desc_offset =0 ; }else {if (((sz +TXDESC_SIZE ) %64 ) ==0 ) - blnSetTxDescOffset =1 ; + bln_set_tx_desc_offset =1 ;else - blnSetTxDescOffset =0 ; + bln_set_tx_desc_offset =0 ; } -if (blnSetTxDescOffset) { +if (bln_set_tx_desc_offset) {/* 32 bytes for TX Desc + 8 bytes pending */ ptxdesc->txdw0 |=cpu_to_le32 (((TXDESC_SIZE +OFFSET_SZ +8 ) <<OFFSET_SHT ) &0x00ff0000 );
Signature · 1 line
2.17.1
Re: [Outreachy kernel] [PATCH 2/3] staging: rtl8712: rename variable to avoid camelcase
Quoted 3 lines · Branden Bonaby
Rename variable blnSetTxDescOffset to
bln_set_tx_desc_offsetto align with linux kernel coding style inrtl8712_xmit.c. The Warning was produced by checkpatch.pl.
It looks like it is a boolean. You could add another patch to the series to change the type and to change the 1s and 0s to the corresponding boolean values.
julia
Quoted 51 lines
Signed-off-by Branden Bonaby <[email protected]>--- drivers/staging/rtl8712/rtl8712_xmit.c | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-)drivers/staging/rtl8712/rtl8712_xmit.c +6
-7@@ -418,7 +418,7 @@ static void update_txdesc(struct xmit_frame *pxmitframe, uint *pmem, int sz)#ifdef CONFIG_R8712_TX_AGGR struct cmd_priv *pcmdpriv = &padapter->cmdpriv;#endif -u8 blnSetTxDescOffset; +u8 bln_set_tx_desc_offset;sint bmcst =IS_MCAST (pattrib->ra);struct ht_priv *phtpriv = &pmlmepriv->htpriv;struct tx_desc txdesc_mp;@@ -429,16 +429,16 @@ static void update_txdesc(struct xmit_frame *pxmitframe, uint *pmem, int sz) ptxdesc->txdw0 |=cpu_to_le32 (sz &0x0000ffff );if (pdvobj->ishighspeed) {if (((sz +TXDESC_SIZE ) %512 ) ==0 ) - blnSetTxDescOffset =1 ; + bln_set_tx_desc_offset =1 ;else - blnSetTxDescOffset =0 ; + bln_set_tx_desc_offset =0 ; }else {if (((sz +TXDESC_SIZE ) %64 ) ==0 ) - blnSetTxDescOffset =1 ; + bln_set_tx_desc_offset =1 ;else - blnSetTxDescOffset =0 ; + bln_set_tx_desc_offset =0 ; } -if (blnSetTxDescOffset) { +if (bln_set_tx_desc_offset) {/* 32 bytes for TX Desc + 8 bytes pending */ ptxdesc->txdw0 |=cpu_to_le32 (((TXDESC_SIZE +OFFSET_SZ +8 ) <<OFFSET_SHT ) &0x00ff0000 ); --2.17.1
--
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/2de19725be83555d1f3983bf4ff7d9925ebd4f1c.1553619382.git.brandonbonaby94%40gmail.com.
For more options, visit https://groups.google.com/d/optout.
Greg KH
maintainerRe: [PATCH 2/3] staging: rtl8712: rename variable to avoid camelcase
In reply to Branden BonabyQuoted 2 lines · Branden Bonaby
Rename variable blnSetTxDescOffset to
bln_set_tx_desc_offsetto align with linux kernel coding style inrtl8712_xmit.c.
You can drop the "bln" prefix, it's not needed at all, this should just be "set_tx_desc_offet".
thanks,
greg k-h
PATCH 3/3 staging: rtl8712: Remove comparison to true
In reply to Branden BonabyRemove the comparison to true in the if statement.
CHECK: Using comparison to true is error prone.
--- drivers/staging/rtl8712/rtl8712_xmit.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/staging/rtl8712/rtl8712_xmit.c +1 -1
@@ -532,7 +532,7 @@ static void update_txdesc(struct xmit_frame *pxmitframe, uint *pmem, int sz) (pattrib->dhcp_pkt != 1)) { /*Not EAP & ARP type data packet*/ if (phtpriv->ht_option == 1) { /*B/G/N Mode*/ - if (phtpriv->ampdu_enable != true) + if (!phtpriv->ampdu_enable) ptxdesc->txdw2 |= cpu_to_le32(BK); } } else {
Signature · 1 line
2.17.1