Skip to contentSkip to conversation

staging: rtl8192e: rtllib_tx: code cleanup patches on the rtllib_tx.c file

PATCH In review Aaron Lawrence 2 participants 7 messages Oct 24, 2022 – Oct 25, 2022 Staging

lore
Share & tools
lore
#0 lore raw

cover staging: rtl8192e: rtllib_tx: code cleanup patches on the rtllib_tx.c file

Multiple patches regarding the cleanup of code in the rtllib_tx.c file. Fixes were applied according to the report generated by the checkpatch script on said file, aside from the CamelCase issues.

Aaron Lawrence (5):
Staging: rtl8192e: rtllib_tx: fixed multiple blank lines
Staging: rtl8192e: rtllib_tx: fixed alignment matching open
parenthesis
Staging: rtl8192e: rtllib_tx: added spaces around operators
Staging: rtl8192e: rtllib_tx: fixed lines ending with an open
parenthesis
Staging: rtl8192e: rtllib_tx: removed unnecessary blank line before a
close brace

 drivers/staging/rtl8192e/rtllib_tx.c | 42 ++++++++++++----------------
 1 file changed, 18 insertions(+), 24 deletions(-)
Signature · 1 line
2.38.1
#1 lore raw

PATCH 1/5 Staging: rtl8192e: rtllib_tx: fixed multiple blank lines

Multiple blank lines are condensed into a single blank line as per the Linux kernel coding-style regulations. The issues were flagged by the checkpatch script.

---
 drivers/staging/rtl8192e/rtllib_tx.c | 5 -----
 1 file changed, 5 deletions(-)
drivers/staging/rtl8192e/rtllib_tx.c +0 -5
index e307020580a0..abb5b57d142b 100644
@@ -191,7 +191,6 @@ int rtllib_encrypt_fragment(struct rtllib_device *ieee, struct sk_buff *frag,
 	return 0;
 }
 
-
 void rtllib_txb_free(struct rtllib_txb *txb)
 {
 	if (unlikely(!txb))
@@ -475,7 +474,6 @@ static void rtllib_query_protectionmode(struct rtllib_device *ieee,
 	tcb_desc->bRTSBW	= false;
 }
 
-
 static void rtllib_txrate_selectmode(struct rtllib_device *ieee,
 				     struct cb_desc *tcb_desc)
 {
@@ -582,7 +580,6 @@ static int rtllib_xmit_inter(struct sk_buff *skb, struct net_device *dev)
 		goto success;
 	}
 
-
 	if (likely(ieee->raw_tx == 0)) {
 		if (unlikely(skb->len < SNAP_SIZE + sizeof(u16))) {
 			netdev_warn(ieee->dev, "skb too small (%d).\n",
@@ -895,7 +892,6 @@ static int rtllib_xmit_inter(struct sk_buff *skb, struct net_device *dev)
 				tcb_desc->bTxDisableRateFallBack = 1;
 			}
 
-
 			tcb_desc->RATRIndex = 7;
 			tcb_desc->bTxUseDriverAssingedRate = 1;
 		} else {
@@ -920,7 +916,6 @@ static int rtllib_xmit_inter(struct sk_buff *skb, struct net_device *dev)
 					tcb_desc->bTxDisableRateFallBack = 1;
 				}
 
-
 				tcb_desc->RATRIndex = 7;
 				tcb_desc->bTxUseDriverAssingedRate = 1;
 				tcb_desc->bdhcp = 1;
Signature · 1 line
2.38.1
#2 lore raw

PATCH 2/5 Staging: rtl8192e: rtllib_tx: fixed alignment matching open parenthesis

In reply to Aaron Lawrence

Aligned multiple statements to match the open parenthesis on the line before it as per the Linux kernel coding-style regulations. The issues were flagged by the checkpatch script.

---
 drivers/staging/rtl8192e/rtllib_tx.c | 16 ++++++++--------
 1 file changed, 8 insertions(+), 8 deletions(-)
drivers/staging/rtl8192e/rtllib_tx.c +8 -8
index abb5b57d142b..38dfdcf99fec 100644
@@ -290,7 +290,7 @@ static void rtllib_tx_query_agg_cap(struct rtllib_device *ieee,
 		return;
 	if (pHTInfo->bCurrentAMPDUEnable) {
 		if (!GetTs(ieee, (struct ts_common_info **)(&pTxTs), hdr->addr1,
-		    skb->priority, TX_DIR, true)) {
+			   skb->priority, TX_DIR, true)) {
 			netdev_info(ieee->dev, "%s: can't get TS\n", __func__);
 			return;
 		}
@@ -306,7 +306,7 @@ static void rtllib_tx_query_agg_cap(struct rtllib_device *ieee,
 			goto FORCED_AGG_SETTING;
 		} else if (!pTxTs->bUsingBa) {
 			if (SN_LESS(pTxTs->TxAdmittedBARecord.ba_start_seq_ctrl.field.seq_num,
-			   (pTxTs->TxCurSeq+1)%4096))
+				    (pTxTs->TxCurSeq+1)%4096))
 				pTxTs->bUsingBa = true;
 			else
 				goto FORCED_AGG_SETTING;
@@ -442,7 +442,7 @@ static void rtllib_query_protectionmode(struct rtllib_device *ieee,
 			u8 HTOpMode = pHTInfo->current_op_mode;
 
 			if ((pHTInfo->bCurBW40MHz && (HTOpMode == 2 ||
-			     HTOpMode == 3)) ||
+						      HTOpMode == 3)) ||
 			     (!pHTInfo->bCurBW40MHz && HTOpMode == 3)) {
 				tcb_desc->rts_rate = MGN_24M;
 				tcb_desc->bRTSEnable = true;
@@ -501,7 +501,7 @@ static u16 rtllib_query_seqnum(struct rtllib_device *ieee, struct sk_buff *skb,
 		struct tx_ts_record *pTS = NULL;
 
 		if (!GetTs(ieee, (struct ts_common_info **)(&pTS), dst,
-		    skb->priority, TX_DIR, true))
+			   skb->priority, TX_DIR, true))
 			return 0;
 		seqnum = pTS->TxCurSeq;
 		pTS->TxCurSeq = (pTS->TxCurSeq+1)%4096;
@@ -618,7 +618,7 @@ static int rtllib_xmit_inter(struct sk_buff *skb, struct net_device *dev)
 					udp = (struct udphdr *)((u8 *)ip +
 					      (ip->ihl << 2));
 					if (((((u8 *)udp)[1] == 68) &&
-					   (((u8 *)udp)[3] == 67)) ||
+					     (((u8 *)udp)[3] == 67)) ||
 					   ((((u8 *)udp)[1] == 67) &&
 					   (((u8 *)udp)[3] == 68))) {
 						bdhcp = true;
@@ -712,11 +712,11 @@ static int rtllib_xmit_inter(struct sk_buff *skb, struct net_device *dev)
 			/* in case we are a client verify acm is not set for this ac */
 			while (unlikely(ieee->wmm_acm & (0x01 << skb->priority))) {
 				netdev_info(ieee->dev, "skb->priority = %x\n",
-						skb->priority);
+					    skb->priority);
 				if (wme_downgrade_ac(skb))
 					break;
 				netdev_info(ieee->dev, "converted skb->priority = %x\n",
-					   skb->priority);
+					    skb->priority);
 			}
 
 			qos_ctl |= skb->priority;
@@ -813,7 +813,7 @@ static int rtllib_xmit_inter(struct sk_buff *skb, struct net_device *dev)
 			if ((qos_activated) && (!bIsMulticast)) {
 				frag_hdr->seq_ctl =
 					 cpu_to_le16(rtllib_query_seqnum(ieee, skb_frag,
-							     header.addr1));
+									 header.addr1));
 				frag_hdr->seq_ctl =
 					 cpu_to_le16(le16_to_cpu(frag_hdr->seq_ctl)<<4 | i);
 			} else {
Signature · 1 line
2.38.1
#3 lore raw

PATCH 3/5 Staging: rtl8192e: rtllib_tx: added spaces around operators

In reply to Aaron Lawrence

Added multiple spaces around operators which needs it as per the Linux kernel coding-style regulations. The issues were flagged by the checkpatch script.

---
 drivers/staging/rtl8192e/rtllib_tx.c | 12 ++++++------
 1 file changed, 6 insertions(+), 6 deletions(-)
drivers/staging/rtl8192e/rtllib_tx.c +6 -6
index 38dfdcf99fec..fa998cd76917 100644
@@ -306,7 +306,7 @@ static void rtllib_tx_query_agg_cap(struct rtllib_device *ieee,
 			goto FORCED_AGG_SETTING;
 		} else if (!pTxTs->bUsingBa) {
 			if (SN_LESS(pTxTs->TxAdmittedBARecord.ba_start_seq_ctrl.field.seq_num,
-				    (pTxTs->TxCurSeq+1)%4096))
+				    (pTxTs->TxCurSeq + 1) % 4096))
 				pTxTs->bUsingBa = true;
 			else
 				goto FORCED_AGG_SETTING;
@@ -403,7 +403,7 @@ static void rtllib_query_protectionmode(struct rtllib_device *ieee,
 	if (tcb_desc->bBroadcast || tcb_desc->bMulticast)
 		return;
 
-	if (is_broadcast_ether_addr(skb->data+16))
+	if (is_broadcast_ether_addr(skb->data + 16))
 		return;
 
 	if (ieee->mode < IEEE_N_24G) {
@@ -504,7 +504,7 @@ static u16 rtllib_query_seqnum(struct rtllib_device *ieee, struct sk_buff *skb,
 			   skb->priority, TX_DIR, true))
 			return 0;
 		seqnum = pTS->TxCurSeq;
-		pTS->TxCurSeq = (pTS->TxCurSeq+1)%4096;
+		pTS->TxCurSeq = (pTS->TxCurSeq + 1) % 4096;
 		return seqnum;
 	}
 	return 0;
@@ -611,7 +611,7 @@ static int rtllib_xmit_inter(struct sk_buff *skb, struct net_device *dev)
 		if (skb->len > 282) {
 			if (ether_type == ETH_P_IP) {
 				const struct iphdr *ip = (struct iphdr *)
-					((u8 *)skb->data+14);
+					((u8 *)skb->data + 14);
 				if (ip->protocol == IPPROTO_UDP) {
 					struct udphdr *udp;
 
@@ -815,10 +815,10 @@ static int rtllib_xmit_inter(struct sk_buff *skb, struct net_device *dev)
 					 cpu_to_le16(rtllib_query_seqnum(ieee, skb_frag,
 									 header.addr1));
 				frag_hdr->seq_ctl =
-					 cpu_to_le16(le16_to_cpu(frag_hdr->seq_ctl)<<4 | i);
+					 cpu_to_le16(le16_to_cpu(frag_hdr->seq_ctl) << 4 | i);
 			} else {
 				frag_hdr->seq_ctl =
-					 cpu_to_le16(ieee->seq_ctrl[0]<<4 | i);
+					 cpu_to_le16(ieee->seq_ctrl[0] << 4 | i);
 			}
 			/* Put a SNAP header on the first fragment */
 			if (i == 0) {
Signature · 1 line
2.38.1
#4 lore raw

PATCH 4/5 Staging: rtl8192e: rtllib_tx: fixed lines ending with an open parenthesis

In reply to Aaron Lawrence

Fixed several lines that end with an open parenthesis to not end with it anymore, as per the Linux kernel coding-style regulations. The issues were flagged by the checkpatch script.

---
 drivers/staging/rtl8192e/rtllib_tx.c | 10 +++++-----
 1 file changed, 5 insertions(+), 5 deletions(-)
drivers/staging/rtl8192e/rtllib_tx.c +5 -5
index fa998cd76917..4647efb0f868 100644
@@ -802,8 +802,8 @@ static int rtllib_xmit_inter(struct sk_buff *skb, struct net_device *dev)
 			 * MOREFRAGS bit to the frame control
 			 */
 			if (i != nr_frags - 1) {
-				frag_hdr->frame_ctl = cpu_to_le16(
-					fc | RTLLIB_FCTL_MOREFRAGS);
+				frag_hdr->frame_ctl = cpu_to_le16(fc |
+								  RTLLIB_FCTL_MOREFRAGS);
 				bytes = bytes_per_frag;
 
 			} else {
@@ -822,9 +822,9 @@ static int rtllib_xmit_inter(struct sk_buff *skb, struct net_device *dev)
 			}
 			/* Put a SNAP header on the first fragment */
 			if (i == 0) {
-				rtllib_put_snap(
-					skb_put(skb_frag, SNAP_SIZE +
-					sizeof(u16)), ether_type);
+				rtllib_put_snap(skb_put(skb_frag,
+							SNAP_SIZE +
+							sizeof(u16)), ether_type);
 				bytes -= SNAP_SIZE + sizeof(u16);
 			}
 
Signature · 1 line
2.38.1
#5 lore raw

PATCH 5/5 Staging: rtl8192e: rtllib_tx: removed unnecessary blank line before a close brace

In reply to Aaron Lawrence

Removed a blank line before a closing brace as it is not necessary as per the Linux coding-style regulations. The issue was flagged by the checkpatch script.

---
 drivers/staging/rtl8192e/rtllib_tx.c | 1 -
 1 file changed, 1 deletion(-)
drivers/staging/rtl8192e/rtllib_tx.c +0 -1
index 4647efb0f868..101f44129145 100644
@@ -954,7 +954,6 @@ static int rtllib_xmit_inter(struct sk_buff *skb, struct net_device *dev)
 	netif_stop_queue(dev);
 	stats->tx_errors++;
 	return 1;
-
 }
 
 netdev_tx_t rtllib_xmit(struct sk_buff *skb, struct net_device *dev)
Signature · 1 line
2.38.1
Tested-by on the v1 series
#6 lore raw
In reply to Aaron Lawrence
Quoted 14 lines · Aaron Lawrence

Multiple patches regarding the cleanup of code in the rtllib_tx.c file. Fixes were applied according to the report generated by the checkpatch script on said file, aside from the CamelCase issues.

Aaron Lawrence (5):
Staging: rtl8192e: rtllib_tx: fixed multiple blank lines
Staging: rtl8192e: rtllib_tx: fixed alignment matching open
parenthesis
Staging: rtl8192e: rtllib_tx: added spaces around operators
Staging: rtl8192e: rtllib_tx: fixed lines ending with an open
parenthesis
Staging: rtl8192e: rtllib_tx: removed unnecessary blank line before a
close brace

Quoted 3 lines
  drivers/staging/rtl8192e/rtllib_tx.c | 42 ++++++++++++----------------
  1 file changed, 18 insertions(+), 24 deletions(-)