Skip to contentSkip to conversation

staging: r8188eu: Fixed some coding style issues

PATCH In review Chang Yu 3 participants 8 messages Jun 22, 2022 Staging

lore
Share & tools
lore

Chang Yu

author
#0 lore raw

cover staging: r8188eu: Fixed some coding style issues

Fixed a few coding style issues as per checkpatch.pl and kernel coding style guidelines.

Chang Yu (5):
staging: r8188eu: Fixed a function declaration coding style issue
staging: r8188eu: Fixed two brace coding style issues
staging: r8188eu: Fixed two whitespace coding style issues
staging: r8188eu: Fixed comment style
staging: r8188eu: Fixed some blank line coding style issues

 drivers/staging/r8188eu/core/rtw_recv.c | 38 +++++++++++++++----------
 1 file changed, 23 insertions(+), 15 deletions(-)
Signature · 1 line
2.36.1
author
#1 lore raw

PATCH 1/5 staging: r8188eu: Fixed a function declaration coding style issue

Added an identifier name for function definition argument 'struct timer_list *' as per checkpatch.pl

Note that for the same line checkpatch.pl will also complain "extern should be avoided in .c". I am not very familiar with the codebase so I decided not to move the declaration to a header file.

---
 drivers/staging/r8188eu/core/rtw_recv.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/staging/r8188eu/core/rtw_recv.c +1 -1
index 36ea79586992..7e2f5c2f9111 100644
@@ -24,7 +24,7 @@ static u8 rtw_rfc1042_header[] = {
        0xaa, 0xaa, 0x03, 0x00, 0x00, 0x00
 };
 
-void rtw_signal_stat_timer_hdl(struct timer_list *);
+void rtw_signal_stat_timer_hdl(struct timer_list *t);
 
 void _rtw_init_sta_recv_priv(struct sta_recv_priv *psta_recvpriv)
 {
Signature · 1 line
2.36.1
author
#3 lore raw

PATCH 2/5 staging: r8188eu: Fixed two brace coding style issues

In reply to Chang Yu

Removed two pairs of unnecessary curly braces as per checkpatch.pl

---
 drivers/staging/r8188eu/core/rtw_recv.c | 7 +++----
 1 file changed, 3 insertions(+), 4 deletions(-)
drivers/staging/r8188eu/core/rtw_recv.c +3 -4
index 7e2f5c2f9111..38b7905dc88f 100644
@@ -1365,13 +1365,12 @@ static int amsdu_to_msdu(struct adapter *padapter, struct recv_frame *prframe)
 		a_len -= nSubframe_Length;
 		if (a_len != 0) {
 			padding_len = 4 - ((nSubframe_Length + ETH_HLEN) & (4 - 1));
-			if (padding_len == 4) {
+			if (padding_len == 4)
 				padding_len = 0;
-			}
 
-			if (a_len < padding_len) {
+			if (a_len < padding_len)
 				goto exit;
-			}
+
 			pdata += padding_len;
 			a_len -= padding_len;
 		}
Signature · 1 line
2.36.1
author
#4 lore raw

PATCH 3/5 staging: r8188eu: Fixed two whitespace coding style issues

In reply to Chang Yu

Replaced spaces with tabs as per checkpatch.pl

---
 drivers/staging/r8188eu/core/rtw_recv.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/staging/r8188eu/core/rtw_recv.c +2 -2
index 38b7905dc88f..d42ff210ee81 100644
@@ -17,11 +17,11 @@ static u8 SNAP_ETH_TYPE_APPLETALK_AARP[2] = {0x80, 0xf3};
 
 /* Bridge-Tunnel header (for EtherTypes ETH_P_AARP and ETH_P_IPX) */
 static u8 rtw_bridge_tunnel_header[] = {
-       0xaa, 0xaa, 0x03, 0x00, 0x00, 0xf8
+	0xaa, 0xaa, 0x03, 0x00, 0x00, 0xf8
 };
 
 static u8 rtw_rfc1042_header[] = {
-       0xaa, 0xaa, 0x03, 0x00, 0x00, 0x00
+	0xaa, 0xaa, 0x03, 0x00, 0x00, 0x00
 };
 
 void rtw_signal_stat_timer_hdl(struct timer_list *t);
Signature · 1 line
2.36.1
author
#5 lore raw

PATCH 4/5 staging: r8188eu: Fixed comment style

In reply to Chang Yu

Fixed block comments style as per checkpatch.pl and kernel coding style guide.

---
 drivers/staging/r8188eu/core/rtw_recv.c | 18 ++++++++++--------
 1 file changed, 10 insertions(+), 8 deletions(-)
drivers/staging/r8188eu/core/rtw_recv.c +10 -8
index d42ff210ee81..14dd2344fa4b 100644
@@ -204,12 +204,12 @@ int rtw_enqueue_recvframe(struct recv_frame *precvframe, struct __queue *queue)
 }
 
 /*
-caller : defrag ; recvframe_chk_defrag in recv_thread  (passive)
-pframequeue: defrag_queue : will be accessed in recv_thread  (passive)
-
-using spinlock to protect
-
-*/
+ * caller : defrag ; recvframe_chk_defrag in recv_thread  (passive)
+ * pframequeue: defrag_queue : will be accessed in recv_thread  (passive)
+ *
+ * using spinlock to protect
+ *
+ */
 
 void rtw_free_recvframe_queue(struct __queue *pframequeue,  struct __queue *pfree_recv_queue)
 {
@@ -1745,9 +1745,11 @@ static int recv_func(struct adapter *padapter, struct recv_frame *rframe)
 		     !psecuritypriv->busetkipkey) {
 			rtw_enqueue_recvframe(rframe, &padapter->recvpriv.uc_swdec_pending_queue);
 			if (recvpriv->free_recvframe_cnt < NR_RECVFRAME / 4) {
-				/* to prevent from recvframe starvation,
+				/*
+				 * to prevent from recvframe starvation,
 				 * get recvframe from uc_swdec_pending_queue to
-				 * free_recvframe_cnt  */
+				 * free_recvframe_cnt
+				 */
 				rframe = rtw_alloc_recvframe(&padapter->recvpriv.uc_swdec_pending_queue);
 				if (rframe)
 					goto do_posthandle;
Signature · 1 line
2.36.1
author
#6 lore raw

PATCH 5/5 staging: r8188eu: Fixed some blank line coding style issues

In reply to Chang Yu

Added blank lines after variable declarations as per checkpatch.pl

---
 drivers/staging/r8188eu/core/rtw_recv.c | 7 +++++++
 1 file changed, 7 insertions(+)
drivers/staging/r8188eu/core/rtw_recv.c +7 -0
index 14dd2344fa4b..cc91638a085d 100644
@@ -237,6 +237,7 @@ u32 rtw_free_uc_swdec_pending_queue(struct adapter *adapter)
 {
 	u32 cnt = 0;
 	struct recv_frame *pending_frame;
+
 	while ((pending_frame = rtw_alloc_recvframe(&adapter->recvpriv.uc_swdec_pending_queue))) {
 		rtw_free_recvframe(pending_frame, &adapter->recvpriv.free_recv_queue);
 		cnt++;
@@ -327,6 +328,7 @@ static struct recv_frame *decryptor(struct adapter *padapter, struct recv_frame
 
 	if (prxattrib->encrypt > 0) {
 		u8 *iv = precv_frame->rx_data + prxattrib->hdrlen;
+
 		prxattrib->key_index = (((iv[3]) >> 6) & 0x3);
 
 		if (prxattrib->key_index > WEP_KEYS) {
@@ -777,6 +779,7 @@ static int sta2ap_data_frame(struct adapter *adapter,
 		}
 	} else {
 		u8 *myhwaddr = myid(&adapter->eeprompriv);
+
 		if (memcmp(pattrib->ra, myhwaddr, ETH_ALEN)) {
 			ret = RTW_RX_HANDLED;
 			goto exit;
@@ -1022,6 +1025,7 @@ static int validate_recv_frame(struct adapter *adapter, struct recv_frame *precv
 
 	if (pmlmeext->sitesurvey_res.state == SCAN_PROCESS) {
 		int ch_set_idx = rtw_ch_set_search_ch(pmlmeext->channel_set, rtw_get_oper_ch(adapter));
+
 		if (ch_set_idx >= 0)
 			pmlmeext->channel_set[ch_set_idx].rx_count++;
 	}
@@ -1049,6 +1053,7 @@ static int validate_recv_frame(struct adapter *adapter, struct recv_frame *precv
 		retval = validate_recv_data_frame(adapter, precv_frame);
 		if (retval == _FAIL) {
 			struct recv_priv *precvpriv = &adapter->recvpriv;
+
 			precvpriv->rx_drop++;
 		}
 	}
@@ -1312,9 +1317,11 @@ static int amsdu_to_msdu(struct adapter *padapter, struct recv_frame *prframe)
 	struct rx_pkt_attrib *pattrib;
 	unsigned char *data_ptr;
 	struct sk_buff *sub_skb, *subframes[MAX_SUBFRAME_COUNT];
+
 	struct recv_priv *precvpriv = &padapter->recvpriv;
 	struct __queue *pfree_recv_queue = &precvpriv->free_recv_queue;
 	int	ret = _SUCCESS;
+
 	nr_subframes = 0;
 
 	pattrib = &prframe->attrib;
Signature · 1 line
2.36.1
Tested-by on the v1 series
#7 lore raw
In reply to Chang Yu
Quoted 10 lines · Chang Yu

Fixed a few coding style issues as per checkpatch.pl and kernel coding style guidelines.

Chang Yu (5):
staging: r8188eu: Fixed a function declaration coding style issue
staging: r8188eu: Fixed two brace coding style issues
staging: r8188eu: Fixed two whitespace coding style issues
staging: r8188eu: Fixed comment style
staging: r8188eu: Fixed some blank line coding style issues

Quoted 3 lines
  drivers/staging/r8188eu/core/rtw_recv.c | 38 +++++++++++++++----------
  1 file changed, 23 insertions(+), 15 deletions(-)
maintainer
#2 lore raw

Re: [PATCH 1/5] staging: r8188eu: Fixed a function declaration coding style issue

In reply to Chang Yu
Quoted 17 lines · Chang Yu

Added an identifier name for function definition argument 'struct timer_list *' as per checkpatch.pl

Note that for the same line checkpatch.pl will also complain "extern should be avoided in .c". I am not very familiar with the codebase so I decided not to move the declaration to a header file.

---
 drivers/staging/r8188eu/core/rtw_recv.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/staging/r8188eu/core/rtw_recv.c +0 -0
index 36ea79586992..7e2f5c2f9111 100644

drivers/staging/r8188eu/core/rtw_recv.c static u8 rtw_rfc1042_header[] = { · line 27

Quoted 5 lines
drivers/staging/r8188eu/core/rtw_recv.c +1 -1
@@ -24,7 +24,7 @@ static u8 rtw_rfc1042_header[] = {
        0xaa, 0xaa, 0x03, 0x00, 0x00, 0x00
 };
 
-void rtw_signal_stat_timer_hdl(struct timer_list *);
+void rtw_signal_stat_timer_hdl(struct timer_list *t);

This really should be a static function, not a global one like this. That is the correct fix to make, can you do that as an add-on patch?

thanks,

greg k-h