Skip to contentSkip to conversation

staging: rtl8712: rewrite comparisons and remove blank lines

PATCH Superseded Zhansaya Bagdauletkyzy 2 participants 5 messages Apr 6, 2021 Staging

v1 of 2 Superseded Latest is v2 →

lore
Share & tools
lore
#0 lore raw

cover staging: rtl8712: rewrite comparisons and remove blank lines

This patchset replaces NULL comparisons with boolean negation and removes extra blank lines after an open brace.

Zhansaya Bagdauletkyzy (2):
staging: rtl8712: Rewrite NULL comparisons
staging: rtl8712: Remove extra blank lines

 drivers/staging/rtl8712/rtl871x_io.h   |  1 -
 drivers/staging/rtl8712/rtl871x_mlme.h |  1 -
 drivers/staging/rtl8712/rtl871x_recv.h | 11 +++++------
 drivers/staging/rtl8712/sta_info.h     |  1 -
 4 files changed, 5 insertions(+), 9 deletions(-)
Signature · 1 line
2.25.1
#1 lore raw

PATCH 1/2 staging: rtl8712: Rewrite NULL comparisons

Replace NULL comparisons with boolean negation.
Reported by checkpatch.

---
 drivers/staging/rtl8712/rtl871x_recv.h | 10 +++++-----
 1 file changed, 5 insertions(+), 5 deletions(-)
drivers/staging/rtl8712/rtl871x_recv.h +5 -5
index 7c9995060a6f..4aa39f4f3b84 100644
@@ -135,7 +135,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;
 }
@@ -143,7 +143,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;
 }
@@ -153,7 +153,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) {
@@ -170,7 +170,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) {
@@ -188,7 +188,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

Re: [Outreachy kernel] [PATCH 1/2] staging: rtl8712: Rewrite NULL comparisons

Quoted 1 line · Zhansaya Bagdauletkyzy

Replace NULL comparisons with boolean negation.

This summarizes concisely what you did, which is helpful, but you could also say why. For example, to make the code more concise or to improve readability or for consistency with the rest of the code base.

julia

Quoted 64 lines

Reported by checkpatch.

---
 drivers/staging/rtl8712/rtl871x_recv.h | 10 +++++-----
 1 file changed, 5 insertions(+), 5 deletions(-)
drivers/staging/rtl8712/rtl871x_recv.h +5 -6
index 7c9995060a6f..4aa39f4f3b84 100644
@@ -135,7 +135,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;
 }
@@ -143,7 +143,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;
 }
@@ -153,7 +153,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) {
@@ -170,7 +170,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) {
@@ -188,7 +188,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) {
--

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/5d2db1d233030ececcdd4934ca9c46cb998c0c5b.1617705825.git.zhansayabagdaulet%40gmail.com.

#3 lore raw

Re: [Outreachy kernel] [PATCH 1/2] staging: rtl8712: Rewrite NULL comparisons

Quoted 77 lines · On Tuesday, April 6, 2021 at 4:59:01 PM UTC+6 [email protected] wrote:
Quoted 1 line · Zhansaya Bagdauletkyzy

Replace NULL comparisons with boolean negation.

This summarizes concisely what you did, which is helpful, but you could also say why. For example, to make the code more concise or to improve readability or for consistency with the rest of the code base.

julia

Review

Quoted 8 lines

Reported by checkpatch.

---
drivers/staging/rtl8712/rtl871x_recv.h | 10 +++++-----

1 file changed, 5 insertions(+), 5 deletions(-) 
(quoted diff) +0 -0

b/drivers/staging/rtl8712/rtl871x_recv.h

drivers/staging/rtl8712/rtl871x_recv.h int recv_func(struct _adapter *padapter, void

Quoted 4 lines

index 7c9995060a6f..4aa39f4f3b84 100644

drivers/staging/rtl8712/rtl871x_recv.h +0 -0
@@ -135,7 +135,7 @@ int recv_func(struct _adapter *padapter, void 

*pcontext);

drivers/staging/rtl8712/rtl871x_recv.h static inline u8 *get_rxmem(union recv_frame

Quoted 9 lines
drivers/staging/rtl8712/rtl871x_recv.h +1 -1
 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; 
 } 
@@ -143,7 +143,7 @@ static inline u8 *get_rxmem(union recv_frame 

*precvframe)

drivers/staging/rtl8712/rtl871x_recv.h static inline u8 *recvframe_pull(union recv_frame

Quoted 9 lines
drivers/staging/rtl8712/rtl871x_recv.h +1 -1
 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; 
 } 
@@ -153,7 +153,7 @@ static inline u8 *recvframe_pull(union recv_frame 

*precvframe, sint sz)

drivers/staging/rtl8712/rtl871x_recv.h static inline u8 *recvframe_put(union recv_frame

Quoted 9 lines
drivers/staging/rtl8712/rtl871x_recv.h +1 -1
 /* 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) { 
@@ -170,7 +170,7 @@ static inline u8 *recvframe_put(union recv_frame 

*precvframe, sint sz)

drivers/staging/rtl8712/rtl871x_recv.h static inline u8 *recvframe_pull_tail(union

Quoted 9 lines
drivers/staging/rtl8712/rtl871x_recv.h +1 -1
 * 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) { 
@@ -188,7 +188,7 @@ static inline u8 *recvframe_pull_tail(union 

recv_frame *precvframe, sint sz)

Quoted 11 lines
drivers/staging/rtl8712/rtl871x_recv.h +1 -1
 * 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 
Quoted 9 lines
Quoted 2 lines
Signature · 1 line
You received this message because you are subscribed to the Google 

Groups "outreachy-kernel" group.

Quoted 1 line

To unsubscribe from this group and stop receiving emails from it, send

an email to [email protected].

Quoted 1 line

To view this discussion on the web visit

https://groups.google.com/d/msgid/outreachy-kernel/5d2db1d233030ececcdd4934ca9c46cb998c0c5b.1617705825.git.zhansayabagdaulet%40gmail.com.

Quoted 1 line

Ok, I will resend it as V2. Thank you for your feedback.

#4 lore raw

PATCH 2/2 staging: rtl8712: Remove extra blank lines

In reply to Zhansaya Bagdauletkyzy

Remove extra blank lines after an open brace to adhere to Linux kernel coding style.
Reported by checkpatch.

---
 drivers/staging/rtl8712/rtl871x_io.h   | 1 -
 drivers/staging/rtl8712/rtl871x_mlme.h | 1 -
 drivers/staging/rtl8712/rtl871x_recv.h | 1 -
 drivers/staging/rtl8712/sta_info.h     | 1 -
 4 files changed, 4 deletions(-)
drivers/staging/rtl8712/rtl871x_io.h +0 -1
index c20dd5a6bbd1..c5b12f74ebf8 100644
@@ -123,7 +123,6 @@ struct	intf_hdl {
 };
 
 struct reg_protocol_rd {
-
 #ifdef __LITTLE_ENDIAN
 	/* DW1 */
 	u32		NumOfTrans:4;
drivers/staging/rtl8712/rtl871x_mlme.h +0 -1
index 46effb469fd4..d7d25f240111 100644
@@ -77,7 +77,6 @@ struct sitesurvey_ctrl {
 };
 
 struct mlme_priv {
-
 	spinlock_t lock;
 	spinlock_t lock2;
 	sint	fw_state;	/*shall we protect this variable? */
drivers/staging/rtl8712/rtl871x_recv.h +0 -1
index 4aa39f4f3b84..1c8298bde033 100644
@@ -37,7 +37,6 @@ struct smooth_rssi_data {
 };
 
 struct rx_pkt_attrib {
-
 	u8	amsdu;
 	u8	order;
 	u8	qos;
drivers/staging/rtl8712/sta_info.h +0 -1
index d042d900f30c..9b7e5ffa380d 100644
@@ -36,7 +36,6 @@ struct wlan_acl_pool {
 };
 
 struct	stainfo_stats {
-
 	uint	rx_pkts;
 	uint	rx_bytes;
 	u64	tx_pkts;
Signature · 1 line
2.25.1