Skip to contentSkip to conversation

Staging: rtl8188eu: Lines over 80 characters fixed.

PATCH Superseded Adrian Remonda 3 participants 4 messages Aug 7, 2014 – Aug 10, 2014 Staging

v2 of 3 Superseded Latest is v3 →

lore
Share & tools
lore
#0 lore raw

PATCH v2 1/2 Staging: rtl8188eu: Lines over 80 characters fixed.

This is a patch to the hal/rtl8188eu_recv.c file that fixes up a "line over 80 characters" warning found by the checkpatch.pl tool.

---
 drivers/staging/rtl8188eu/hal/rtl8188eu_recv.c | 28 +++++++++++++++++---------
 1 file changed, 18 insertions(+), 10 deletions(-)
drivers/staging/rtl8188eu/hal/rtl8188eu_recv.c +18 -10
index f25c87c..8be4819 100644
@@ -41,15 +41,19 @@ int	rtl8188eu_init_recv_priv(struct adapter *padapter)
 	/* init recv_buf */
 	_rtw_init_queue(&precvpriv->free_recv_buf_queue);
 
-	precvpriv->pallocated_recv_buf = kzalloc(NR_RECVBUFF * sizeof(struct recv_buf) + 4, GFP_KERNEL);
+	precvpriv->pallocated_recv_buf =
+		kzalloc(NR_RECVBUFF * sizeof(struct recv_buf) + 4, GFP_KERNEL);
 	if (precvpriv->pallocated_recv_buf == NULL) {
 		res = _FAIL;
-		RT_TRACE(_module_rtl871x_recv_c_, _drv_err_, ("alloc recv_buf fail!\n"));
+		RT_TRACE(_module_rtl871x_recv_c_, _drv_err_,
+				("alloc recv_buf fail!\n"));
 		goto exit;
 	}
-	memset(precvpriv->pallocated_recv_buf, 0, NR_RECVBUFF * sizeof(struct recv_buf) + 4);
+	memset(precvpriv->pallocated_recv_buf, 0,
+			NR_RECVBUFF * sizeof(struct recv_buf) + 4);
 
-	precvpriv->precv_buf = (u8 *)N_BYTE_ALIGMENT((size_t)(precvpriv->pallocated_recv_buf), 4);
+	precvpriv->precv_buf = (u8 *)N_BYTE_ALIGMENT((size_t)
+			(precvpriv->pallocated_recv_buf), 4);
 
 
 	precvbuf = (struct recv_buf *)precvpriv->precv_buf;
@@ -66,20 +70,23 @@ int	rtl8188eu_init_recv_priv(struct adapter *padapter)
 	{
 		int i;
 		size_t tmpaddr = 0;
-		size_t alignment = 0;
+		size_t alignm = 0;
 		struct sk_buff *pskb = NULL;
 
 		skb_queue_head_init(&precvpriv->free_recv_skb_queue);
 
 		for (i = 0; i < NR_PREALLOC_RECV_SKB; i++) {
-			pskb = __netdev_alloc_skb(padapter->pnetdev, MAX_RECVBUF_SZ + RECVBUFF_ALIGN_SZ, GFP_KERNEL);
+			pskb = __netdev_alloc_skb(padapter->pnetdev,
+					MAX_RECVBUF_SZ + RECVBUFF_ALIGN_SZ,
+					GFP_KERNEL);
 			if (pskb) {
 				pskb->dev = padapter->pnetdev;
 				tmpaddr = (size_t)pskb->data;
-				alignment = tmpaddr & (RECVBUFF_ALIGN_SZ-1);
-				skb_reserve(pskb, (RECVBUFF_ALIGN_SZ - alignment));
+				alignm = tmpaddr & (RECVBUFF_ALIGN_SZ-1);
+				skb_reserve(pskb, (RECVBUFF_ALIGN_SZ - alignm));
 
-				skb_queue_tail(&precvpriv->free_recv_skb_queue, pskb);
+				skb_queue_tail(&precvpriv->free_recv_skb_queue,
+						pskb);
 			}
 			pskb = NULL;
 		}
@@ -109,7 +116,8 @@ void rtl8188eu_free_recv_priv(struct adapter *padapter)
 
 
 	if (skb_queue_len(&precvpriv->free_recv_skb_queue))
-		DBG_88E(KERN_WARNING "free_recv_skb_queue not empty, %d\n", skb_queue_len(&precvpriv->free_recv_skb_queue));
+		DBG_88E(KERN_WARNING "free_recv_skb_queue not empty, %d\n",
+				skb_queue_len(&precvpriv->free_recv_skb_queue));
 
 	skb_queue_purge(&precvpriv->free_recv_skb_queue);
 }
Signature · 1 line
2.0.4
#1 lore raw

PATCH v2 2/2 Staging: rtl8188eu: Removed unnecessarry code.

This patch clear some code that was not doing any help. Pointed out by Larry.Finger

---
 drivers/staging/rtl8188eu/hal/rtl8188eu_recv.c | 7 ++-----
 1 file changed, 2 insertions(+), 5 deletions(-)
drivers/staging/rtl8188eu/hal/rtl8188eu_recv.c +2 -5
index 8be4819..bc275b2 100644
@@ -42,18 +42,15 @@ int	rtl8188eu_init_recv_priv(struct adapter *padapter)
 	_rtw_init_queue(&precvpriv->free_recv_buf_queue);
 
 	precvpriv->pallocated_recv_buf =
-		kzalloc(NR_RECVBUFF * sizeof(struct recv_buf) + 4, GFP_KERNEL);
+		kzalloc(NR_RECVBUFF * sizeof(struct recv_buf), GFP_KERNEL);
 	if (precvpriv->pallocated_recv_buf == NULL) {
 		res = _FAIL;
 		RT_TRACE(_module_rtl871x_recv_c_, _drv_err_,
 				("alloc recv_buf fail!\n"));
 		goto exit;
 	}
-	memset(precvpriv->pallocated_recv_buf, 0,
-			NR_RECVBUFF * sizeof(struct recv_buf) + 4);
 
-	precvpriv->precv_buf = (u8 *)N_BYTE_ALIGMENT((size_t)
-			(precvpriv->pallocated_recv_buf), 4);
+	precvpriv->precv_buf = precvpriv->pallocated_recv_buf;
 
 
 	precvbuf = (struct recv_buf *)precvpriv->precv_buf;
Signature · 1 line
2.0.4
#2 lore raw

Re: [PATCHv2 2/2] Staging: rtl8188eu: Removed unnecessarry code.

Quoted 3 lines · Adrian Remonda

This patch clear some code that was not doing any help. Pointed out by Larry.Finger

The patch is fine but the changelog doesn't inpsire confidence. It should say:

This patch removes some unneeded code.
1) kzalloc() allocates 4 extra bytes so that we can align the return value. But actually the return value is already aligned so we can remove the + 4 and the call to N_BYTE_ALIGMENT().
2) The memset() isn't needed because kzalloc() zeroes the allocation.

regards,
dan carpenter

maintainer
#3 lore raw

Re: [PATCHv2 2/2] Staging: rtl8188eu: Removed unnecessarry code.

Quoted 8 lines · Dan Carpenter
Quoted 3 lines · Adrian Remonda

This patch clear some code that was not doing any help. Pointed out by Larry.Finger

The patch is fine but the changelog doesn't inpsire confidence. It should say:

Quoted 7 lines

This patch removes some unneeded code.
1) kzalloc() allocates 4 extra bytes so that we can align the return value. But actually the return value is already aligned so we can remove the + 4 and the call to N_BYTE_ALIGMENT().
2) The memset() isn't needed because kzalloc() zeroes the allocation.

Adrian, can you please fix this up and resend the series based on Dan's comments?

thanks,

greg k-h