Skip to contentSkip to conversation

staging/rtl8712: remove extra blank lines; fix code alignment

PATCH In review Elena Afanasova 4 participants 6 messages Oct 20, 2020 – Oct 27, 2020 Staging

lore
Share & tools
lore
#0 lore raw

PATCH 1/3 staging/rtl8712: remove extra blank lines; fix code alignment

Reported by checkpatch.pl

---
 drivers/staging/rtl8712/rtl871x_recv.h | 4 +---
 1 file changed, 1 insertion(+), 3 deletions(-)
drivers/staging/rtl8712/rtl871x_recv.h +1 -3
index e83c256e1474..57a965b9839b 100644
@@ -29,7 +29,6 @@ struct	stainfo_rxcache	{
 #define		PHY_RSSI_SLID_WIN_MAX			100
 #define		PHY_LINKQUALITY_SLID_WIN_MAX		20
 
-
 struct smooth_rssi_data {
 	u32	elements[100];	/* array to store values */
 	u32	index;		/* index to current array to store */
@@ -38,7 +37,6 @@ struct smooth_rssi_data {
 };
 
 struct rx_pkt_attrib {
-
 	u8	amsdu;
 	u8	order;
 	u8	qos;
@@ -129,7 +127,7 @@ union recv_frame *r8712_alloc_recvframe(struct  __queue *pfree_recv_queue);
 void r8712_free_recvframe(union recv_frame *precvframe,
 			  struct  __queue *pfree_recv_queue);
 void r8712_free_recvframe_queue(struct  __queue *pframequeue,
-				 struct  __queue *pfree_recv_queue);
+				struct  __queue *pfree_recv_queue);
 int r8712_wlanhdr_to_ethhdr(union recv_frame *precvframe);
 int recv_func(struct _adapter *padapter, void *pcontext);
 
Signature · 1 line
2.25.1
#1 lore raw

PATCH 2/3 staging/rtl8712: fix code style for comparison to NULL

Reported by checkpatch.pl

---
 drivers/staging/rtl8712/rtl871x_recv.h | 10 +++++-----
 1 file changed, 5 insertions(+), 5 deletions(-)
drivers/staging/rtl8712/rtl871x_recv.h +5 -5
index 57a965b9839b..d03859ca1697 100644
@@ -134,7 +134,7 @@ int recv_func(struct _adapter *padapter, void *pcontext);
 static inline u8 *get_rxmem(union recv_frame *precvframe)
 {
 	/* always return rx_head... */
-	if (precvframe == NULL)
+	if (!precvframe)
 		return NULL;
 	return precvframe->u.hdr.rx_head;
 }
@@ -142,7 +142,7 @@ static inline u8 *get_rxmem(union recv_frame *precvframe)
 static inline u8 *get_recvframe_data(union recv_frame *precvframe)
 {
 	/* always return rx_data */
-	if (precvframe == NULL)
+	if (!precvframe)
 		return NULL;
 	return precvframe->u.hdr.rx_data;
 }
@@ -152,7 +152,7 @@ static inline u8 *recvframe_pull(union recv_frame *precvframe, sint sz)
 	/* used for extract sz bytes from rx_data, update rx_data and return
 	 * the updated rx_data to the caller
 	 */
-	if (precvframe == NULL)
+	if (!precvframe)
 		return NULL;
 	precvframe->u.hdr.rx_data += sz;
 	if (precvframe->u.hdr.rx_data > precvframe->u.hdr.rx_tail) {
@@ -169,7 +169,7 @@ static inline u8 *recvframe_put(union recv_frame *precvframe, sint sz)
 	 * return the updated rx_tail to the caller
 	 * after putting, rx_tail must be still larger than rx_end.
 	 */
-	if (precvframe == NULL)
+	if (!precvframe)
 		return NULL;
 	precvframe->u.hdr.rx_tail += sz;
 	if (precvframe->u.hdr.rx_tail > precvframe->u.hdr.rx_end) {
@@ -187,7 +187,7 @@ static inline u8 *recvframe_pull_tail(union recv_frame *precvframe, sint sz)
 	 * updated rx_end to the caller
 	 * after pulling, rx_end must be still larger than rx_data.
 	 */
-	if (precvframe == NULL)
+	if (!precvframe)
 		return NULL;
 	precvframe->u.hdr.rx_tail -= sz;
 	if (precvframe->u.hdr.rx_tail < precvframe->u.hdr.rx_data) {
Signature · 1 line
2.25.1
#2 lore raw

PATCH 3/3 staging/rtl8712: use BIT macro

In reply to Elena Afanasova

Reported by checkpatch.pl

---
 drivers/staging/rtl8712/rtl871x_recv.h | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/staging/rtl8712/rtl871x_recv.h +1 -1
index d03859ca1697..2ed2d3edb312 100644
@@ -8,7 +8,7 @@
 #define NR_RECVFRAME 256
 
 #define RXFRAME_ALIGN	8
-#define RXFRAME_ALIGN_SZ	(1 << RXFRAME_ALIGN)
+#define RXFRAME_ALIGN_SZ	BIT(RXFRAME_ALIGN)
 
 #define MAX_SUBFRAME_COUNT	64
 
Signature · 1 line
2.25.1
#3 lore raw

Re: [Outreachy kernel] [PATCH 3/3] staging/rtl8712: use BIT macro

Quoted 1 line · Elena Afanasova

Reported by checkpatch.pl

Checkpatch is wrong.

Quoted 17 lines

+++ b/drivers/staging/rtl8712/rtl871x_recv.h

drivers/staging/rtl8712/rtl871x_recv.h +1 -1
@@ -8,7 +8,7 @@
 #define NR_RECVFRAME 256
 
 #define RXFRAME_ALIGN	8
-#define RXFRAME_ALIGN_SZ	(1 << RXFRAME_ALIGN)
+#define RXFRAME_ALIGN_SZ	BIT(RXFRAME_ALIGN)
 
 #define MAX_SUBFRAME_COUNT	64
 
Signature · 6 lines
2.25.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 view this discussion on the web visit https://groups.google.com/d/msgid/outreachy-kernel/20201020182439.43314-3-eafanasova%40gmail.com.
#5 lore raw
In reply to Elena Afanasova
Quoted 4 lines · Elena Afanasova

Reported by checkpatch.pl

This patch is fixing 2 different checkpatch warnings. They should be sent as separate patches. One for removing extra blank lines, another one for fixing the code alignment.

Quoted 40 lines
---
 drivers/staging/rtl8712/rtl871x_recv.h | 4 +---
 1 file changed, 1 insertion(+), 3 deletions(-)
drivers/staging/rtl8712/rtl871x_recv.h +1 -4
index e83c256e1474..57a965b9839b 100644
@@ -29,7 +29,6 @@ struct        stainfo_rxcache {
 #define                PHY_RSSI_SLID_WIN_MAX                   100
 #define                PHY_LINKQUALITY_SLID_WIN_MAX            20
 
-
 struct smooth_rssi_data {
        u32     elements[100];  /* array to store values */
        u32     index;          /* index to current array to store */
@@ -38,7 +37,6 @@ struct smooth_rssi_data {
 };
 
 struct rx_pkt_attrib {
-
        u8      amsdu;
        u8      order;
        u8      qos;
@@ -129,7 +127,7 @@ union recv_frame *r8712_alloc_recvframe(struct  __queue *pfree_recv_queue);
 void r8712_free_recvframe(union recv_frame *precvframe,
                          struct  __queue *pfree_recv_queue);
 void r8712_free_recvframe_queue(struct  __queue *pframequeue,
-                                struct  __queue *pfree_recv_queue);
+                               struct  __queue *pfree_recv_queue);
 int r8712_wlanhdr_to_ethhdr(union recv_frame *precvframe);
 int recv_func(struct _adapter *padapter, void *pcontext);
 
--

2.25.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 view this discussion on the web visit https://groups.google.com/d/msgid/outreachy-kernel/20201020182439.43314-1-eafanasova%40gmail.com.

Signature · 5 lines
Vaishali


-- 
Vaishali
#4 lore raw

Re: [Outreachy kernel] [PATCH 3/3] staging/rtl8712: use BIT macro

In reply to Matthew Wilcox
Quoted 5 lines · Matthew Wilcox
Quoted 1 line · Elena Afanasova

Reported by checkpatch.pl

Checkpatch is wrong.

Quoted 7 lines

drivers/staging/rtl8712/rtl871x_recv.h line 11

Quoted 7 lines

+++ b/drivers/staging/rtl8712/rtl871x_recv.h

drivers/staging/rtl8712/rtl871x_recv.h +1 -1
@@ -8,7 +8,7 @@
 #define NR_RECVFRAME 256
 
 #define RXFRAME_ALIGN	8
-#define RXFRAME_ALIGN_SZ	(1 << RXFRAME_ALIGN)
+#define RXFRAME_ALIGN_SZ	BIT(RXFRAME_ALIGN)

Yeah. It's weird to talk about size as a BIT() flag. The RXFRAME_ALIGN is not needed. Just say:

-#define RXFRAME_ALIGN 8
-#define RXFRAME_ALIGN_SZ (1 << RXFRAME_ALIGN)
+#define RXFRAME_ALIGN_SZ 256

This is literally used for aligning the RX frame. It seems like a crazy thing to me that to aligned at 256 bytes. I would have expected 64 bit alignment or page alignment but not 256 byte alignment... Weird.

regards,
dan carpenter