Skip to contentSkip to conversation

staging: rtl8723bs: coding style cleanup in hal_com.c

PATCH In review Marc Finkelbaum 3 participants 19 messages Apr 14 Staging

lore
Share & tools
lore
#0 lore raw

cover staging: rtl8723bs: coding style cleanup in hal_com.c

This series cleans up checkpatch --strict warnings in drivers/staging/rtl8723bs/hal/hal_com.c. All changes are purely cosmetic; the compiled .text section is byte-identical before and after the series (verified with objdump -d).

Marc Finkelbaum (9):
staging: rtl8723bs: remove extra blank lines
staging: rtl8723bs: fix space-before-tab whitespace
staging: rtl8723bs: fix block comment alignment
staging: rtl8723bs: add spaces around binary operators
staging: rtl8723bs: add space before inline block comments
staging: rtl8723bs: fix Yoda conditions and == false comparisons
staging: rtl8723bs: reformat multi-line function signatures
staging: rtl8723bs: reformat switch-case blocks with braced bodies
staging: rtl8723bs: wrap long lines and fix argument alignment

 drivers/staging/rtl8723bs/hal/hal_com.c | 296 ++++++++++++------------
 1 file changed, 146 insertions(+), 150 deletions(-)
Signature · 1 line
2.53.0
#1 lore raw

PATCH 1/9 staging: rtl8723bs: remove extra blank lines

Remove double blank lines between function definitions and between a function end and the following macro definition. Also remove spurious blank lines at the start of an if/else body and trailing blank lines before a closing brace in _TwoOutPipeMapping, _ThreeOutPipeMapping, Hal_MappingOutPipe, and the HalSetBrateCfg rate loop.

No functional change.

---
 drivers/staging/rtl8723bs/hal/hal_com.c | 13 -------------
 1 file changed, 13 deletions(-)
drivers/staging/rtl8723bs/hal/hal_com.c +0 -13
index 31b3e880ae6a..0c3e983a1b2c 100644
@@ -30,7 +30,6 @@ void rtw_hal_data_deinit(struct adapter *padapter)
 	}
 }
 
-
 void dump_chip_info(struct hal_version	ChipVersion)
 {
 	char buf[128];
@@ -71,7 +70,6 @@ void dump_chip_info(struct hal_version	ChipVersion)
 	cnt += scnprintf(buf + cnt, sizeof(buf) - cnt, "RomVer(%d)\n", ChipVersion.ROMVer);
 }
 
-
 #define	EEPROM_CHANNEL_PLAN_BY_HW_MASK	0x80
 
 /*
@@ -294,7 +292,6 @@ void HalSetBrateCfg(struct adapter *Adapter, u8 *mBratesOS, u16 *pBrateCfg)
 	u8 i, is_brate, brate;
 
 	for (i = 0; i < NDIS_802_11_LENGTH_RATES_EX; i++) {
-
 		is_brate = mBratesOS[i] & IEEE80211_BASIC_RATE_MASK;
 		brate = mBratesOS[i] & 0x7f;
 
@@ -361,7 +358,6 @@ static void _TwoOutPipeMapping(struct adapter *padapter, bool bWIFICfg)
 	struct dvobj_priv *pdvobjpriv = adapter_to_dvobj(padapter);
 
 	if (bWIFICfg) { /* WMM */
-
 		/* 	BK,	BE,	VI,	VO,	BCN,	CMD, MGT, HIGH, HCCA */
 		/*   0,		1,	0,	1,	0,	0,	0,	0,		0	}; */
 		/* 0:ep_0 num, 1:ep_1 num */
@@ -377,8 +373,6 @@ static void _TwoOutPipeMapping(struct adapter *padapter, bool bWIFICfg)
 		pdvobjpriv->Queue2Pipe[7] = pdvobjpriv->RtOutPipe[0];/* TXCMD */
 
 	} else { /* typical setting */
-
-
 		/* BK,	BE,	VI,	VO,	BCN,	CMD, MGT, HIGH, HCCA */
 		/*   1,		1,	0,	0,	0,	0,	0,	0,		0	}; */
 		/* 0:ep_0 num, 1:ep_1 num */
@@ -394,7 +388,6 @@ static void _TwoOutPipeMapping(struct adapter *padapter, bool bWIFICfg)
 		pdvobjpriv->Queue2Pipe[7] = pdvobjpriv->RtOutPipe[0];/* TXCMD */
 
 	}
-
 }
 
 static void _ThreeOutPipeMapping(struct adapter *padapter, bool bWIFICfg)
@@ -402,7 +395,6 @@ static void _ThreeOutPipeMapping(struct adapter *padapter, bool bWIFICfg)
 	struct dvobj_priv *pdvobjpriv = adapter_to_dvobj(padapter);
 
 	if (bWIFICfg) { /* for WMM */
-
 		/* 	BK,	BE,	VI,	VO,	BCN,	CMD, MGT, HIGH, HCCA */
 		/*   1,		2,	1,	0,	0,	0,	0,	0,		0	}; */
 		/* 0:H, 1:N, 2:L */
@@ -418,8 +410,6 @@ static void _ThreeOutPipeMapping(struct adapter *padapter, bool bWIFICfg)
 		pdvobjpriv->Queue2Pipe[7] = pdvobjpriv->RtOutPipe[0];/* TXCMD */
 
 	} else { /* typical setting */
-
-
 		/* 	BK,	BE,	VI,	VO,	BCN,	CMD, MGT, HIGH, HCCA */
 		/*   2,		2,	1,	0,	0,	0,	0,	0,		0	}; */
 		/* 0:H, 1:N, 2:L */
@@ -434,7 +424,6 @@ static void _ThreeOutPipeMapping(struct adapter *padapter, bool bWIFICfg)
 		pdvobjpriv->Queue2Pipe[6] = pdvobjpriv->RtOutPipe[0];/* HIGH */
 		pdvobjpriv->Queue2Pipe[7] = pdvobjpriv->RtOutPipe[0];/* TXCMD */
 	}
-
 }
 
 bool Hal_MappingOutPipe(struct adapter *padapter, u8 NumOutPipe)
@@ -462,7 +451,6 @@ bool Hal_MappingOutPipe(struct adapter *padapter, u8 NumOutPipe)
 	}
 
 	return result;
-
 }
 
 void hal_init_macaddr(struct adapter *adapter)
@@ -749,7 +737,6 @@ void SetHalODMVar(
 	}
 }
 
-
 bool eqNByte(u8 *str1, u8 *str2, u32 num)
 {
 	if (num == 0)
Signature · 1 line
2.53.0
#2 lore raw

Re: [PATCH 1/9] staging: rtl8723bs: remove extra blank lines

Quoted 7 lines · Marc Finkelbaum

Remove double blank lines between function definitions and between a function end and the following macro definition. Also remove spurious blank lines at the start of an if/else body and trailing blank lines before a closing brace in _TwoOutPipeMapping, _ThreeOutPipeMapping, Hal_MappingOutPipe, and the HalSetBrateCfg rate loop.

No functional change.

...

drivers/staging/rtl8723bs/hal/hal_com.c static void _TwoOutPipeMapping(struct adapter *padapter, bool bWIFICfg) · line 390

Quoted 4 lines
drivers/staging/rtl8723bs/hal/hal_com.c +0 -0
@@ -394,7 +388,6 @@ static void _TwoOutPipeMapping(struct adapter *padapter, bool bWIFICfg)
 		pdvobjpriv->Queue2Pipe[7] = pdvobjpriv->RtOutPipe[0];/* TXCMD */
 
 

Haven't you missed to remove this one as well? Or even more if there are other similar cases...

Quoted 5 lines
drivers/staging/rtl8723bs/hal/hal_com.c +0 -1
 	}
-
 }
 

static void _ThreeOutPipeMapping(struct adapter *padapter, bool bWIFICfg)

Signature · 2 lines
With Best Regards,
Andy Shevchenko
#3 lore raw

PATCH 2/9 staging: rtl8723bs: fix space-before-tab whitespace

In reply to Marc Finkelbaum

Replace tab characters with a single space in macro definitions (EEPROM_CHANNEL_PLAN_BY_HW_MASK, REG_RF_BB_GAIN_OFFSET), the dump_chip_info parameter list, the pHalData pointer declaration in SetHalODMVar, and the BK/BE/VI/VO tabular comments inside _TwoOutPipeMapping and _ThreeOutPipeMapping.

No functional change.

---
 drivers/staging/rtl8723bs/hal/hal_com.c | 14 +++++++-------
 1 file changed, 7 insertions(+), 7 deletions(-)
drivers/staging/rtl8723bs/hal/hal_com.c +7 -7
index 0c3e983a1b2c..07e4da49d757 100644
@@ -30,7 +30,7 @@ void rtw_hal_data_deinit(struct adapter *padapter)
 	}
 }
 
-void dump_chip_info(struct hal_version	ChipVersion)
+void dump_chip_info(struct hal_version ChipVersion)
 {
 	char buf[128];
 	size_t cnt = 0;
@@ -70,7 +70,7 @@ void dump_chip_info(struct hal_version	ChipVersion)
 	cnt += scnprintf(buf + cnt, sizeof(buf) - cnt, "RomVer(%d)\n", ChipVersion.ROMVer);
 }
 
-#define	EEPROM_CHANNEL_PLAN_BY_HW_MASK	0x80
+#define EEPROM_CHANNEL_PLAN_BY_HW_MASK 0x80
 
 /*
  * Description:
@@ -358,7 +358,7 @@ static void _TwoOutPipeMapping(struct adapter *padapter, bool bWIFICfg)
 	struct dvobj_priv *pdvobjpriv = adapter_to_dvobj(padapter);
 
 	if (bWIFICfg) { /* WMM */
-		/* 	BK,	BE,	VI,	VO,	BCN,	CMD, MGT, HIGH, HCCA */
+		/*	BK,	BE,	VI,	VO,	BCN,	CMD, MGT, HIGH, HCCA */
 		/*   0,		1,	0,	1,	0,	0,	0,	0,		0	}; */
 		/* 0:ep_0 num, 1:ep_1 num */
 
@@ -395,7 +395,7 @@ static void _ThreeOutPipeMapping(struct adapter *padapter, bool bWIFICfg)
 	struct dvobj_priv *pdvobjpriv = adapter_to_dvobj(padapter);
 
 	if (bWIFICfg) { /* for WMM */
-		/* 	BK,	BE,	VI,	VO,	BCN,	CMD, MGT, HIGH, HCCA */
+		/*	BK,	BE,	VI,	VO,	BCN,	CMD, MGT, HIGH, HCCA */
 		/*   1,		2,	1,	0,	0,	0,	0,	0,		0	}; */
 		/* 0:H, 1:N, 2:L */
 
@@ -410,7 +410,7 @@ static void _ThreeOutPipeMapping(struct adapter *padapter, bool bWIFICfg)
 		pdvobjpriv->Queue2Pipe[7] = pdvobjpriv->RtOutPipe[0];/* TXCMD */
 
 	} else { /* typical setting */
-		/* 	BK,	BE,	VI,	VO,	BCN,	CMD, MGT, HIGH, HCCA */
+		/*	BK,	BE,	VI,	VO,	BCN,	CMD, MGT, HIGH, HCCA */
 		/*   2,		2,	1,	0,	0,	0,	0,	0,		0	}; */
 		/* 0:H, 1:N, 2:L */
 
@@ -708,7 +708,7 @@ void SetHalODMVar(
 	bool bSet
 )
 {
-	struct hal_com_data	*pHalData = GET_HAL_DATA(Adapter);
+	struct hal_com_data *pHalData = GET_HAL_DATA(Adapter);
 	struct dm_odm_t *podmpriv = &pHalData->odmpriv;
 	/* _irqL irqL; */
 	switch (eVariable) {
@@ -786,7 +786,7 @@ static u32 Array_kfreemap[] = {
 	0xfc, 0x0,
 };
 
-#define		REG_RF_BB_GAIN_OFFSET	0x7f
+#define REG_RF_BB_GAIN_OFFSET 0x7f
 //#define		RF_GAIN_OFFSET_MASK	0xfffff
 
 void rtw_bb_rf_gain_offset(struct adapter *padapter)
Signature · 1 line
2.53.0
#4 lore raw

Re: [PATCH 2/9] staging: rtl8723bs: fix space-before-tab whitespace

Quoted 7 lines · Marc Finkelbaum

Replace tab characters with a single space in macro definitions (EEPROM_CHANNEL_PLAN_BY_HW_MASK, REG_RF_BB_GAIN_OFFSET), the dump_chip_info parameter list, the pHalData pointer declaration in SetHalODMVar, and the BK/BE/VI/VO tabular comments inside _TwoOutPipeMapping and _ThreeOutPipeMapping.

No functional change.

...

drivers/staging/rtl8723bs/hal/hal_com.c void dump_chip_info(struct hal_version ChipVersion) · line 73

Quoted 2 lines
drivers/staging/rtl8723bs/hal/hal_com.c +1 -1
-#define	EEPROM_CHANNEL_PLAN_BY_HW_MASK	0x80
+#define EEPROM_CHANNEL_PLAN_BY_HW_MASK 0x80

Please, leave tab indentation of the value (between K and 0).

...

drivers/staging/rtl8723bs/hal/hal_com.c static u32 Array_kfreemap[] = { · line 789

Quoted 2 lines
drivers/staging/rtl8723bs/hal/hal_com.c +1 -1
-#define		REG_RF_BB_GAIN_OFFSET	0x7f
+#define REG_RF_BB_GAIN_OFFSET 0x7f

Ditto.

Quoted 1 line

//#define RF_GAIN_OFFSET_MASK 0xfffff

This (and these in general) has to be fixed accordingly as it's clearly not an example of the code in the comment, but a real code that got commented out for some reason. For the latter the style should be adjusted accordingly.

Signature · 2 lines
With Best Regards,
Andy Shevchenko
#5 lore raw

PATCH 3/9 staging: rtl8723bs: fix block comment alignment

In reply to Marc Finkelbaum

Add the required space after the opening '/*' on continuation lines in four block comments: the two C2H event format header tables, the clear_evt inline comment, and the HW_VAR_DM_FUNC_CLR comment in SetHwReg.

No functional change.

---
 drivers/staging/rtl8723bs/hal/hal_com.c | 28 ++++++++++++-------------
 1 file changed, 14 insertions(+), 14 deletions(-)
drivers/staging/rtl8723bs/hal/hal_com.c +14 -14
index 07e4da49d757..be8b5e1dbab5 100644
@@ -466,10 +466,10 @@ void rtw_init_hal_com_default_value(struct adapter *Adapter)
 }
 
 /*
-* C2H event format:
-* Field	 TRIGGER		CONTENT	   CMD_SEQ	CMD_LEN		 CMD_ID
-* BITS	 [127:120]	[119:16]      [15:8]		  [7:4]		   [3:0]
-*/
+ * C2H event format:
+ * Field	 TRIGGER		CONTENT	   CMD_SEQ	CMD_LEN		 CMD_ID
+ * BITS	 [127:120]	[119:16]      [15:8]		  [7:4]		   [3:0]
+ */
 
 void c2h_evt_clear(struct adapter *adapter)
 {
@@ -477,10 +477,10 @@ void c2h_evt_clear(struct adapter *adapter)
 }
 
 /*
-* C2H event format:
-* Field    TRIGGER    CMD_LEN    CONTENT    CMD_SEQ    CMD_ID
-* BITS    [127:120]   [119:112]    [111:16]	     [15:8]         [7:0]
-*/
+ * C2H event format:
+ * Field    TRIGGER    CMD_LEN    CONTENT    CMD_SEQ    CMD_ID
+ * BITS    [127:120]   [119:112]    [111:16]	     [15:8]         [7:0]
+ */
 s32 c2h_evt_read_88xx(struct adapter *adapter, u8 *buf)
 {
 	s32 ret = _FAIL;
@@ -514,9 +514,9 @@ s32 c2h_evt_read_88xx(struct adapter *adapter, u8 *buf)
 
 clear_evt:
 	/*
-	* Clear event to notify FW we have read the command.
-	* If this field isn't clear, the FW won't update the next command message.
-	*/
+	 * Clear event to notify FW we have read the command.
+	 * If this field isn't clear, the FW won't update the next command message.
+	 */
 	c2h_evt_clear(adapter);
 exit:
 	return ret;
@@ -612,9 +612,9 @@ void SetHwReg(struct adapter *adapter, u8 variable, u8 *val)
 		break;
 	case HW_VAR_DM_FUNC_CLR:
 		/*
-		* input is already a mask to clear function
-		* don't invert it again! George, Lucas@20130513
-		*/
+		 * input is already a mask to clear function
+		 * don't invert it again! George, Lucas@20130513
+		 */
 		odm->SupportAbility &= *((u32 *)val);
 		break;
 	case HW_VAR_AMPDU_MIN_SPACE:
Signature · 1 line
2.53.0
#6 lore raw

Re: [PATCH 3/9] staging: rtl8723bs: fix block comment alignment

Quoted 6 lines · Marc Finkelbaum

Add the required space after the opening '/*' on continuation lines in four block comments: the two C2H event format header tables, the clear_evt inline comment, and the HW_VAR_DM_FUNC_CLR comment in SetHwReg.

No functional change.

...

drivers/staging/rtl8723bs/hal/hal_com.c void rtw_init_hal_com_default_value(struct adapter *Adapter) · line 472

Quoted 9 lines

/*

drivers/staging/rtl8723bs/hal/hal_com.c +4 -4
-* C2H event format:
-* Field	 TRIGGER		CONTENT	   CMD_SEQ	CMD_LEN		 CMD_ID
-* BITS	 [127:120]	[119:16]      [15:8]		  [7:4]		   [3:0]
-*/
+ * C2H event format:
+ * Field	 TRIGGER		CONTENT	   CMD_SEQ	CMD_LEN		 CMD_ID
+ * BITS	 [127:120]	[119:16]      [15:8]		  [7:4]		   [3:0]
+ */

These tables (here and below) are formatted with mixing tab and spaces...

You need to fix that properly to use either tab-based or space-based one, not the mixed (current) one.

...

drivers/staging/rtl8723bs/hal/hal_com.c void SetHwReg(struct adapter *adapter, u8 variable, u8 *val) · line 617

Quoted 7 lines
drivers/staging/rtl8723bs/hal/hal_com.c +3 -3
 		/*
-		* input is already a mask to clear function
-		* don't invert it again! George, Lucas@20130513
-		*/
+		 * input is already a mask to clear function
+		 * don't invert it again! George, Lucas@20130513
+		 */

While at it, fix also English grammar and punctuation.

		/*
		 * Input is already a mask to clear function,
		 * don't invert it again! George, Lucas@20130513
		 */
Signature · 2 lines
With Best Regards,
Andy Shevchenko
#7 lore raw

PATCH 4/9 staging: rtl8723bs: add spaces around binary operators

In reply to Marc Finkelbaum

Add missing spaces around |, &, +, /, and % operators in bitfield OR expressions (SCR_* flags, BIT* masks), array index arithmetic in HalSetBrateCfg and rtw_bb_rf_gain_offset, and the register offset arithmetic in rtw_hal_check_rxfifo_full.

No functional change.

---
 drivers/staging/rtl8723bs/hal/hal_com.c | 20 ++++++++++----------
 1 file changed, 10 insertions(+), 10 deletions(-)
drivers/staging/rtl8723bs/hal/hal_com.c +10 -10
index be8b5e1dbab5..2f76d04aa9d3 100644
@@ -540,7 +540,7 @@ void rtw_hal_update_sta_rate_mask(struct adapter *padapter, struct sta_info *pst
 	/* b/g mode ra_bitmap */
 	for (i = 0; i < sizeof(psta->bssrateset); i++) {
 		if (psta->bssrateset[i])
-			tx_ra_bitmap |= rtw_get_bit_value_from_ieee_value(psta->bssrateset[i]&0x7f);
+			tx_ra_bitmap |= rtw_get_bit_value_from_ieee_value(psta->bssrateset[i] & 0x7f);
 	}
 
 	/* n mode ra_bitmap */
@@ -548,13 +548,13 @@ void rtw_hal_update_sta_rate_mask(struct adapter *padapter, struct sta_info *pst
 		limit = 8; /*   1R */
 
 		for (i = 0; i < limit; i++) {
-			if (psta->htpriv.ht_cap.mcs.rx_mask[i/8] & BIT(i%8))
-				tx_ra_bitmap |= BIT(i+12);
+			if (psta->htpriv.ht_cap.mcs.rx_mask[i / 8] & BIT(i % 8))
+				tx_ra_bitmap |= BIT(i + 12);
 		}
 	}
 
 	psta->ra_mask = tx_ra_bitmap;
-	psta->init_rate = get_highest_rate_idx(tx_ra_bitmap)&0x3f;
+	psta->init_rate = get_highest_rate_idx(tx_ra_bitmap) & 0x3f;
 }
 
 void SetHwReg(struct adapter *adapter, u8 variable, u8 *val)
@@ -571,7 +571,7 @@ void SetHwReg(struct adapter *adapter, u8 variable, u8 *val)
 		u16 reg_scr;
 
 		reg_scr = rtw_read16(adapter, REG_SECCFG);
-		rtw_write16(adapter, REG_SECCFG, reg_scr|SCR_CHK_KEYID|SCR_RxDecEnable|SCR_TxEncEnable);
+		rtw_write16(adapter, REG_SECCFG, reg_scr | SCR_CHK_KEYID | SCR_RxDecEnable | SCR_TxEncEnable);
 	}
 		break;
 	case HW_VAR_SEC_DK_CFG:
@@ -582,9 +582,9 @@ void SetHwReg(struct adapter *adapter, u8 variable, u8 *val)
 		if (val) { /* Enable default key related setting */
 			reg_scr |= SCR_TXBCUSEDK;
 			if (sec->dot11AuthAlgrthm != dot11AuthAlgrthm_8021X)
-				reg_scr |= (SCR_RxUseDK|SCR_TxUseDK);
+				reg_scr |= (SCR_RxUseDK | SCR_TxUseDK);
 		} else /* Disable default key related setting */
-			reg_scr &= ~(SCR_RXBCUSEDK|SCR_TXBCUSEDK|SCR_RxUseDK|SCR_TxUseDK);
+			reg_scr &= ~(SCR_RXBCUSEDK | SCR_TXBCUSEDK | SCR_RxUseDK | SCR_TxUseDK);
 
 		rtw_write8(adapter, REG_SECCFG, reg_scr);
 	}
@@ -770,7 +770,7 @@ bool GetU1ByteIntegerFromStringInDecimal(char *Str, u8 *pInt)
 void rtw_hal_check_rxfifo_full(struct adapter *adapter)
 {
 	/* switch counter to RX fifo */
-	rtw_write8(adapter, REG_RXERR_RPT+3, rtw_read8(adapter, REG_RXERR_RPT+3)|0xf0);
+	rtw_write8(adapter, REG_RXERR_RPT + 3, rtw_read8(adapter, REG_RXERR_RPT + 3) | 0xf0);
 }
 
 static u32 Array_kfreemap[] = {
@@ -802,13 +802,13 @@ void rtw_bb_rf_gain_offset(struct adapter *padapter)
 
 			for (i = 0; i < ARRAY_SIZE(Array_kfreemap); i += 2) {
 				v1 = Array[i];
-				v2 = Array[i+1];
+				v2 = Array[i + 1];
 				if (v1 == padapter->eeprompriv.EEPROMRFGainVal) {
 					target = v2;
 					break;
 				}
 			}
-			PHY_SetRFReg(padapter, RF_PATH_A, REG_RF_BB_GAIN_OFFSET, BIT18|BIT17|BIT16|BIT15, target);
+			PHY_SetRFReg(padapter, RF_PATH_A, REG_RF_BB_GAIN_OFFSET, BIT18 | BIT17 | BIT16 | BIT15, target);
 
 			rtw_hal_read_rfreg(padapter, RF_PATH_A, 0x7f, 0xffffffff);
 		}
Signature · 1 line
2.53.0
#8 lore raw

Re: [PATCH 4/9] staging: rtl8723bs: add spaces around binary operators

Quoted 6 lines · Marc Finkelbaum

Add missing spaces around |, &, +, /, and % operators in bitfield OR expressions (SCR_* flags, BIT* masks), array index arithmetic in HalSetBrateCfg and rtw_bb_rf_gain_offset, and the register offset arithmetic in rtw_hal_check_rxfifo_full.

No functional change.

...

drivers/staging/rtl8723bs/hal/hal_com.c void rtw_hal_update_sta_rate_mask(struct adapter *padapter, struct sta_info *pst · line 553

Quoted 6 lines
drivers/staging/rtl8723bs/hal/hal_com.c +2 -2
 		for (i = 0; i < limit; i++) {
-			if (psta->htpriv.ht_cap.mcs.rx_mask[i/8] & BIT(i%8))
-				tx_ra_bitmap |= BIT(i+12);
+			if (psta->htpriv.ht_cap.mcs.rx_mask[i / 8] & BIT(i % 8))
+				tx_ra_bitmap |= BIT(i + 12);
 		}

Looking at this, ideally rx_mask should be unsigned long type (or DEFINE_BITMAP() if longer than 32-bit) and this loop either using bitops or something like bitmap_copy(), bitmap_scatter().

It's a side note, in case you want to create a real patch, and not like this "whitespace cleanup series".

...

drivers/staging/rtl8723bs/hal/hal_com.c void SetHwReg(struct adapter *adapter, u8 variable, u8 *val) · line 574

Quoted 2 lines
drivers/staging/rtl8723bs/hal/hal_com.c +1 -1
-		rtw_write16(adapter, REG_SECCFG, reg_scr|SCR_CHK_KEYID|SCR_RxDecEnable|SCR_TxEncEnable);
+		rtw_write16(adapter, REG_SECCFG, reg_scr | SCR_CHK_KEYID | SCR_RxDecEnable | SCR_TxEncEnable);

This is way too long line, wrap it.

		rtw_write16(adapter, REG_SECCFG,
			    reg_scr | SCR_CHK_KEYID | SCR_RxDecEnable | SCR_TxEncEnable);

...

drivers/staging/rtl8723bs/hal/hal_com.c bool GetU1ByteIntegerFromStringInDecimal(char *Str, u8 *pInt) · line 773

Quoted 1 line
drivers/staging/rtl8723bs/hal/hal_com.c +1 -0
+	rtw_write8(adapter, REG_RXERR_RPT + 3, rtw_read8(adapter, REG_RXERR_RPT + 3) | 0xf0);

This kind of operations are better when you introduce a helper rtw_update8(). With it it will be

	rtw_update8(adapter, REG_RXERR_RPT + 3, <mask>, 0xf0);
Signature · 2 lines
With Best Regards,
Andy Shevchenko
#9 lore raw

PATCH 5/9 staging: rtl8723bs: add space before inline block comments

In reply to Marc Finkelbaum

Add a space between the semicolon and the opening '/*' on all Queue2Pipe assignment lines in _OneOutPipeMapping, _TwoOutPipeMapping, and _ThreeOutPipeMapping.

No functional change.

---
 drivers/staging/rtl8723bs/hal/hal_com.c | 80 ++++++++++++-------------
 1 file changed, 40 insertions(+), 40 deletions(-)
drivers/staging/rtl8723bs/hal/hal_com.c +40 -40
index 2f76d04aa9d3..fcfcdfd079da 100644
@@ -342,15 +342,15 @@ static void _OneOutPipeMapping(struct adapter *padapter)
 {
 	struct dvobj_priv *pdvobjpriv = adapter_to_dvobj(padapter);
 
-	pdvobjpriv->Queue2Pipe[0] = pdvobjpriv->RtOutPipe[0];/* VO */
-	pdvobjpriv->Queue2Pipe[1] = pdvobjpriv->RtOutPipe[0];/* VI */
-	pdvobjpriv->Queue2Pipe[2] = pdvobjpriv->RtOutPipe[0];/* BE */
-	pdvobjpriv->Queue2Pipe[3] = pdvobjpriv->RtOutPipe[0];/* BK */
+	pdvobjpriv->Queue2Pipe[0] = pdvobjpriv->RtOutPipe[0]; /* VO */
+	pdvobjpriv->Queue2Pipe[1] = pdvobjpriv->RtOutPipe[0]; /* VI */
+	pdvobjpriv->Queue2Pipe[2] = pdvobjpriv->RtOutPipe[0]; /* BE */
+	pdvobjpriv->Queue2Pipe[3] = pdvobjpriv->RtOutPipe[0]; /* BK */
 
-	pdvobjpriv->Queue2Pipe[4] = pdvobjpriv->RtOutPipe[0];/* BCN */
-	pdvobjpriv->Queue2Pipe[5] = pdvobjpriv->RtOutPipe[0];/* MGT */
-	pdvobjpriv->Queue2Pipe[6] = pdvobjpriv->RtOutPipe[0];/* HIGH */
-	pdvobjpriv->Queue2Pipe[7] = pdvobjpriv->RtOutPipe[0];/* TXCMD */
+	pdvobjpriv->Queue2Pipe[4] = pdvobjpriv->RtOutPipe[0]; /* BCN */
+	pdvobjpriv->Queue2Pipe[5] = pdvobjpriv->RtOutPipe[0]; /* MGT */
+	pdvobjpriv->Queue2Pipe[6] = pdvobjpriv->RtOutPipe[0]; /* HIGH */
+	pdvobjpriv->Queue2Pipe[7] = pdvobjpriv->RtOutPipe[0]; /* TXCMD */
 }
 
 static void _TwoOutPipeMapping(struct adapter *padapter, bool bWIFICfg)
@@ -362,30 +362,30 @@ static void _TwoOutPipeMapping(struct adapter *padapter, bool bWIFICfg)
 		/*   0,		1,	0,	1,	0,	0,	0,	0,		0	}; */
 		/* 0:ep_0 num, 1:ep_1 num */
 
-		pdvobjpriv->Queue2Pipe[0] = pdvobjpriv->RtOutPipe[1];/* VO */
-		pdvobjpriv->Queue2Pipe[1] = pdvobjpriv->RtOutPipe[0];/* VI */
-		pdvobjpriv->Queue2Pipe[2] = pdvobjpriv->RtOutPipe[1];/* BE */
-		pdvobjpriv->Queue2Pipe[3] = pdvobjpriv->RtOutPipe[0];/* BK */
+		pdvobjpriv->Queue2Pipe[0] = pdvobjpriv->RtOutPipe[1]; /* VO */
+		pdvobjpriv->Queue2Pipe[1] = pdvobjpriv->RtOutPipe[0]; /* VI */
+		pdvobjpriv->Queue2Pipe[2] = pdvobjpriv->RtOutPipe[1]; /* BE */
+		pdvobjpriv->Queue2Pipe[3] = pdvobjpriv->RtOutPipe[0]; /* BK */
 
-		pdvobjpriv->Queue2Pipe[4] = pdvobjpriv->RtOutPipe[0];/* BCN */
-		pdvobjpriv->Queue2Pipe[5] = pdvobjpriv->RtOutPipe[0];/* MGT */
-		pdvobjpriv->Queue2Pipe[6] = pdvobjpriv->RtOutPipe[0];/* HIGH */
-		pdvobjpriv->Queue2Pipe[7] = pdvobjpriv->RtOutPipe[0];/* TXCMD */
+		pdvobjpriv->Queue2Pipe[4] = pdvobjpriv->RtOutPipe[0]; /* BCN */
+		pdvobjpriv->Queue2Pipe[5] = pdvobjpriv->RtOutPipe[0]; /* MGT */
+		pdvobjpriv->Queue2Pipe[6] = pdvobjpriv->RtOutPipe[0]; /* HIGH */
+		pdvobjpriv->Queue2Pipe[7] = pdvobjpriv->RtOutPipe[0]; /* TXCMD */
 
 	} else { /* typical setting */
 		/* BK,	BE,	VI,	VO,	BCN,	CMD, MGT, HIGH, HCCA */
 		/*   1,		1,	0,	0,	0,	0,	0,	0,		0	}; */
 		/* 0:ep_0 num, 1:ep_1 num */
 
-		pdvobjpriv->Queue2Pipe[0] = pdvobjpriv->RtOutPipe[0];/* VO */
-		pdvobjpriv->Queue2Pipe[1] = pdvobjpriv->RtOutPipe[0];/* VI */
-		pdvobjpriv->Queue2Pipe[2] = pdvobjpriv->RtOutPipe[1];/* BE */
-		pdvobjpriv->Queue2Pipe[3] = pdvobjpriv->RtOutPipe[1];/* BK */
+		pdvobjpriv->Queue2Pipe[0] = pdvobjpriv->RtOutPipe[0]; /* VO */
+		pdvobjpriv->Queue2Pipe[1] = pdvobjpriv->RtOutPipe[0]; /* VI */
+		pdvobjpriv->Queue2Pipe[2] = pdvobjpriv->RtOutPipe[1]; /* BE */
+		pdvobjpriv->Queue2Pipe[3] = pdvobjpriv->RtOutPipe[1]; /* BK */
 
-		pdvobjpriv->Queue2Pipe[4] = pdvobjpriv->RtOutPipe[0];/* BCN */
-		pdvobjpriv->Queue2Pipe[5] = pdvobjpriv->RtOutPipe[0];/* MGT */
-		pdvobjpriv->Queue2Pipe[6] = pdvobjpriv->RtOutPipe[0];/* HIGH */
-		pdvobjpriv->Queue2Pipe[7] = pdvobjpriv->RtOutPipe[0];/* TXCMD */
+		pdvobjpriv->Queue2Pipe[4] = pdvobjpriv->RtOutPipe[0]; /* BCN */
+		pdvobjpriv->Queue2Pipe[5] = pdvobjpriv->RtOutPipe[0]; /* MGT */
+		pdvobjpriv->Queue2Pipe[6] = pdvobjpriv->RtOutPipe[0]; /* HIGH */
+		pdvobjpriv->Queue2Pipe[7] = pdvobjpriv->RtOutPipe[0]; /* TXCMD */
 
 	}
 }
@@ -399,30 +399,30 @@ static void _ThreeOutPipeMapping(struct adapter *padapter, bool bWIFICfg)
 		/*   1,		2,	1,	0,	0,	0,	0,	0,		0	}; */
 		/* 0:H, 1:N, 2:L */
 
-		pdvobjpriv->Queue2Pipe[0] = pdvobjpriv->RtOutPipe[0];/* VO */
-		pdvobjpriv->Queue2Pipe[1] = pdvobjpriv->RtOutPipe[1];/* VI */
-		pdvobjpriv->Queue2Pipe[2] = pdvobjpriv->RtOutPipe[2];/* BE */
-		pdvobjpriv->Queue2Pipe[3] = pdvobjpriv->RtOutPipe[1];/* BK */
+		pdvobjpriv->Queue2Pipe[0] = pdvobjpriv->RtOutPipe[0]; /* VO */
+		pdvobjpriv->Queue2Pipe[1] = pdvobjpriv->RtOutPipe[1]; /* VI */
+		pdvobjpriv->Queue2Pipe[2] = pdvobjpriv->RtOutPipe[2]; /* BE */
+		pdvobjpriv->Queue2Pipe[3] = pdvobjpriv->RtOutPipe[1]; /* BK */
 
-		pdvobjpriv->Queue2Pipe[4] = pdvobjpriv->RtOutPipe[0];/* BCN */
-		pdvobjpriv->Queue2Pipe[5] = pdvobjpriv->RtOutPipe[0];/* MGT */
-		pdvobjpriv->Queue2Pipe[6] = pdvobjpriv->RtOutPipe[0];/* HIGH */
-		pdvobjpriv->Queue2Pipe[7] = pdvobjpriv->RtOutPipe[0];/* TXCMD */
+		pdvobjpriv->Queue2Pipe[4] = pdvobjpriv->RtOutPipe[0]; /* BCN */
+		pdvobjpriv->Queue2Pipe[5] = pdvobjpriv->RtOutPipe[0]; /* MGT */
+		pdvobjpriv->Queue2Pipe[6] = pdvobjpriv->RtOutPipe[0]; /* HIGH */
+		pdvobjpriv->Queue2Pipe[7] = pdvobjpriv->RtOutPipe[0]; /* TXCMD */
 
 	} else { /* typical setting */
 		/*	BK,	BE,	VI,	VO,	BCN,	CMD, MGT, HIGH, HCCA */
 		/*   2,		2,	1,	0,	0,	0,	0,	0,		0	}; */
 		/* 0:H, 1:N, 2:L */
 
-		pdvobjpriv->Queue2Pipe[0] = pdvobjpriv->RtOutPipe[0];/* VO */
-		pdvobjpriv->Queue2Pipe[1] = pdvobjpriv->RtOutPipe[1];/* VI */
-		pdvobjpriv->Queue2Pipe[2] = pdvobjpriv->RtOutPipe[2];/* BE */
-		pdvobjpriv->Queue2Pipe[3] = pdvobjpriv->RtOutPipe[2];/* BK */
+		pdvobjpriv->Queue2Pipe[0] = pdvobjpriv->RtOutPipe[0]; /* VO */
+		pdvobjpriv->Queue2Pipe[1] = pdvobjpriv->RtOutPipe[1]; /* VI */
+		pdvobjpriv->Queue2Pipe[2] = pdvobjpriv->RtOutPipe[2]; /* BE */
+		pdvobjpriv->Queue2Pipe[3] = pdvobjpriv->RtOutPipe[2]; /* BK */
 
-		pdvobjpriv->Queue2Pipe[4] = pdvobjpriv->RtOutPipe[0];/* BCN */
-		pdvobjpriv->Queue2Pipe[5] = pdvobjpriv->RtOutPipe[0];/* MGT */
-		pdvobjpriv->Queue2Pipe[6] = pdvobjpriv->RtOutPipe[0];/* HIGH */
-		pdvobjpriv->Queue2Pipe[7] = pdvobjpriv->RtOutPipe[0];/* TXCMD */
+		pdvobjpriv->Queue2Pipe[4] = pdvobjpriv->RtOutPipe[0]; /* BCN */
+		pdvobjpriv->Queue2Pipe[5] = pdvobjpriv->RtOutPipe[0]; /* MGT */
+		pdvobjpriv->Queue2Pipe[6] = pdvobjpriv->RtOutPipe[0]; /* HIGH */
+		pdvobjpriv->Queue2Pipe[7] = pdvobjpriv->RtOutPipe[0]; /* TXCMD */
 	}
 }
 
Signature · 1 line
2.53.0
#10 lore raw

Re: [PATCH 5/9] staging: rtl8723bs: add space before inline block comments

Quoted 5 lines · Marc Finkelbaum

Add a space between the semicolon and the opening '/*' on all Queue2Pipe assignment lines in _OneOutPipeMapping, _TwoOutPipeMapping, and _ThreeOutPipeMapping.

No functional change.

...

drivers/staging/rtl8723bs/hal/hal_com.c static void _OneOutPipeMapping(struct adapter *padapter) · line 353

Quoted 9 lines
drivers/staging/rtl8723bs/hal/hal_com.c +8 -0
+	pdvobjpriv->Queue2Pipe[0] = pdvobjpriv->RtOutPipe[0]; /* VO */
+	pdvobjpriv->Queue2Pipe[1] = pdvobjpriv->RtOutPipe[0]; /* VI */
+	pdvobjpriv->Queue2Pipe[2] = pdvobjpriv->RtOutPipe[0]; /* BE */
+	pdvobjpriv->Queue2Pipe[3] = pdvobjpriv->RtOutPipe[0]; /* BK */
 
+	pdvobjpriv->Queue2Pipe[4] = pdvobjpriv->RtOutPipe[0]; /* BCN */
+	pdvobjpriv->Queue2Pipe[5] = pdvobjpriv->RtOutPipe[0]; /* MGT */
+	pdvobjpriv->Queue2Pipe[6] = pdvobjpriv->RtOutPipe[0]; /* HIGH */
+	pdvobjpriv->Queue2Pipe[7] = pdvobjpriv->RtOutPipe[0]; /* TXCMD */

I would rather have something like

enum {
	RTL8723BS_PIPE_VO,
	RTL8723BS_PIPE_VI,
	...
};

and replace indices on the left by the enum values and drop comments.

Signature · 2 lines
With Best Regards,
Andy Shevchenko
#11 lore raw

PATCH 6/9 staging: rtl8723bs: fix Yoda conditions and == false comparisons

In reply to Marc Finkelbaum

Replace reversed comparisons with natural-order equivalents:
- '0xFF == hw_channel_plan' -> 'hw_channel_plan == 0xFF'
- 'false == pHalData->bDisableSWChannelPlan' -> '!pHalData->...'
- 'is_supported_24g(...) == false' -> '!is_supported_24g(...)'

The multi-line if condition around bDisableSWChannelPlan is also reformatted to standard kernel one-line style.

No functional change.

---
 drivers/staging/rtl8723bs/hal/hal_com.c | 10 ++++------
 1 file changed, 4 insertions(+), 6 deletions(-)
drivers/staging/rtl8723bs/hal/hal_com.c +4 -6
index fcfcdfd079da..dc5e6a58fd9d 100644
@@ -105,7 +105,7 @@ u8 hal_com_config_channel_plan(
 	pHalData->bDisableSWChannelPlan = false;
 	chnlPlan = def_channel_plan;
 
-	if (0xFF == hw_channel_plan)
+	if (hw_channel_plan == 0xFF)
 		AutoLoadFail = true;
 
 	if (!AutoLoadFail) {
@@ -120,10 +120,8 @@ u8 hal_com_config_channel_plan(
 		}
 	}
 
-	if (
-		(false == pHalData->bDisableSWChannelPlan) &&
-		rtw_is_channel_plan_valid(sw_channel_plan)
-	)
+	if ((!pHalData->bDisableSWChannelPlan) &&
+	    rtw_is_channel_plan_valid(sw_channel_plan))
 		chnlPlan = sw_channel_plan;
 
 	return chnlPlan;
@@ -134,7 +132,7 @@ bool HAL_IsLegalChannel(struct adapter *adapter, u32 Channel)
 	bool bLegalChannel = true;
 
 	if ((Channel <= 14) && (Channel >= 1)) {
-		if (is_supported_24g(adapter->registrypriv.wireless_mode) == false)
+		if (!is_supported_24g(adapter->registrypriv.wireless_mode))
 			bLegalChannel = false;
 	} else {
 		bLegalChannel = false;
Signature · 1 line
2.53.0
#12 lore raw

Re: [PATCH 6/9] staging: rtl8723bs: fix Yoda conditions and == false comparisons

Quoted 9 lines · Marc Finkelbaum

Replace reversed comparisons with natural-order equivalents:
- '0xFF == hw_channel_plan' -> 'hw_channel_plan == 0xFF'
- 'false == pHalData->bDisableSWChannelPlan' -> '!pHalData->...'
- 'is_supported_24g(...) == false' -> '!is_supported_24g(...)'

The multi-line if condition around bDisableSWChannelPlan is also reformatted to standard kernel one-line style.

No functional change.

...

drivers/staging/rtl8723bs/hal/hal_com.c u8 hal_com_config_channel_plan( · line 123

Quoted 5 lines
drivers/staging/rtl8723bs/hal/hal_com.c +1 -4
-	if (
-		(false == pHalData->bDisableSWChannelPlan) &&
-		rtw_is_channel_plan_valid(sw_channel_plan)
-	)
+	if ((!pHalData->bDisableSWChannelPlan) &&

Too many parentheses.

Quoted 2 lines
drivers/staging/rtl8723bs/hal/hal_com.c +1 -0
+	    rtw_is_channel_plan_valid(sw_channel_plan))
 		chnlPlan = sw_channel_plan;
Signature · 2 lines
With Best Regards,
Andy Shevchenko
#13 lore raw

Re: [PATCH 6/9] staging: rtl8723bs: fix Yoda conditions and == false comparisons

Quoted 13 lines · Andy Shevchenko
Quoted 9 lines · Marc Finkelbaum

Replace reversed comparisons with natural-order equivalents:
- '0xFF == hw_channel_plan' -> 'hw_channel_plan == 0xFF'
- 'false == pHalData->bDisableSWChannelPlan' -> '!pHalData->...'
- 'is_supported_24g(...) == false' -> '!is_supported_24g(...)'

The multi-line if condition around bDisableSWChannelPlan is also reformatted to standard kernel one-line style.

No functional change.

...

Quoted 7 lines

drivers/staging/rtl8723bs/hal/hal_com.c u8 hal_com_config_channel_plan( · line 123

Quoted 5 lines
drivers/staging/rtl8723bs/hal/hal_com.c +1 -4
-	if (
-		(false == pHalData->bDisableSWChannelPlan) &&
-		rtw_is_channel_plan_valid(sw_channel_plan)
-	)
+	if ((!pHalData->bDisableSWChannelPlan) &&

Too many parentheses.

Also does too many things at once(reversing yoda style, simplifying boolean expresions) therefore should be splited to 2 patches addressing 2 different types of cleanups.
Best regards,
Luka Gejak

Quoted 3 lines
Quoted 3 lines
drivers/staging/rtl8723bs/hal/hal_com.c +1 -0
+	    rtw_is_channel_plan_valid(sw_channel_plan))
 		chnlPlan = sw_channel_plan;
#14 lore raw

PATCH 7/9 staging: rtl8723bs: reformat multi-line function signatures

In reply to Marc Finkelbaum

Convert one-parameter-per-line function signatures to standard kernel style with parameters aligned to the opening parenthesis and wrapped at 80 columns. Affected functions: hal_com_config_channel_plan, GetHalDefVar, SetHalODMVar, and rtw_hal_update_sta_rate_mask.

No functional change.

---
 drivers/staging/rtl8723bs/hal/hal_com.c | 26 +++++++++----------------
 1 file changed, 9 insertions(+), 17 deletions(-)
drivers/staging/rtl8723bs/hal/hal_com.c +9 -17
index dc5e6a58fd9d..44bef1400947 100644
@@ -90,13 +90,9 @@ void dump_chip_info(struct hal_version ChipVersion)
  *Final channel plan decision
  *
  */
-u8 hal_com_config_channel_plan(
-	struct adapter *padapter,
-	u8 hw_channel_plan,
-	u8 sw_channel_plan,
-	u8 def_channel_plan,
-	bool AutoLoadFail
-)
+u8 hal_com_config_channel_plan(struct adapter *padapter, u8 hw_channel_plan,
+			       u8 sw_channel_plan, u8 def_channel_plan,
+			       bool AutoLoadFail)
 {
 	struct hal_com_data *pHalData;
 	u8 chnlPlan;
@@ -525,7 +521,8 @@ u8 rtw_get_mgntframe_raid(struct adapter *adapter, unsigned char network_type)
 	return (network_type & WIRELESS_11B) ? RATEID_IDX_B : RATEID_IDX_G;
 }
 
-void rtw_hal_update_sta_rate_mask(struct adapter *padapter, struct sta_info *psta)
+void rtw_hal_update_sta_rate_mask(struct adapter *padapter,
+				  struct sta_info *psta)
 {
 	u8 i, limit;
 	u32 tx_ra_bitmap;
@@ -649,9 +646,8 @@ void GetHwReg(struct adapter *adapter, u8 variable, u8 *val)
 	}
 }
 
-u8 GetHalDefVar(
-	struct adapter *adapter, enum hal_def_variable variable, void *value
-)
+u8 GetHalDefVar(struct adapter *adapter, enum hal_def_variable variable,
+		void *value)
 {
 	struct hal_com_data *hal_data = GET_HAL_DATA(adapter);
 	u8 bResult = _SUCCESS;
@@ -699,12 +695,8 @@ u8 GetHalDefVar(
 	return bResult;
 }
 
-void SetHalODMVar(
-	struct adapter *Adapter,
-	enum hal_odm_variable eVariable,
-	void *pValue1,
-	bool bSet
-)
+void SetHalODMVar(struct adapter *Adapter, enum hal_odm_variable eVariable,
+		  void *pValue1, bool bSet)
 {
 	struct hal_com_data *pHalData = GET_HAL_DATA(Adapter);
 	struct dm_odm_t *podmpriv = &pHalData->odmpriv;
Signature · 1 line
2.53.0
#15 lore raw

PATCH 8/9 staging: rtl8723bs: reformat switch-case blocks with braced bodies

In reply to Marc Finkelbaum

Move the opening brace from a separate line to the end of the case label (case X: {) and combine the closing brace with break (} break;) for HW_VAR_SEC_CFG, HW_VAR_SEC_DK_CFG, HAL_DEF_UNDERCORATEDSMOOTHEDPWDB, and HAL_ODM_STA_INFO. Also add braces to the unguarded else clause in HW_VAR_SEC_DK_CFG, reindent the moved declarations by one level, and fix over-indented bodies in HAL_ODM_P2P_STATE and HAL_ODM_WIFI_DISPLAY_STATE.

No functional change.

---
 drivers/staging/rtl8723bs/hal/hal_com.c | 62 +++++++++++--------------
 1 file changed, 28 insertions(+), 34 deletions(-)
drivers/staging/rtl8723bs/hal/hal_com.c +28 -34
index 44bef1400947..2688355f9265 100644
@@ -561,16 +561,13 @@ void SetHwReg(struct adapter *adapter, u8 variable, u8 *val)
 	case HW_VAR_INIT_RTS_RATE:
 		rtw_warn_on(1);
 		break;
-	case HW_VAR_SEC_CFG:
-	{
+	case HW_VAR_SEC_CFG: {
 		u16 reg_scr;
 
 		reg_scr = rtw_read16(adapter, REG_SECCFG);
 		rtw_write16(adapter, REG_SECCFG, reg_scr | SCR_CHK_KEYID | SCR_RxDecEnable | SCR_TxEncEnable);
-	}
-		break;
-	case HW_VAR_SEC_DK_CFG:
-	{
+	} break;
+	case HW_VAR_SEC_DK_CFG: {
 		struct security_priv *sec = &adapter->securitypriv;
 		u8 reg_scr = rtw_read8(adapter, REG_SECCFG);
 
@@ -578,12 +575,12 @@ void SetHwReg(struct adapter *adapter, u8 variable, u8 *val)
 			reg_scr |= SCR_TXBCUSEDK;
 			if (sec->dot11AuthAlgrthm != dot11AuthAlgrthm_8021X)
 				reg_scr |= (SCR_RxUseDK | SCR_TxUseDK);
-		} else /* Disable default key related setting */
+		} else { /* Disable default key related setting */
 			reg_scr &= ~(SCR_RXBCUSEDK | SCR_TXBCUSEDK | SCR_RxUseDK | SCR_TxUseDK);
+		}
 
 		rtw_write8(adapter, REG_SECCFG, reg_scr);
-	}
-		break;
+	} break;
 	case HW_VAR_DM_FLAG:
 		odm->SupportAbility = *((u32 *)val);
 		break;
@@ -653,19 +650,17 @@ u8 GetHalDefVar(struct adapter *adapter, enum hal_def_variable variable,
 	u8 bResult = _SUCCESS;
 
 	switch (variable) {
-	case HAL_DEF_UNDERCORATEDSMOOTHEDPWDB:
-		{
-			struct mlme_priv *pmlmepriv;
-			struct sta_priv *pstapriv;
-			struct sta_info *psta;
+	case HAL_DEF_UNDERCORATEDSMOOTHEDPWDB: {
+		struct mlme_priv *pmlmepriv;
+		struct sta_priv *pstapriv;
+		struct sta_info *psta;
 
-			pmlmepriv = &adapter->mlmepriv;
-			pstapriv = &adapter->stapriv;
-			psta = rtw_get_stainfo(pstapriv, pmlmepriv->cur_network.network.mac_address);
-			if (psta)
-				*((int *)value) = psta->rssi_stat.UndecoratedSmoothedPWDB;
-		}
-		break;
+		pmlmepriv = &adapter->mlmepriv;
+		pstapriv = &adapter->stapriv;
+		psta = rtw_get_stainfo(pstapriv, pmlmepriv->cur_network.network.mac_address);
+		if (psta)
+			*((int *)value) = psta->rssi_stat.UndecoratedSmoothedPWDB;
+	} break;
 	case HAL_DEF_DBG_DM_FUNC:
 		*((u32 *)value) = hal_data->odmpriv.SupportAbility;
 		break;
@@ -702,24 +697,23 @@ void SetHalODMVar(struct adapter *Adapter, enum hal_odm_variable eVariable,
 	struct dm_odm_t *podmpriv = &pHalData->odmpriv;
 	/* _irqL irqL; */
 	switch (eVariable) {
-	case HAL_ODM_STA_INFO:
-		{
-			struct sta_info *psta = pValue1;
-			if (bSet) {
-				ODM_CmnInfoPtrArrayHook(podmpriv, ODM_CMNINFO_STA_STATUS, psta->mac_id, psta);
-			} else {
-				/* spin_lock_bh(&pHalData->odm_stainfo_lock); */
-				ODM_CmnInfoPtrArrayHook(podmpriv, ODM_CMNINFO_STA_STATUS, psta->mac_id, NULL);
+	case HAL_ODM_STA_INFO: {
+		struct sta_info *psta = pValue1;
 
-				/* spin_unlock_bh(&pHalData->odm_stainfo_lock); */
-		    }
+		if (bSet) {
+			ODM_CmnInfoPtrArrayHook(podmpriv, ODM_CMNINFO_STA_STATUS, psta->mac_id, psta);
+		} else {
+			/* spin_lock_bh(&pHalData->odm_stainfo_lock); */
+			ODM_CmnInfoPtrArrayHook(podmpriv, ODM_CMNINFO_STA_STATUS, psta->mac_id, NULL);
+
+			/* spin_unlock_bh(&pHalData->odm_stainfo_lock); */
 		}
-		break;
+	} break;
 	case HAL_ODM_P2P_STATE:
-			ODM_CmnInfoUpdate(podmpriv, ODM_CMNINFO_WIFI_DIRECT, bSet);
+		ODM_CmnInfoUpdate(podmpriv, ODM_CMNINFO_WIFI_DIRECT, bSet);
 		break;
 	case HAL_ODM_WIFI_DISPLAY_STATE:
-			ODM_CmnInfoUpdate(podmpriv, ODM_CMNINFO_WIFI_DISPLAY, bSet);
+		ODM_CmnInfoUpdate(podmpriv, ODM_CMNINFO_WIFI_DISPLAY, bSet);
 		break;
 
 	default:
Signature · 1 line
2.53.0
#16 lore raw

PATCH 9/9 staging: rtl8723bs: wrap long lines and fix argument alignment

In reply to Marc Finkelbaum

Break lines that exceed 80 columns and align continuation arguments to the opening parenthesis. Affected sites: scnprintf calls in dump_chip_info, hw_chnlPlan assignment, Queue2Pipe[7] assignments in the pipe-mapping functions, rtw_hal_set_hwreg in hal_init_macaddr, c2h_evt payload read loop, rtw_write16/rtw_write8 in SetHwReg and rtw_hal_check_rxfifo_full, rtw_get_stainfo and the UndecoratedSmoothedPWDB assignment in GetHalDefVar, ODM_CmnInfoPtrArrayHook calls in SetHalODMVar, and rtw_hal_read_rfreg/PHY_SetRFReg in rtw_bb_rf_gain_offset.

No functional change.

---
 drivers/staging/rtl8723bs/hal/hal_com.c | 71 +++++++++++++++++--------
 1 file changed, 48 insertions(+), 23 deletions(-)
drivers/staging/rtl8723bs/hal/hal_com.c +48 -23
index 2688355f9265..0e3b5831d974 100644
@@ -35,8 +35,10 @@ void dump_chip_info(struct hal_version ChipVersion)
 	char buf[128];
 	size_t cnt = 0;
 
-	cnt += scnprintf(buf + cnt, sizeof(buf) - cnt, "Chip Version Info: CHIP_8723B_%s_",
-			IS_NORMAL_CHIP(ChipVersion) ? "Normal_Chip" : "Test_Chip");
+	cnt += scnprintf(buf + cnt, sizeof(buf) - cnt,
+			 "Chip Version Info: CHIP_8723B_%s_",
+			 IS_NORMAL_CHIP(ChipVersion) ? "Normal_Chip" :
+						       "Test_Chip");
 
 	if (IS_CHIP_VENDOR_TSMC(ChipVersion))
 		cnt += scnprintf(buf + cnt, sizeof(buf) - cnt, "TSMC_");
@@ -63,11 +65,12 @@ void dump_chip_info(struct hal_version ChipVersion)
 		cnt += scnprintf(buf + cnt, sizeof(buf) - cnt, "K_CUT_");
 	else
 		cnt += scnprintf(buf + cnt, sizeof(buf) - cnt,
-				"UNKNOWN_CUT(%d)_", ChipVersion.CUTVersion);
+				 "UNKNOWN_CUT(%d)_", ChipVersion.CUTVersion);
 
 	cnt += scnprintf(buf + cnt, sizeof(buf) - cnt, "1T1R_");
 
-	cnt += scnprintf(buf + cnt, sizeof(buf) - cnt, "RomVer(%d)\n", ChipVersion.ROMVer);
+	cnt += scnprintf(buf + cnt, sizeof(buf) - cnt, "RomVer(%d)\n",
+			 ChipVersion.ROMVer);
 }
 
 #define EEPROM_CHANNEL_PLAN_BY_HW_MASK 0x80
@@ -107,7 +110,8 @@ u8 hal_com_config_channel_plan(struct adapter *padapter, u8 hw_channel_plan,
 	if (!AutoLoadFail) {
 		u8 hw_chnlPlan;
 
-		hw_chnlPlan = hw_channel_plan & (~EEPROM_CHANNEL_PLAN_BY_HW_MASK);
+		hw_chnlPlan = hw_channel_plan &
+			      (~EEPROM_CHANNEL_PLAN_BY_HW_MASK);
 		if (rtw_is_channel_plan_valid(hw_chnlPlan)) {
 			if (hw_channel_plan & EEPROM_CHANNEL_PLAN_BY_HW_MASK)
 				pHalData->bDisableSWChannelPlan = true;
@@ -364,9 +368,11 @@ static void _TwoOutPipeMapping(struct adapter *padapter, bool bWIFICfg)
 		pdvobjpriv->Queue2Pipe[4] = pdvobjpriv->RtOutPipe[0]; /* BCN */
 		pdvobjpriv->Queue2Pipe[5] = pdvobjpriv->RtOutPipe[0]; /* MGT */
 		pdvobjpriv->Queue2Pipe[6] = pdvobjpriv->RtOutPipe[0]; /* HIGH */
-		pdvobjpriv->Queue2Pipe[7] = pdvobjpriv->RtOutPipe[0]; /* TXCMD */
+		pdvobjpriv->Queue2Pipe[7] =
+			pdvobjpriv->RtOutPipe[0]; /* TXCMD */
 
 	} else { /* typical setting */
+
 		/* BK,	BE,	VI,	VO,	BCN,	CMD, MGT, HIGH, HCCA */
 		/*   1,		1,	0,	0,	0,	0,	0,	0,		0	}; */
 		/* 0:ep_0 num, 1:ep_1 num */
@@ -379,8 +385,8 @@ static void _TwoOutPipeMapping(struct adapter *padapter, bool bWIFICfg)
 		pdvobjpriv->Queue2Pipe[4] = pdvobjpriv->RtOutPipe[0]; /* BCN */
 		pdvobjpriv->Queue2Pipe[5] = pdvobjpriv->RtOutPipe[0]; /* MGT */
 		pdvobjpriv->Queue2Pipe[6] = pdvobjpriv->RtOutPipe[0]; /* HIGH */
-		pdvobjpriv->Queue2Pipe[7] = pdvobjpriv->RtOutPipe[0]; /* TXCMD */
-
+		pdvobjpriv->Queue2Pipe[7] =
+			pdvobjpriv->RtOutPipe[0]; /* TXCMD */
 	}
 }
 
@@ -401,9 +407,11 @@ static void _ThreeOutPipeMapping(struct adapter *padapter, bool bWIFICfg)
 		pdvobjpriv->Queue2Pipe[4] = pdvobjpriv->RtOutPipe[0]; /* BCN */
 		pdvobjpriv->Queue2Pipe[5] = pdvobjpriv->RtOutPipe[0]; /* MGT */
 		pdvobjpriv->Queue2Pipe[6] = pdvobjpriv->RtOutPipe[0]; /* HIGH */
-		pdvobjpriv->Queue2Pipe[7] = pdvobjpriv->RtOutPipe[0]; /* TXCMD */
+		pdvobjpriv->Queue2Pipe[7] =
+			pdvobjpriv->RtOutPipe[0]; /* TXCMD */
 
 	} else { /* typical setting */
+
 		/*	BK,	BE,	VI,	VO,	BCN,	CMD, MGT, HIGH, HCCA */
 		/*   2,		2,	1,	0,	0,	0,	0,	0,		0	}; */
 		/* 0:H, 1:N, 2:L */
@@ -416,7 +424,8 @@ static void _ThreeOutPipeMapping(struct adapter *padapter, bool bWIFICfg)
 		pdvobjpriv->Queue2Pipe[4] = pdvobjpriv->RtOutPipe[0]; /* BCN */
 		pdvobjpriv->Queue2Pipe[5] = pdvobjpriv->RtOutPipe[0]; /* MGT */
 		pdvobjpriv->Queue2Pipe[6] = pdvobjpriv->RtOutPipe[0]; /* HIGH */
-		pdvobjpriv->Queue2Pipe[7] = pdvobjpriv->RtOutPipe[0]; /* TXCMD */
+		pdvobjpriv->Queue2Pipe[7] =
+			pdvobjpriv->RtOutPipe[0]; /* TXCMD */
 	}
 }
 
@@ -449,7 +458,8 @@ bool Hal_MappingOutPipe(struct adapter *padapter, u8 NumOutPipe)
 
 void hal_init_macaddr(struct adapter *adapter)
 {
-	rtw_hal_set_hwreg(adapter, HW_VAR_MAC_ADDR, adapter->eeprompriv.mac_addr);
+	rtw_hal_set_hwreg(adapter, HW_VAR_MAC_ADDR,
+			  adapter->eeprompriv.mac_addr);
 }
 
 void rtw_init_hal_com_default_value(struct adapter *Adapter)
@@ -502,7 +512,8 @@ s32 c2h_evt_read_88xx(struct adapter *adapter, u8 *buf)
 
 	/* Read the content */
 	for (i = 0; i < c2h_evt->plen; i++)
-		c2h_evt->payload[i] = rtw_read8(adapter, REG_C2HEVT_MSG_NORMAL + 2 + i);
+		c2h_evt->payload[i] =
+			rtw_read8(adapter, REG_C2HEVT_MSG_NORMAL + 2 + i);
 
 	ret = _SUCCESS;
 
@@ -565,7 +576,9 @@ void SetHwReg(struct adapter *adapter, u8 variable, u8 *val)
 		u16 reg_scr;
 
 		reg_scr = rtw_read16(adapter, REG_SECCFG);
-		rtw_write16(adapter, REG_SECCFG, reg_scr | SCR_CHK_KEYID | SCR_RxDecEnable | SCR_TxEncEnable);
+		rtw_write16(adapter, REG_SECCFG,
+			    reg_scr | SCR_CHK_KEYID | SCR_RxDecEnable |
+				    SCR_TxEncEnable);
 	} break;
 	case HW_VAR_SEC_DK_CFG: {
 		struct security_priv *sec = &adapter->securitypriv;
@@ -576,7 +589,8 @@ void SetHwReg(struct adapter *adapter, u8 variable, u8 *val)
 			if (sec->dot11AuthAlgrthm != dot11AuthAlgrthm_8021X)
 				reg_scr |= (SCR_RxUseDK | SCR_TxUseDK);
 		} else { /* Disable default key related setting */
-			reg_scr &= ~(SCR_RXBCUSEDK | SCR_TXBCUSEDK | SCR_RxUseDK | SCR_TxUseDK);
+			reg_scr &= ~(SCR_RXBCUSEDK | SCR_TXBCUSEDK |
+				     SCR_RxUseDK | SCR_TxUseDK);
 		}
 
 		rtw_write8(adapter, REG_SECCFG, reg_scr);
@@ -657,9 +671,11 @@ u8 GetHalDefVar(struct adapter *adapter, enum hal_def_variable variable,
 
 		pmlmepriv = &adapter->mlmepriv;
 		pstapriv = &adapter->stapriv;
-		psta = rtw_get_stainfo(pstapriv, pmlmepriv->cur_network.network.mac_address);
+		psta = rtw_get_stainfo(pstapriv,
+				       pmlmepriv->cur_network.network.mac_address);
 		if (psta)
-			*((int *)value) = psta->rssi_stat.UndecoratedSmoothedPWDB;
+			*((int *)value) =
+				psta->rssi_stat.UndecoratedSmoothedPWDB;
 	} break;
 	case HAL_DEF_DBG_DM_FUNC:
 		*((u32 *)value) = hal_data->odmpriv.SupportAbility;
@@ -701,10 +717,14 @@ void SetHalODMVar(struct adapter *Adapter, enum hal_odm_variable eVariable,
 		struct sta_info *psta = pValue1;
 
 		if (bSet) {
-			ODM_CmnInfoPtrArrayHook(podmpriv, ODM_CMNINFO_STA_STATUS, psta->mac_id, psta);
+			ODM_CmnInfoPtrArrayHook(podmpriv,
+						ODM_CMNINFO_STA_STATUS,
+						psta->mac_id, psta);
 		} else {
 			/* spin_lock_bh(&pHalData->odm_stainfo_lock); */
-			ODM_CmnInfoPtrArrayHook(podmpriv, ODM_CMNINFO_STA_STATUS, psta->mac_id, NULL);
+			ODM_CmnInfoPtrArrayHook(podmpriv,
+						ODM_CMNINFO_STA_STATUS,
+						psta->mac_id, NULL);
 
 			/* spin_unlock_bh(&pHalData->odm_stainfo_lock); */
 		}
@@ -754,7 +774,8 @@ bool GetU1ByteIntegerFromStringInDecimal(char *Str, u8 *pInt)
 void rtw_hal_check_rxfifo_full(struct adapter *adapter)
 {
 	/* switch counter to RX fifo */
-	rtw_write8(adapter, REG_RXERR_RPT + 3, rtw_read8(adapter, REG_RXERR_RPT + 3) | 0xf0);
+	rtw_write8(adapter, REG_RXERR_RPT + 3,
+		   rtw_read8(adapter, REG_RXERR_RPT + 3) | 0xf0);
 }
 
 static u32 Array_kfreemap[] = {
@@ -782,19 +803,23 @@ void rtw_bb_rf_gain_offset(struct adapter *padapter)
 
 	if (value & BIT4) {
 		if (padapter->eeprompriv.EEPROMRFGainVal != 0xff) {
-			rtw_hal_read_rfreg(padapter, RF_PATH_A, 0x7f, 0xffffffff);
+			rtw_hal_read_rfreg(padapter, RF_PATH_A, 0x7f,
+					   0xffffffff);
 
 			for (i = 0; i < ARRAY_SIZE(Array_kfreemap); i += 2) {
 				v1 = Array[i];
 				v2 = Array[i + 1];
-				if (v1 == padapter->eeprompriv.EEPROMRFGainVal) {
+				if (v1 ==
+				    padapter->eeprompriv.EEPROMRFGainVal) {
 					target = v2;
 					break;
 				}
 			}
-			PHY_SetRFReg(padapter, RF_PATH_A, REG_RF_BB_GAIN_OFFSET, BIT18 | BIT17 | BIT16 | BIT15, target);
+			PHY_SetRFReg(padapter, RF_PATH_A, REG_RF_BB_GAIN_OFFSET,
+				     BIT18 | BIT17 | BIT16 | BIT15, target);
 
-			rtw_hal_read_rfreg(padapter, RF_PATH_A, 0x7f, 0xffffffff);
+			rtw_hal_read_rfreg(padapter, RF_PATH_A, 0x7f,
+					   0xffffffff);
 		}
 	}
 }
Signature · 1 line
2.53.0
#17 lore raw

Re: [PATCH 9/9] staging: rtl8723bs: wrap long lines and fix argument alignment

Quoted 10 lines · Marc Finkelbaum

Break lines that exceed 80 columns and align continuation arguments to the opening parenthesis. Affected sites: scnprintf calls in dump_chip_info, hw_chnlPlan assignment, Queue2Pipe[7] assignments in the pipe-mapping functions, rtw_hal_set_hwreg in hal_init_macaddr, c2h_evt payload read loop, rtw_write16/rtw_write8 in SetHwReg and rtw_hal_check_rxfifo_full, rtw_get_stainfo and the UndecoratedSmoothedPWDB assignment in GetHalDefVar, ODM_CmnInfoPtrArrayHook calls in SetHalODMVar, and rtw_hal_read_rfreg/PHY_SetRFReg in rtw_bb_rf_gain_offset.

No functional change.

"No" to most of the changes here. Use the common sense.

...

drivers/staging/rtl8723bs/hal/hal_com.c void dump_chip_info(struct hal_version ChipVersion) · line 41

Quoted 9 lines
drivers/staging/rtl8723bs/hal/hal_com.c +4 -2
 	char buf[128];
 	size_t cnt = 0;
 
-	cnt += scnprintf(buf + cnt, sizeof(buf) - cnt, "Chip Version Info: CHIP_8723B_%s_",
-			IS_NORMAL_CHIP(ChipVersion) ? "Normal_Chip" : "Test_Chip");
+	cnt += scnprintf(buf + cnt, sizeof(buf) - cnt,
+			 "Chip Version Info: CHIP_8723B_%s_",
+			 IS_NORMAL_CHIP(ChipVersion) ? "Normal_Chip" :
+						       "Test_Chip");

Rather check if this needs to be converted to use sysfs_emit_at().

...

drivers/staging/rtl8723bs/hal/hal_com.c u8 hal_com_config_channel_plan(struct adapter *padapter, u8 hw_channel_plan, · line 114

Quoted 3 lines
drivers/staging/rtl8723bs/hal/hal_com.c +2 -1
-		hw_chnlPlan = hw_channel_plan & (~EEPROM_CHANNEL_PLAN_BY_HW_MASK);
+		hw_chnlPlan = hw_channel_plan &
+			      (~EEPROM_CHANNEL_PLAN_BY_HW_MASK);

Definitely "no". And there are too many parentheses.

		hw_chnlPlan = hw_channel_plan & ~EEPROM_CHANNEL_PLAN_BY_HW_MASK;

is exactly 80 characters, btw.

...

drivers/staging/rtl8723bs/hal/hal_com.c static void _TwoOutPipeMapping(struct adapter *padapter, bool bWIFICfg) · line 372

Quoted 6 lines
drivers/staging/rtl8723bs/hal/hal_com.c +2 -1
 		pdvobjpriv->Queue2Pipe[4] = pdvobjpriv->RtOutPipe[0]; /* BCN */
 		pdvobjpriv->Queue2Pipe[5] = pdvobjpriv->RtOutPipe[0]; /* MGT */
 		pdvobjpriv->Queue2Pipe[6] = pdvobjpriv->RtOutPipe[0]; /* HIGH */
-		pdvobjpriv->Queue2Pipe[7] = pdvobjpriv->RtOutPipe[0]; /* TXCMD */
+		pdvobjpriv->Queue2Pipe[7] =
+			pdvobjpriv->RtOutPipe[0]; /* TXCMD */

"No".
These are well adjusted right now and also you already touched this code once, do not do ping-pong series (order the changes the way that you don't change the same line(s) more than once).

...

Review

Quoted 2 lines
(quoted diff) +1 -0
 	} else { /* typical setting */
+

Huh?!
You have a patch that removed this and other blank lines, what's going on?

...

drivers/staging/rtl8723bs/hal/hal_com.c void rtw_bb_rf_gain_offset(struct adapter *padapter) · line 807

Quoted 4 lines
drivers/staging/rtl8723bs/hal/hal_com.c +2 -1
 		if (padapter->eeprompriv.EEPROMRFGainVal != 0xff) {
-			rtw_hal_read_rfreg(padapter, RF_PATH_A, 0x7f, 0xffffffff);
+			rtw_hal_read_rfreg(padapter, RF_PATH_A, 0x7f,
+					   0xffffffff);

83 is okay when it gives better readability (and here is the case).

Quoted 10 lines
drivers/staging/rtl8723bs/hal/hal_com.c +2 -1
 			for (i = 0; i < ARRAY_SIZE(Array_kfreemap); i += 2) {
 				v1 = Array[i];
 				v2 = Array[i + 1];
-				if (v1 == padapter->eeprompriv.EEPROMRFGainVal) {
+				if (v1 ==
+				    padapter->eeprompriv.EEPROMRFGainVal) {
 					target = v2;
 					break;
 				}
 			}
Signature · 2 lines
With Best Regards,
Andy Shevchenko
#18 lore raw
In reply to Marc Finkelbaum

Please disregard this series. I'll resend a cleaner version addressing the feedback from Andy. Thanks, Marc

вт, 14 апр. 2026 г. в 12:58, Marc Finkelbaum <[email protected]>:

Quoted 22 lines

This series cleans up checkpatch --strict warnings in drivers/staging/rtl8723bs/hal/hal_com.c. All changes are purely cosmetic; the compiled .text section is byte-identical before and after the series (verified with objdump -d).

Marc Finkelbaum (9):
staging: rtl8723bs: remove extra blank lines
staging: rtl8723bs: fix space-before-tab whitespace
staging: rtl8723bs: fix block comment alignment
staging: rtl8723bs: add spaces around binary operators
staging: rtl8723bs: add space before inline block comments
staging: rtl8723bs: fix Yoda conditions and == false comparisons
staging: rtl8723bs: reformat multi-line function signatures
staging: rtl8723bs: reformat switch-case blocks with braced bodies
staging: rtl8723bs: wrap long lines and fix argument alignment

 drivers/staging/rtl8723bs/hal/hal_com.c | 296 ++++++++++++------------
 1 file changed, 146 insertions(+), 150 deletions(-)

--
2.53.0