Skip to contentSkip to conversation

staging: rtl8723bs: HAL coding style cleanup

PATCH In review Mahad Ibrahim 2 participants 14 messages Jan 12 – Jan 17 Staging

lore
Share & tools
lore
#0 lore raw

cover staging: rtl8723bs: HAL coding style cleanup

This series fixes multiple coding style issues and checkpatch.pl warnings in the HAL (Hardware Abstraction Layer) of the rtl8723bs driver.

The files that were touched:
- HalHWImg8723B_MAC.c
- HalHWImg8723B_BB.c
- HalHWImg8723B_RF.c

The changes include:
- Fixing block comment alignment.
- Adding space around arithmetic and bitwise operators.
- Removing blank lines.
- Add blank line after declaration.
- Fixing lines ending with an open parenthesis.
- Fixing line length violations.

These changes clear all checkpatch.pl warnings/checks (excluding CamelCase) for these three files and adhere to the kernel coding style.

Mahad Ibrahim (10):
staging: rtl8723bs: Fix block comment alignment in HalHWImg8723B_MAC.c
staging: rtl8723bs: Fix spaces around operator checks in

    HalHWImg8723B_MAC.c
  staging: rtl8723bs: Fix style and formatting in HalHWImg8723B_MAC.c
  staging: rtl8723bs: Fix block comment alignment in HalHWImg8723B_BB.c
  staging: rtl8723bs: Fix spacing coding style issues in
    HalHWImg8723B_BB.c
  staging: rtl8723bs: Fix parenthesis and blank line issues in
    HalHWImg8723B_BB.c
  staging: rtl8723bs: Fix block comment alignment in HalHWImg8723B_RF.c
  staging: rtl8723bs: Fix style and alignment issues in
    HalHWImg8723B_RF.c

staging: rtl8723bs: Fix operator spacing issues in HalHWImg8723B_RF.c
staging: rtl8723bs: Fix blank line checks in HalHWImg8723B_RF.c

 .../staging/rtl8723bs/hal/HalHWImg8723B_BB.c  |  73 ++++----
 .../staging/rtl8723bs/hal/HalHWImg8723B_MAC.c |  40 ++---
 .../staging/rtl8723bs/hal/HalHWImg8723B_RF.c  | 158 ++++++++----------
 3 files changed, 127 insertions(+), 144 deletions(-)
Signature · 1 line
2.47.3
#1 lore raw

PATCH 1/10 staging: rtl8723bs: Fix block comment alignment in HalHWImg8723B_MAC.c

Fix checkpatch warnings regarding block comment alignment. The warnings were: "Block comments should align the * on each line".

This patch aligns the asterisks in the block comments to match the kernel coding style.

---
 drivers/staging/rtl8723bs/hal/HalHWImg8723B_MAC.c | 12 ++++++------
 1 file changed, 6 insertions(+), 6 deletions(-)
drivers/staging/rtl8723bs/hal/HalHWImg8723B_MAC.c +6 -6
index 1f0cc8d58df3..a65dab37ad9d 100644
@@ -1,9 +1,9 @@
 // SPDX-License-Identifier: GPL-2.0
 /******************************************************************************
-*
-* Copyright(c) 2007 - 2011 Realtek Corporation. All rights reserved.
-*
-******************************************************************************/
+ *
+ * Copyright(c) 2007 - 2011 Realtek Corporation. All rights reserved.
+ *
+ ******************************************************************************/
 
 #include <linux/kernel.h>
 #include "odm_precomp.h"
@@ -69,8 +69,8 @@ static bool CheckPositive(
 }
 
 /******************************************************************************
-*                           MAC_REG.TXT
-******************************************************************************/
+ *                           MAC_REG.TXT
+ ******************************************************************************/
 
 static u32 Array_MP_8723B_MAC_REG[] = {
 		0x02F, 0x00000030,
Signature · 1 line
2.47.3
#2 lore raw

PATCH 2/10 staging: rtl8723bs: Fix spaces around operator checks in HalHWImg8723B_MAC.c

In reply to Mahad Ibrahim

Fix checkpatch.pl checks in HalHWImg8723B_MAC.c regarding:
-Spaces preferred around that operator

Adhere to kernel coding style by adding spaces around operators.

---
 drivers/staging/rtl8723bs/hal/HalHWImg8723B_MAC.c | 14 +++++++-------
 1 file changed, 7 insertions(+), 7 deletions(-)
drivers/staging/rtl8723bs/hal/HalHWImg8723B_MAC.c +7 -7
index a65dab37ad9d..9c07df254eaa 100644
@@ -187,7 +187,7 @@ void ODM_ReadAndConfig_MP_8723B_MAC_REG(struct dm_odm_t *pDM_Odm)
 
 	for (i = 0; i < ArrayLen; i += 2) {
 		u32 v1 = Array[i];
-		u32 v2 = Array[i+1];
+		u32 v2 = Array[i + 1];
 
 		/*  This (offset, data) pair doesn't care the condition. */
 		if (v1 < 0x40000000) {
@@ -196,7 +196,7 @@ void ODM_ReadAndConfig_MP_8723B_MAC_REG(struct dm_odm_t *pDM_Odm)
 		} else {
 			/*  This line is the beginning of branch. */
 			bool bMatched = true;
-			u8  cCond  = (u8)((v1 & (BIT29|BIT28)) >> 28);
+			u8  cCond  = (u8)((v1 & (BIT29 | BIT28)) >> 28);
 
 			if (cCond == COND_ELSE) { /*  ELSE, ENDIF */
 				bMatched = true;
@@ -213,21 +213,21 @@ void ODM_ReadAndConfig_MP_8723B_MAC_REG(struct dm_odm_t *pDM_Odm)
 
 			if (!bMatched) {
 				/*  Condition isn't matched. Discard the following (offset, data) pairs. */
-				while (v1 < 0x40000000 && i < ArrayLen-2)
+				while (v1 < 0x40000000 && i < ArrayLen - 2)
 					READ_NEXT_PAIR(v1, v2, i);
 
 				i -= 2; /*  prevent from for-loop += 2 */
 			} else { /*  Configure matched pairs and skip to end of if-else. */
-				while (v1 < 0x40000000 && i < ArrayLen-2) {
+				while (v1 < 0x40000000 && i < ArrayLen - 2) {
 					odm_ConfigMAC_8723B(pDM_Odm, v1, (u8)v2);
 					READ_NEXT_PAIR(v1, v2, i);
 				}
 
 				/*  Keeps reading until ENDIF. */
-				cCond = (u8)((v1 & (BIT29|BIT28)) >> 28);
-				while (cCond != COND_ENDIF && i < ArrayLen-2) {
+				cCond = (u8)((v1 & (BIT29 | BIT28)) >> 28);
+				while (cCond != COND_ENDIF && i < ArrayLen - 2) {
 					READ_NEXT_PAIR(v1, v2, i);
-					cCond = (u8)((v1 & (BIT29|BIT28)) >> 28);
+					cCond = (u8)((v1 & (BIT29 | BIT28)) >> 28);
 				}
 			}
 		}
Signature · 1 line
2.47.3
#3 lore raw

PATCH 3/10 staging: rtl8723bs: Fix style and formatting in HalHWImg8723B_MAC.c

In reply to Mahad Ibrahim

Fix multiple checkpatch.pl warnings/checks in HalHWImg8723B_MAC.c.

The checkpatch.pl warnings/checks constituted:
-Lines should not end with a '('
-Please don't use multiple blank lines
-Missing a blank line after declarations
-line length of <Int> exceeds 100 columns

Adhere to kernel coding style by fixing style, alignment and line length checkpatch.pl checks/warnings.

---
 drivers/staging/rtl8723bs/hal/HalHWImg8723B_MAC.c | 14 ++++++++------
 1 file changed, 8 insertions(+), 6 deletions(-)
drivers/staging/rtl8723bs/hal/HalHWImg8723B_MAC.c +8 -6
index 9c07df254eaa..0bf9eaceeb4a 100644
@@ -8,9 +8,7 @@
 #include <linux/kernel.h>
 #include "odm_precomp.h"
 
-static bool CheckPositive(
-	struct dm_odm_t *pDM_Odm, const u32 Condition1, const u32 Condition2
-)
+static bool CheckPositive(struct dm_odm_t *pDM_Odm, const u32 Condition1, const u32 Condition2)
 {
 	u8 _BoardType =
 		((pDM_Odm->BoardType & BIT4) >> 4) << 0 | /*  _GLNA */
@@ -33,7 +31,6 @@ static bool CheckPositive(
 		pDM_Odm->TypeALNA << 16 |
 		pDM_Odm->TypeAPA  << 24;
 
-
 	/*  Value Defined Check =============== */
 	/* QFN Type [15:12] and Cut Version [27:24] need to do value check */
 
@@ -50,6 +47,7 @@ static bool CheckPositive(
 
 	if ((cond1 & driver1) == cond1) {
 		u32 bitMask = 0;
+
 		if ((cond1 & 0x0F) == 0) /*  BoardType is DONTCARE */
 			return true;
 
@@ -62,7 +60,8 @@ static bool CheckPositive(
 		if ((cond1 & BIT3) != 0) /* APA */
 			bitMask |= 0xFF000000;
 
-		if ((cond2 & bitMask) == (driver2 & bitMask)) /*  BoardType of each RF path is matched */
+		/*  BoardType of each RF path is matched */
+		if ((cond2 & bitMask) == (driver2 & bitMask))
 			return true;
 	}
 	return false;
@@ -212,7 +211,10 @@ void ODM_ReadAndConfig_MP_8723B_MAC_REG(struct dm_odm_t *pDM_Odm)
 			}
 
 			if (!bMatched) {
-				/*  Condition isn't matched. Discard the following (offset, data) pairs. */
+				/*
+				 *  Condition isn't matched.
+				 *  Discard the following (offset, data) pairs.
+				 */
 				while (v1 < 0x40000000 && i < ArrayLen - 2)
 					READ_NEXT_PAIR(v1, v2, i);
 
Signature · 1 line
2.47.3
maintainer
#4 lore raw

Re: [PATCH 03/10] staging: rtl8723bs: Fix style and formatting in HalHWImg8723B_MAC.c

Quoted 8 lines · Mahad Ibrahim

Fix multiple checkpatch.pl warnings/checks in HalHWImg8723B_MAC.c.

The checkpatch.pl warnings/checks constituted:

(quoted diff) +0 -4
-Lines should not end with a '('
-Please don't use multiple blank lines
-Missing a blank line after declarations
-line length of <Int> exceeds 100 columns
Quoted 7 lines

Adhere to kernel coding style by fixing style, alignment and line length checkpatch.pl checks/warnings.

---
 drivers/staging/rtl8723bs/hal/HalHWImg8723B_MAC.c | 14 ++++++++------
 1 file changed, 8 insertions(+), 6 deletions(-)

Hi,

This is the friendly patch-bot of Greg Kroah-Hartman. You have sent him a patch that has triggered this response. He used to manually respond to these common problems, but in order to save his sanity (he kept writing the same thing over and over, yet to different people), I was created. Hopefully you will not take offence and will fix the problem in your patch and resubmit it so that it can be accepted into the Linux kernel tree.

You are receiving this message because of the following common error(s) as indicated below:
- Your patch did many different things all at once, making it difficult to review. All Linux kernel patches need to only do one thing at a time. If you need to do multiple things (such as clean up all coding style issues in a file/driver), do it in a sequence of patches, each one doing only one thing. This will make it easier to review the patches to ensure that they are correct, and to help alleviate any merge issues that larger patches can cause.

If you wish to discuss this problem further, or you have questions about how to resolve this issue, please feel free to respond to this email and Greg will reply once he has dug out from the pending patches received from other developers.

thanks,

greg k-h's patch email bot

#5 lore raw

PATCH 4/10 staging: rtl8723bs: Fix block comment alignment in HalHWImg8723B_BB.c

In reply to Mahad Ibrahim

Fix checkpatch.pl warnings regarding block comment alignment. The warnings were: "Block comments should align the * on each line".

This patch aligns the asterisks in the block comments so they adhere to the kernel coding style.

---
 .../staging/rtl8723bs/hal/HalHWImg8723B_BB.c  | 34 ++++++++++---------
 1 file changed, 18 insertions(+), 16 deletions(-)
drivers/staging/rtl8723bs/hal/HalHWImg8723B_BB.c +18 -16
index 4da2487f6750..630dace0af47 100644
@@ -1,9 +1,9 @@
 // SPDX-License-Identifier: GPL-2.0
 /******************************************************************************
-*
-* Copyright(c) 2007 - 2011 Realtek Corporation. All rights reserved.
-*
-******************************************************************************/
+ *
+ * Copyright(c) 2007 - 2011 Realtek Corporation. All rights reserved.
+ *
+ ******************************************************************************/
 
 #include <linux/kernel.h>
 #include "odm_precomp.h"
@@ -71,8 +71,8 @@ static bool CheckPositive(
 }
 
 /******************************************************************************
-*                           AGC_TAB.TXT
-******************************************************************************/
+ *                           AGC_TAB.TXT
+ ******************************************************************************/
 
 static u32 Array_MP_8723B_AGC_TAB[] = {
 		0xC78, 0xFD000001,
@@ -242,9 +242,10 @@ void ODM_ReadAndConfig_MP_8723B_AGC_TAB(struct dm_odm_t *pDM_Odm)
 			}
 
 			if (!bMatched) {
-				/*  Condition isn't matched.
-				*   Discard the following (offset, data) pairs.
-				*/
+				/*
+				 *   Condition isn't matched.
+				 *   Discard the following (offset, data) pairs.
+				 */
 				while (v1 < 0x40000000 && i < ArrayLen-2)
 					READ_NEXT_PAIR(v1, v2, i);
 
@@ -268,8 +269,8 @@ void ODM_ReadAndConfig_MP_8723B_AGC_TAB(struct dm_odm_t *pDM_Odm)
 }
 
 /******************************************************************************
-*                           PHY_REG.TXT
-******************************************************************************/
+ *                           PHY_REG.TXT
+ ******************************************************************************/
 
 static u32 Array_MP_8723B_PHY_REG[] = {
 		0x800, 0x80040000,
@@ -501,9 +502,10 @@ void ODM_ReadAndConfig_MP_8723B_PHY_REG(struct dm_odm_t *pDM_Odm)
 			}
 
 			if (!bMatched) {
-				/*  Condition isn't matched.
-				*   Discard the following (offset, data) pairs.
-				*/
+				/*
+				 *   Condition isn't matched.
+				 *   Discard the following (offset, data) pairs.
+				 */
 				while (v1 < 0x40000000 && i < ArrayLen-2)
 					READ_NEXT_PAIR(v1, v2, i);
 
@@ -526,8 +528,8 @@ void ODM_ReadAndConfig_MP_8723B_PHY_REG(struct dm_odm_t *pDM_Odm)
 }
 
 /******************************************************************************
-*                           PHY_REG_PG.TXT
-******************************************************************************/
+ *                           PHY_REG_PG.TXT
+ ******************************************************************************/
 
 static u32 Array_MP_8723B_PHY_REG_PG[] = {
 	0, 0x00000e08, 0x0000ff00, 0x00003800,
Signature · 1 line
2.47.3
#6 lore raw

PATCH 5/10 staging: rtl8723bs: Fix spacing coding style issues in HalHWImg8723B_BB.c

In reply to Mahad Ibrahim

Fix checkpatch.pl checks regarding "spaces preferred around that" operator.

Adhere to kernel coding standards by adding spaces around arithmetic and bitwise operations.

---
 .../staging/rtl8723bs/hal/HalHWImg8723B_BB.c  | 34 +++++++++----------
 1 file changed, 17 insertions(+), 17 deletions(-)
drivers/staging/rtl8723bs/hal/HalHWImg8723B_BB.c +17 -17
index 630dace0af47..5fcb9420fb3d 100644
@@ -217,7 +217,7 @@ void ODM_ReadAndConfig_MP_8723B_AGC_TAB(struct dm_odm_t *pDM_Odm)
 
 	for (i = 0; i < ArrayLen; i += 2) {
 		u32 v1 = Array[i];
-		u32 v2 = Array[i+1];
+		u32 v2 = Array[i + 1];
 
 		/*  This (offset, data) pair doesn't care the condition. */
 		if (v1 < 0x40000000) {
@@ -226,7 +226,7 @@ void ODM_ReadAndConfig_MP_8723B_AGC_TAB(struct dm_odm_t *pDM_Odm)
 		} else {
 			/*  This line is the beginning of branch. */
 			bool bMatched = true;
-			u8  cCond  = (u8)((v1 & (BIT29|BIT28)) >> 28);
+			u8  cCond  = (u8)((v1 & (BIT29 | BIT28)) >> 28);
 
 			if (cCond == COND_ELSE) { /*  ELSE, ENDIF */
 				bMatched = true;
@@ -246,22 +246,22 @@ void ODM_ReadAndConfig_MP_8723B_AGC_TAB(struct dm_odm_t *pDM_Odm)
 				 *   Condition isn't matched.
 				 *   Discard the following (offset, data) pairs.
 				 */
-				while (v1 < 0x40000000 && i < ArrayLen-2)
+				while (v1 < 0x40000000 && i < ArrayLen - 2)
 					READ_NEXT_PAIR(v1, v2, i);
 
 				i -= 2; /*  prevent from for-loop += 2 */
 			} else {
 				/*  Configure matched pairs and skip to end of if-else. */
-				while (v1 < 0x40000000 && i < ArrayLen-2) {
+				while (v1 < 0x40000000 && i < ArrayLen - 2) {
 					odm_ConfigBB_AGC_8723B(pDM_Odm, v1, bMaskDWord, v2);
 					READ_NEXT_PAIR(v1, v2, i);
 				}
 
 				/*  Keeps reading until ENDIF. */
-				cCond = (u8)((v1 & (BIT29|BIT28)) >> 28);
-				while (cCond != COND_ENDIF && i < ArrayLen-2) {
+				cCond = (u8)((v1 & (BIT29 | BIT28)) >> 28);
+				while (cCond != COND_ENDIF && i < ArrayLen - 2) {
 					READ_NEXT_PAIR(v1, v2, i);
-					cCond = (u8)((v1 & (BIT29|BIT28)) >> 28);
+					cCond = (u8)((v1 & (BIT29 | BIT28)) >> 28);
 				}
 			}
 		}
@@ -477,7 +477,7 @@ void ODM_ReadAndConfig_MP_8723B_PHY_REG(struct dm_odm_t *pDM_Odm)
 
 	for (i = 0; i < ArrayLen; i += 2) {
 		u32 v1 = Array[i];
-		u32 v2 = Array[i+1];
+		u32 v2 = Array[i + 1];
 
 		/*  This (offset, data) pair doesn't care the condition. */
 		if (v1 < 0x40000000) {
@@ -486,7 +486,7 @@ void ODM_ReadAndConfig_MP_8723B_PHY_REG(struct dm_odm_t *pDM_Odm)
 		} else {
 			/*  This line is the beginning of branch. */
 			bool bMatched = true;
-			u8  cCond  = (u8)((v1 & (BIT29|BIT28)) >> 28);
+			u8  cCond  = (u8)((v1 & (BIT29 | BIT28)) >> 28);
 
 			if (cCond == COND_ELSE) { /*  ELSE, ENDIF */
 				bMatched = true;
@@ -506,21 +506,21 @@ void ODM_ReadAndConfig_MP_8723B_PHY_REG(struct dm_odm_t *pDM_Odm)
 				 *   Condition isn't matched.
 				 *   Discard the following (offset, data) pairs.
 				 */
-				while (v1 < 0x40000000 && i < ArrayLen-2)
+				while (v1 < 0x40000000 && i < ArrayLen - 2)
 					READ_NEXT_PAIR(v1, v2, i);
 
 				i -= 2; /*  prevent from for-loop += 2 */
 			} else { /*  Configure matched pairs and skip to end of if-else. */
-				while (v1 < 0x40000000 && i < ArrayLen-2) {
+				while (v1 < 0x40000000 && i < ArrayLen - 2) {
 					odm_ConfigBB_PHY_8723B(pDM_Odm, v1, bMaskDWord, v2);
 					READ_NEXT_PAIR(v1, v2, i);
 				}
 
 				/*  Keeps reading until ENDIF. */
-				cCond = (u8)((v1 & (BIT29|BIT28)) >> 28);
-				while (cCond != COND_ENDIF && i < ArrayLen-2) {
+				cCond = (u8)((v1 & (BIT29 | BIT28)) >> 28);
+				while (cCond != COND_ENDIF && i < ArrayLen - 2) {
 					READ_NEXT_PAIR(v1, v2, i);
-					cCond = (u8)((v1 & (BIT29|BIT28)) >> 28);
+					cCond = (u8)((v1 & (BIT29 | BIT28)) >> 28);
 				}
 			}
 		}
@@ -550,9 +550,9 @@ void ODM_ReadAndConfig_MP_8723B_PHY_REG_PG(struct dm_odm_t *pDM_Odm)
 
 	for (i = 0; i < ARRAY_SIZE(Array_MP_8723B_PHY_REG_PG); i += 4) {
 		u32 v1 = Array[i];
-		u32 v2 = Array[i+1];
-		u32 v3 = Array[i+2];
-		u32 v4 = Array[i+3];
+		u32 v2 = Array[i + 1];
+		u32 v3 = Array[i + 2];
+		u32 v4 = Array[i + 3];
 
 		odm_ConfigBB_PHY_REG_PG_8723B(pDM_Odm, v1, v2, v3, v4);
 	}
Signature · 1 line
2.47.3
#7 lore raw

PATCH 6/10 staging: rtl8723bs: Fix parenthesis and blank line issues in HalHWImg8723B_BB.c

In reply to Mahad Ibrahim

Fix checkpatch.pl checks regarding:
- Fix line ending in '('
- Remove multiple blank lines

Remove parenthesis and blank line issues to adhere to the kernel coding standards.

---
 drivers/staging/rtl8723bs/hal/HalHWImg8723B_BB.c | 5 +----
 1 file changed, 1 insertion(+), 4 deletions(-)
drivers/staging/rtl8723bs/hal/HalHWImg8723B_BB.c +1 -4
index 5fcb9420fb3d..988636a16112 100644
@@ -8,9 +8,7 @@
 #include <linux/kernel.h>
 #include "odm_precomp.h"
 
-static bool CheckPositive(
-	struct dm_odm_t *pDM_Odm, const u32 Condition1, const u32 Condition2
-)
+static bool CheckPositive(struct dm_odm_t *pDM_Odm, const u32 Condition1, const u32 Condition2)
 {
 	u8 _BoardType =
 		((pDM_Odm->BoardType & BIT4) >> 4) << 0 | /*  _GLNA */
@@ -33,7 +31,6 @@ static bool CheckPositive(
 		pDM_Odm->TypeALNA << 16 |
 		pDM_Odm->TypeAPA << 24;
 
-
 	/*  Value Defined Check =============== */
 	/* QFN Type [15:12] and Cut Version [27:24] need to do value check */
 
Signature · 1 line
2.47.3
maintainer
#8 lore raw

Re: [PATCH 06/10] staging: rtl8723bs: Fix parenthesis and blank line issues in HalHWImg8723B_BB.c

Quoted 3 lines · Mahad Ibrahim

Fix checkpatch.pl checks regarding:
- Fix line ending in '('
- Remove multiple blank lines

That's 2 different things. Sorry for being pedantic, but staging is where people learn how to do this type of thing, please break this up into multiple patches.

Note, you can do the same type of transformation on multiple files at the same time, so maybe this series can be redone that way?

thanks,

greg k-h

#9 lore raw

Re: [PATCH 06/10] staging: rtl8723bs: Fix parenthesis and blank line issues in HalHWImg8723B_BB.c

Thank you so much for the feedback and guidance.

I understand my mistake. I committed different logical changes, no matter how small, in one commit. I will restructure the v2 series to apply only one logical change
across the entire driver per patch as you suggested.

I will send the v2 series shortly.

Thanks,

Mahad Ibrahim

#10 lore raw

PATCH 7/10 staging: rtl8723bs: Fix block comment alignment in HalHWImg8723B_RF.c

In reply to Mahad Ibrahim

Fix checkpatch.pl warnings regarding block comment alignment.

Adhere to kernel coding style by fixing block comments.

---
 .../staging/rtl8723bs/hal/HalHWImg8723B_RF.c  | 27 ++++++++++---------
 1 file changed, 14 insertions(+), 13 deletions(-)
drivers/staging/rtl8723bs/hal/HalHWImg8723B_RF.c +14 -13
index 155ec311a52e..0c7d0307b822 100644
@@ -1,9 +1,9 @@
 // SPDX-License-Identifier: GPL-2.0
 /******************************************************************************
-*
-* Copyright(c) 2007 - 2011 Realtek Corporation. All rights reserved.
-*
-******************************************************************************/
+ *
+ * Copyright(c) 2007 - 2011 Realtek Corporation. All rights reserved.
+ *
+ ******************************************************************************/
 
 #include <linux/kernel.h>
 #include "odm_precomp.h"
@@ -79,8 +79,8 @@ static bool CheckPositive(
 }
 
 /******************************************************************************
-*                           RadioA.TXT
-******************************************************************************/
+ *                           RadioA.TXT
+ ******************************************************************************/
 
 static u32 Array_MP_8723B_RadioA[] = {
 		0x000, 0x00010000,
@@ -243,9 +243,10 @@ void ODM_ReadAndConfig_MP_8723B_RadioA(struct dm_odm_t *pDM_Odm)
 			}
 
 			if (!bMatched) {
-				/*  Condition isn't matched.
-				*   Discard the following (offset, data) pairs.
-				*/
+				/*
+				 *  Condition isn't matched.
+				 *  Discard the following (offset, data) pairs.
+				 */
 				while (v1 < 0x40000000 && i < ArrayLen-2)
 					READ_NEXT_PAIR(v1, v2, i);
 
@@ -269,8 +270,8 @@ void ODM_ReadAndConfig_MP_8723B_RadioA(struct dm_odm_t *pDM_Odm)
 }
 
 /******************************************************************************
-*                           TxPowerTrack_SDIO.TXT
-******************************************************************************/
+ *                           TxPowerTrack_SDIO.TXT
+ ******************************************************************************/
 
 static u8 gDeltaSwingTableIdx_MP_2GB_N_TxPowerTrack_SDIO_8723B[] = {
 	0, 0, 1, 2, 2, 2, 3, 3, 3, 4,  5,  5,  6,  6, 6,  6,
@@ -354,8 +355,8 @@ void ODM_ReadAndConfig_MP_8723B_TxPowerTrack_SDIO(struct dm_odm_t *pDM_Odm)
 }
 
 /******************************************************************************
-*                           TXPWR_LMT.TXT
-******************************************************************************/
+ *                           TXPWR_LMT.TXT
+ ******************************************************************************/
 
 static u8 *Array_MP_8723B_TXPWR_LMT[] = {
 	"FCC", "20M", "CCK", "1T", "01", "32",
Signature · 1 line
2.47.3
#11 lore raw

PATCH 8/10 staging: rtl8723bs: Fix style and alignment issues in HalHWImg8723B_RF.c

In reply to Mahad Ibrahim

Fix multiple coding style issues to silence checkpatch.pl warnings.

- Move the first part of the conditional logic in 'if' statements to the same line as the opening parenthesis. This fixes the checkpatch warning:
"Lines should not end with a '('".

- Fix the alignment of function arguments and long variable assignments. Use spaces to align subsequent lines with the opening parenthesis, adhering to the kernel coding style guidelines.

- Remove hanging parentheses to improve readability.

---
 .../staging/rtl8723bs/hal/HalHWImg8723B_RF.c  | 97 +++++++------------
 1 file changed, 36 insertions(+), 61 deletions(-)
drivers/staging/rtl8723bs/hal/HalHWImg8723B_RF.c +36 -61
index 0c7d0307b822..22be62ad8e0e 100644
@@ -8,9 +8,7 @@
 #include <linux/kernel.h>
 #include "odm_precomp.h"
 
-static bool CheckPositive(
-	struct dm_odm_t *pDM_Odm, const u32 Condition1, const u32 Condition2
-)
+static bool CheckPositive(struct dm_odm_t *pDM_Odm, const u32 Condition1, const u32 Condition2)
 {
 	u8 _BoardType =
 			((pDM_Odm->BoardType & BIT4) >> 4) << 0 | /*  _GLNA */
@@ -36,16 +34,12 @@ static bool CheckPositive(
 	/*  Value Defined Check =============== */
 	/* QFN Type [15:12] and Cut Version [27:24] need to do value check */
 
-	if (
-		((cond1 & 0x0000F000) != 0) &&
-		((cond1 & 0x0000F000) != (driver1 & 0x0000F000))
-	)
+	if (((cond1 & 0x0000F000) != 0) &&
+	    ((cond1 & 0x0000F000) != (driver1 & 0x0000F000)))
 		return false;
 
-	if (
-		((cond1 & 0x0F000000) != 0) &&
-		((cond1 & 0x0F000000) != (driver1 & 0x0F000000))
-	)
+	if (((cond1 & 0x0F000000) != 0) &&
+	    ((cond1 & 0x0F000000) != (driver1 & 0x0F000000)))
 		return false;
 
 	/*  Bit Defined Check ================ */
@@ -311,47 +305,30 @@ void ODM_ReadAndConfig_MP_8723B_TxPowerTrack_SDIO(struct dm_odm_t *pDM_Odm)
 	struct odm_rf_cal_t *pRFCalibrateInfo = &pDM_Odm->RFCalibrateInfo;
 
 
-	memcpy(
-		pRFCalibrateInfo->DeltaSwingTableIdx_2GA_P,
-		gDeltaSwingTableIdx_MP_2GA_P_TxPowerTrack_SDIO_8723B,
-		DELTA_SWINGIDX_SIZE
-	);
-	memcpy(
-		pRFCalibrateInfo->DeltaSwingTableIdx_2GA_N,
-		gDeltaSwingTableIdx_MP_2GA_N_TxPowerTrack_SDIO_8723B,
-		DELTA_SWINGIDX_SIZE
-	);
-	memcpy(
-		pRFCalibrateInfo->DeltaSwingTableIdx_2GB_P,
-		gDeltaSwingTableIdx_MP_2GB_P_TxPowerTrack_SDIO_8723B,
-		DELTA_SWINGIDX_SIZE
-	);
-	memcpy(
-		pRFCalibrateInfo->DeltaSwingTableIdx_2GB_N,
-		gDeltaSwingTableIdx_MP_2GB_N_TxPowerTrack_SDIO_8723B,
-		DELTA_SWINGIDX_SIZE
-	);
-
-	memcpy(
-		pRFCalibrateInfo->DeltaSwingTableIdx_2GCCKA_P,
-		gDeltaSwingTableIdx_MP_2GCCKA_P_TxPowerTrack_SDIO_8723B,
-		DELTA_SWINGIDX_SIZE
-	);
-	memcpy(
-		pRFCalibrateInfo->DeltaSwingTableIdx_2GCCKA_N,
-		gDeltaSwingTableIdx_MP_2GCCKA_N_TxPowerTrack_SDIO_8723B,
-		DELTA_SWINGIDX_SIZE
-	);
-	memcpy(
-		pRFCalibrateInfo->DeltaSwingTableIdx_2GCCKB_P,
-		gDeltaSwingTableIdx_MP_2GCCKB_P_TxPowerTrack_SDIO_8723B,
-		DELTA_SWINGIDX_SIZE
-	);
-	memcpy(
-		pRFCalibrateInfo->DeltaSwingTableIdx_2GCCKB_N,
-		gDeltaSwingTableIdx_MP_2GCCKB_N_TxPowerTrack_SDIO_8723B,
-		DELTA_SWINGIDX_SIZE
-	);
+	memcpy(pRFCalibrateInfo->DeltaSwingTableIdx_2GA_P,
+	       gDeltaSwingTableIdx_MP_2GA_P_TxPowerTrack_SDIO_8723B,
+	       DELTA_SWINGIDX_SIZE);
+	memcpy(pRFCalibrateInfo->DeltaSwingTableIdx_2GA_N,
+	       gDeltaSwingTableIdx_MP_2GA_N_TxPowerTrack_SDIO_8723B,
+	       DELTA_SWINGIDX_SIZE);
+	memcpy(pRFCalibrateInfo->DeltaSwingTableIdx_2GB_P,
+	       gDeltaSwingTableIdx_MP_2GB_P_TxPowerTrack_SDIO_8723B,
+	       DELTA_SWINGIDX_SIZE);
+	memcpy(pRFCalibrateInfo->DeltaSwingTableIdx_2GB_N,
+	       gDeltaSwingTableIdx_MP_2GB_N_TxPowerTrack_SDIO_8723B,
+	       DELTA_SWINGIDX_SIZE);
+	memcpy(pRFCalibrateInfo->DeltaSwingTableIdx_2GCCKA_P,
+	       gDeltaSwingTableIdx_MP_2GCCKA_P_TxPowerTrack_SDIO_8723B,
+	       DELTA_SWINGIDX_SIZE);
+	memcpy(pRFCalibrateInfo->DeltaSwingTableIdx_2GCCKA_N,
+	       gDeltaSwingTableIdx_MP_2GCCKA_N_TxPowerTrack_SDIO_8723B,
+	       DELTA_SWINGIDX_SIZE);
+	memcpy(pRFCalibrateInfo->DeltaSwingTableIdx_2GCCKB_P,
+	       gDeltaSwingTableIdx_MP_2GCCKB_P_TxPowerTrack_SDIO_8723B,
+	       DELTA_SWINGIDX_SIZE);
+	memcpy(pRFCalibrateInfo->DeltaSwingTableIdx_2GCCKB_N,
+	       gDeltaSwingTableIdx_MP_2GCCKB_N_TxPowerTrack_SDIO_8723B,
+	       DELTA_SWINGIDX_SIZE);
 }
 
 /******************************************************************************
@@ -542,14 +519,12 @@ void ODM_ReadAndConfig_MP_8723B_TXPWR_LMT(struct dm_odm_t *pDM_Odm)
 		u8 *chnl = Array[i+4];
 		u8 *val = Array[i+5];
 
-		odm_ConfigBB_TXPWR_LMT_8723B(
-			pDM_Odm,
-			regulation,
-			bandwidth,
-			rate,
-			rfPath,
-			chnl,
-			val
-		);
+		odm_ConfigBB_TXPWR_LMT_8723B(pDM_Odm,
+					     regulation,
+					     bandwidth,
+					     rate,
+					     rfPath,
+					     chnl,
+					     val);
 	}
 }
Signature · 1 line
2.47.3
#12 lore raw

PATCH 9/10 staging: rtl8723bs: Fix operator spacing issues in HalHWImg8723B_RF.c

In reply to Mahad Ibrahim

Add spaces around arithmetic and bitwise operators (+, -, |) to fix multiple checkpatch.pl checks.

Adhere to the kernel coding style by adding spaces around arithmetic and bitwise operators.

---
 .../staging/rtl8723bs/hal/HalHWImg8723B_RF.c  | 24 +++++++++----------
 1 file changed, 12 insertions(+), 12 deletions(-)
drivers/staging/rtl8723bs/hal/HalHWImg8723B_RF.c +12 -12
index 22be62ad8e0e..1ae82afbcb64 100644
@@ -212,7 +212,7 @@ void ODM_ReadAndConfig_MP_8723B_RadioA(struct dm_odm_t *pDM_Odm)
 
 	for (i = 0; i < ArrayLen; i += 2) {
 		u32 v1 = Array[i];
-		u32 v2 = Array[i+1];
+		u32 v2 = Array[i + 1];
 
 		/*  This (offset, data) pair doesn't care the condition. */
 		if (v1 < 0x40000000) {
@@ -221,7 +221,7 @@ void ODM_ReadAndConfig_MP_8723B_RadioA(struct dm_odm_t *pDM_Odm)
 		} else {
 			/*  This line is the beginning of branch. */
 			bool bMatched = true;
-			u8  cCond  = (u8)((v1 & (BIT29|BIT28)) >> 28);
+			u8  cCond  = (u8)((v1 & (BIT29 | BIT28)) >> 28);
 
 			if (cCond == COND_ELSE) { /*  ELSE, ENDIF */
 				bMatched = true;
@@ -241,22 +241,22 @@ void ODM_ReadAndConfig_MP_8723B_RadioA(struct dm_odm_t *pDM_Odm)
 				 *  Condition isn't matched.
 				 *  Discard the following (offset, data) pairs.
 				 */
-				while (v1 < 0x40000000 && i < ArrayLen-2)
+				while (v1 < 0x40000000 && i < ArrayLen - 2)
 					READ_NEXT_PAIR(v1, v2, i);
 
 				i -= 2; /*  prevent from for-loop += 2 */
 			} else {
 				/*  Configure matched pairs and skip to end of if-else. */
-				while (v1 < 0x40000000 && i < ArrayLen-2) {
+				while (v1 < 0x40000000 && i < ArrayLen - 2) {
 					odm_ConfigRF_RadioA_8723B(pDM_Odm, v1, v2);
 					READ_NEXT_PAIR(v1, v2, i);
 				}
 
 				/*  Keeps reading until ENDIF. */
-				cCond = (u8)((v1 & (BIT29|BIT28)) >> 28);
-				while (cCond != COND_ENDIF && i < ArrayLen-2) {
+				cCond = (u8)((v1 & (BIT29 | BIT28)) >> 28);
+				while (cCond != COND_ENDIF && i < ArrayLen - 2) {
 					READ_NEXT_PAIR(v1, v2, i);
-					cCond = (u8)((v1 & (BIT29|BIT28)) >> 28);
+					cCond = (u8)((v1 & (BIT29 | BIT28)) >> 28);
 				}
 			}
 		}
@@ -513,11 +513,11 @@ void ODM_ReadAndConfig_MP_8723B_TXPWR_LMT(struct dm_odm_t *pDM_Odm)
 
 	for (i = 0; i < ARRAY_SIZE(Array_MP_8723B_TXPWR_LMT); i += 6) {
 		u8 *regulation = Array[i];
-		u8 *bandwidth = Array[i+1];
-		u8 *rate = Array[i+2];
-		u8 *rfPath = Array[i+3];
-		u8 *chnl = Array[i+4];
-		u8 *val = Array[i+5];
+		u8 *bandwidth = Array[i + 1];
+		u8 *rate = Array[i + 2];
+		u8 *rfPath = Array[i + 3];
+		u8 *chnl = Array[i + 4];
+		u8 *val = Array[i + 5];
 
 		odm_ConfigBB_TXPWR_LMT_8723B(pDM_Odm,
 					     regulation,
Signature · 1 line
2.47.3
#13 lore raw

PATCH 10/10 staging: rtl8723bs: Fix blank line checks in HalHWImg8723B_RF.c

In reply to Mahad Ibrahim

Fix checkpatch.pl checks regarding:
-Please use a blank line after function/struct/union/enum
declarations.

-Please don't use multiple blank lines.

Adhere to kernel coding style by fixing blank line checks.

---
 drivers/staging/rtl8723bs/hal/HalHWImg8723B_RF.c | 8 +++++++-
 1 file changed, 7 insertions(+), 1 deletion(-)
drivers/staging/rtl8723bs/hal/HalHWImg8723B_RF.c +7 -1
index 1ae82afbcb64..8f875a546a33 100644
@@ -271,30 +271,37 @@ static u8 gDeltaSwingTableIdx_MP_2GB_N_TxPowerTrack_SDIO_8723B[] = {
 	0, 0, 1, 2, 2, 2, 3, 3, 3, 4,  5,  5,  6,  6, 6,  6,
 	7,  7,  7, 8,  8,  9,  9, 10, 10, 11, 12, 13, 14, 15
 };
+
 static u8 gDeltaSwingTableIdx_MP_2GB_P_TxPowerTrack_SDIO_8723B[] = {
 	0, 0, 1, 2, 2, 3, 3, 4, 5, 5,  6,  6,  7,  7,  8,  8,
 	9,  9, 10, 10, 10, 11, 11, 12, 12, 13, 13, 14, 15, 15
 };
+
 static u8 gDeltaSwingTableIdx_MP_2GA_N_TxPowerTrack_SDIO_8723B[] = {
 	0, 0, 1, 2, 2, 2, 3, 3, 3, 4,  5,  5,  6,  6,  6,  6,
 	7,  7,  7,  8,  8,  9,  9, 10, 10, 11, 12, 13, 14, 15
 };
+
 static u8 gDeltaSwingTableIdx_MP_2GA_P_TxPowerTrack_SDIO_8723B[] = {
 	0, 0, 1, 2, 2, 3, 3, 4, 5, 5,  6,  6,  7,  7,  8,  8,
 	9,  9, 10, 10, 10, 11, 11, 12, 12, 13, 13, 14, 15, 15
 };
+
 static u8 gDeltaSwingTableIdx_MP_2GCCKB_N_TxPowerTrack_SDIO_8723B[] = {
 	0, 0, 1, 2, 2, 3, 3, 4, 4, 5,  6,  6,  7,  7,  7,  8,
 	8,  8,  9,  9,  9, 10, 10, 11, 11, 12, 12, 13, 14, 15
 };
+
 static u8 gDeltaSwingTableIdx_MP_2GCCKB_P_TxPowerTrack_SDIO_8723B[] = {
 	0, 0, 1, 2, 2, 2, 3, 3, 3, 4,  5,  5,  6,  6,  7,  7,
 	8,  8,  9,  9,  9, 10, 10, 11, 11, 12, 12, 13, 14, 15
 };
+
 static u8 gDeltaSwingTableIdx_MP_2GCCKA_N_TxPowerTrack_SDIO_8723B[] = {
 	0, 0, 1, 2, 2, 3, 3, 4, 4, 5,  6,  6,  7,  7,  7,  8,
 	8,  8,  9,  9,  9, 10, 10, 11, 11, 12, 12, 13, 14, 15
 };
+
 static u8 gDeltaSwingTableIdx_MP_2GCCKA_P_TxPowerTrack_SDIO_8723B[] = {
 	0, 0, 1, 2, 2, 2, 3, 3, 3, 4,  5,  5,  6,  6,  7,  7,
 	8,  8,  9,  9,  9, 10, 10, 11, 11, 12, 12, 13, 14, 15
@@ -304,7 +311,6 @@ void ODM_ReadAndConfig_MP_8723B_TxPowerTrack_SDIO(struct dm_odm_t *pDM_Odm)
 {
 	struct odm_rf_cal_t *pRFCalibrateInfo = &pDM_Odm->RFCalibrateInfo;
 
-
 	memcpy(pRFCalibrateInfo->DeltaSwingTableIdx_2GA_P,
 	       gDeltaSwingTableIdx_MP_2GA_P_TxPowerTrack_SDIO_8723B,
 	       DELTA_SWINGIDX_SIZE);
Signature · 1 line
2.47.3