diff mbox series

drivers: net: wireless: rtlwifi: fix bool comparison in expressions

Message ID 20210108153208.24065-1-yashsri421@gmail.com
State New
Headers show
Series drivers: net: wireless: rtlwifi: fix bool comparison in expressions | expand

Commit Message

Aditya Srivastava Jan. 8, 2021, 3:32 p.m. UTC
There are certain conditional expressions in rtlwifi, where a boolean
variable is compared with true/false, in forms such as (foo == true) or
(false != bar), which does not comply with checkpatch.pl (CHECK:
BOOL_COMPARISON), according to which boolean variables should be
themselves used in the condition, rather than comparing with true/false

E.g., in drivers/net/wireless/realtek/rtlwifi/ps.c,
"if (find_p2p_ie == true)" can be replaced with "if (find_p2p_ie)"

Replace all such expressions with the bool variables appropriately

Signed-off-by: Aditya Srivastava <yashsri421@gmail.com>
---
- The changes made are compile tested
- Applies perfecly on next-20210108

 drivers/net/wireless/realtek/rtlwifi/ps.c                 | 4 ++--
 drivers/net/wireless/realtek/rtlwifi/rtl8188ee/dm.c       | 8 ++++----
 drivers/net/wireless/realtek/rtlwifi/rtl8188ee/hw.c       | 4 ++--
 drivers/net/wireless/realtek/rtlwifi/rtl8192c/dm_common.c | 4 ++--
 drivers/net/wireless/realtek/rtlwifi/rtl8192se/hw.c       | 4 ++--
 drivers/net/wireless/realtek/rtlwifi/rtl8821ae/phy.c      | 8 ++++----
 6 files changed, 16 insertions(+), 16 deletions(-)

Comments

Larry Finger Jan. 8, 2021, 7:41 p.m. UTC | #1
On 1/8/21 9:32 AM, Aditya Srivastava wrote:
> There are certain conditional expressions in rtlwifi, where a boolean
> variable is compared with true/false, in forms such as (foo == true) or
> (false != bar), which does not comply with checkpatch.pl (CHECK:
> BOOL_COMPARISON), according to which boolean variables should be
> themselves used in the condition, rather than comparing with true/false
> 
> E.g., in drivers/net/wireless/realtek/rtlwifi/ps.c,
> "if (find_p2p_ie == true)" can be replaced with "if (find_p2p_ie)"
> 
> Replace all such expressions with the bool variables appropriately
> 
> Signed-off-by: Aditya Srivastava<yashsri421@gmail.com>
> ---
> - The changes made are compile tested
> - Applies perfecly on next-20210108
> 
>   drivers/net/wireless/realtek/rtlwifi/ps.c                 | 4 ++--
>   drivers/net/wireless/realtek/rtlwifi/rtl8188ee/dm.c       | 8 ++++----
>   drivers/net/wireless/realtek/rtlwifi/rtl8188ee/hw.c       | 4 ++--
>   drivers/net/wireless/realtek/rtlwifi/rtl8192c/dm_common.c | 4 ++--
>   drivers/net/wireless/realtek/rtlwifi/rtl8192se/hw.c       | 4 ++--
>   drivers/net/wireless/realtek/rtlwifi/rtl8821ae/phy.c      | 8 ++++----
>   6 files changed, 16 insertions(+), 16 deletions(-)

As has been stated several times, this form of the subject is incorrect. It 
should be: "rtlwifi: <driver_name>: <subject>

I would prefer that there be separate patches for each driver, not that the 
changes be lumped into a single patch as was done here. Such organization makes 
it a lot easier to find the patches for a given driver in case something goes 
wrong.Note: The driver for ps is rtl_pci, and that for rtl8192c is 
rtl8192c-common. The other driver names match their directory.

Larry
Aditya Srivastava Jan. 13, 2021, 5:11 p.m. UTC | #2
On 9/1/21 1:11 am, Larry Finger wrote:
> On 1/8/21 9:32 AM, Aditya Srivastava wrote:
>> There are certain conditional expressions in rtlwifi, where a boolean
>> variable is compared with true/false, in forms such as (foo == true) or
>> (false != bar), which does not comply with checkpatch.pl (CHECK:
>> BOOL_COMPARISON), according to which boolean variables should be
>> themselves used in the condition, rather than comparing with true/false
>>
>> E.g., in drivers/net/wireless/realtek/rtlwifi/ps.c,
>> "if (find_p2p_ie == true)" can be replaced with "if (find_p2p_ie)"
>>
>> Replace all such expressions with the bool variables appropriately
>>
>> Signed-off-by: Aditya Srivastava<yashsri421@gmail.com>
>> ---
>> - The changes made are compile tested
>> - Applies perfecly on next-20210108
>>
>>   drivers/net/wireless/realtek/rtlwifi/ps.c                 | 4 ++--
>>   drivers/net/wireless/realtek/rtlwifi/rtl8188ee/dm.c       | 8
>> ++++----
>>   drivers/net/wireless/realtek/rtlwifi/rtl8188ee/hw.c       | 4 ++--
>>   drivers/net/wireless/realtek/rtlwifi/rtl8192c/dm_common.c | 4 ++--
>>   drivers/net/wireless/realtek/rtlwifi/rtl8192se/hw.c       | 4 ++--
>>   drivers/net/wireless/realtek/rtlwifi/rtl8821ae/phy.c      | 8
>> ++++----
>>   6 files changed, 16 insertions(+), 16 deletions(-)
> 
> As has been stated several times, this form of the subject is
> incorrect. It should be: "rtlwifi: <driver_name>: <subject>
> 
> I would prefer that there be separate patches for each driver, not
> that the changes be lumped into a single patch as was done here. Such
> organization makes it a lot easier to find the patches for a given
> driver in case something goes wrong.Note: The driver for ps is
> rtl_pci, and that for rtl8192c is rtl8192c-common. The other driver
> names match their directory.
> 
> Larry
> 

Hi Larry!
I sent the modified patches as patch series separately.
I probably missed CCing you :/

The patch series can be found at:
https://lore.kernel.org/linux-wireless/20210110121525.2407-1-yashsri421@gmail.com/#t

Please review :)

Thanks
Aditya
diff mbox series

Patch

diff --git a/drivers/net/wireless/realtek/rtlwifi/ps.c b/drivers/net/wireless/realtek/rtlwifi/ps.c
index f99882255d48..629c03271bde 100644
--- a/drivers/net/wireless/realtek/rtlwifi/ps.c
+++ b/drivers/net/wireless/realtek/rtlwifi/ps.c
@@ -798,9 +798,9 @@  static void rtl_p2p_noa_ie(struct ieee80211_hw *hw, void *data,
 		ie += 3 + noa_len;
 	}
 
-	if (find_p2p_ie == true) {
+	if (find_p2p_ie) {
 		if ((p2pinfo->p2p_ps_mode > P2P_PS_NONE) &&
-		    (find_p2p_ps_ie == false))
+		    (!find_p2p_ps_ie))
 			rtl_p2p_ps_cmd(hw, P2P_PS_DISABLE);
 	}
 }
diff --git a/drivers/net/wireless/realtek/rtlwifi/rtl8188ee/dm.c b/drivers/net/wireless/realtek/rtlwifi/rtl8188ee/dm.c
index d10c14c694da..6f61d6a10627 100644
--- a/drivers/net/wireless/realtek/rtlwifi/rtl8188ee/dm.c
+++ b/drivers/net/wireless/realtek/rtlwifi/rtl8188ee/dm.c
@@ -474,11 +474,11 @@  static void rtl88e_dm_dig(struct ieee80211_hw *hw)
 	u8 dm_dig_max, dm_dig_min;
 	u8 current_igi = dm_dig->cur_igvalue;
 
-	if (rtlpriv->dm.dm_initialgain_enable == false)
+	if (!rtlpriv->dm.dm_initialgain_enable)
 		return;
-	if (dm_dig->dig_enable_flag == false)
+	if (!dm_dig->dig_enable_flag)
 		return;
-	if (mac->act_scanning == true)
+	if (mac->act_scanning)
 		return;
 
 	if (mac->link_state >= MAC80211_LINKED)
@@ -1637,7 +1637,7 @@  static void rtl88e_dm_fast_ant_training(struct ieee80211_hw *hw)
 			}
 		}
 
-		if (bpkt_filter_match == false) {
+		if (!bpkt_filter_match) {
 			rtl_set_bbreg(hw, DM_REG_TXAGC_A_1_MCS32_11N,
 				      BIT(16), 0);
 			rtl_set_bbreg(hw, DM_REG_IGI_A_11N, BIT(7), 0);
diff --git a/drivers/net/wireless/realtek/rtlwifi/rtl8188ee/hw.c b/drivers/net/wireless/realtek/rtlwifi/rtl8188ee/hw.c
index bd9160b166c5..861cc663ca93 100644
--- a/drivers/net/wireless/realtek/rtlwifi/rtl8188ee/hw.c
+++ b/drivers/net/wireless/realtek/rtlwifi/rtl8188ee/hw.c
@@ -1269,12 +1269,12 @@  void rtl88ee_set_check_bssid(struct ieee80211_hw *hw, bool check_bssid)
 	if (rtlpriv->psc.rfpwr_state != ERFON)
 		return;
 
-	if (check_bssid == true) {
+	if (check_bssid) {
 		reg_rcr |= (RCR_CBSSID_DATA | RCR_CBSSID_BCN);
 		rtlpriv->cfg->ops->set_hw_reg(hw, HW_VAR_RCR,
 					      (u8 *)(&reg_rcr));
 		_rtl88ee_set_bcn_ctrl_reg(hw, 0, BIT(4));
-	} else if (check_bssid == false) {
+	} else if (!check_bssid) {
 		reg_rcr &= (~(RCR_CBSSID_DATA | RCR_CBSSID_BCN));
 		_rtl88ee_set_bcn_ctrl_reg(hw, BIT(4), 0);
 		rtlpriv->cfg->ops->set_hw_reg(hw,
diff --git a/drivers/net/wireless/realtek/rtlwifi/rtl8192c/dm_common.c b/drivers/net/wireless/realtek/rtlwifi/rtl8192c/dm_common.c
index 265a1a336304..0b6a15c2e5cc 100644
--- a/drivers/net/wireless/realtek/rtlwifi/rtl8192c/dm_common.c
+++ b/drivers/net/wireless/realtek/rtlwifi/rtl8192c/dm_common.c
@@ -380,7 +380,7 @@  static void rtl92c_dm_initial_gain_multi_sta(struct ieee80211_hw *hw)
 		initialized = false;
 		dm_digtable->dig_ext_port_stage = DIG_EXT_PORT_STAGE_MAX;
 		return;
-	} else if (initialized == false) {
+	} else if (!initialized) {
 		initialized = true;
 		dm_digtable->dig_ext_port_stage = DIG_EXT_PORT_STAGE_0;
 		dm_digtable->cur_igvalue = 0x20;
@@ -509,7 +509,7 @@  static void rtl92c_dm_dig(struct ieee80211_hw *hw)
 {
 	struct rtl_priv *rtlpriv = rtl_priv(hw);
 
-	if (rtlpriv->dm.dm_initialgain_enable == false)
+	if (!rtlpriv->dm.dm_initialgain_enable)
 		return;
 	if (!(rtlpriv->dm.dm_flag & DYNAMIC_FUNC_DIG))
 		return;
diff --git a/drivers/net/wireless/realtek/rtlwifi/rtl8192se/hw.c b/drivers/net/wireless/realtek/rtlwifi/rtl8192se/hw.c
index 47fabce5c235..73a5d8a068fc 100644
--- a/drivers/net/wireless/realtek/rtlwifi/rtl8192se/hw.c
+++ b/drivers/net/wireless/realtek/rtlwifi/rtl8192se/hw.c
@@ -458,7 +458,7 @@  static u8 _rtl92se_halset_sysclk(struct ieee80211_hw *hw, u8 data)
 	tmpvalue = rtl_read_byte(rtlpriv, SYS_CLKR + 1);
 	bresult = ((tmpvalue & BIT(7)) == (data & BIT(7)));
 
-	if ((data & (BIT(6) | BIT(7))) == false) {
+	if (!(data & (BIT(6) | BIT(7)))) {
 		waitcount = 100;
 		tmpvalue = 0;
 
@@ -1268,7 +1268,7 @@  static u8 _rtl92s_set_sysclk(struct ieee80211_hw *hw, u8 data)
 	tmp = rtl_read_byte(rtlpriv, SYS_CLKR + 1);
 	result = ((tmp & BIT(7)) == (data & BIT(7)));
 
-	if ((data & (BIT(6) | BIT(7))) == false) {
+	if (!(data & (BIT(6) | BIT(7)))) {
 		waitcnt = 100;
 		tmp = 0;
 
diff --git a/drivers/net/wireless/realtek/rtlwifi/rtl8821ae/phy.c b/drivers/net/wireless/realtek/rtlwifi/rtl8821ae/phy.c
index 372d6f8caf06..e214b9062cc1 100644
--- a/drivers/net/wireless/realtek/rtlwifi/rtl8821ae/phy.c
+++ b/drivers/net/wireless/realtek/rtlwifi/rtl8821ae/phy.c
@@ -1812,7 +1812,7 @@  static bool _rtl8821ae_phy_bb8821a_config_parafile(struct ieee80211_hw *hw)
 		return false;
 	}
 	_rtl8821ae_phy_init_tx_power_by_rate(hw);
-	if (rtlefuse->autoload_failflag == false) {
+	if (!rtlefuse->autoload_failflag) {
 		rtstatus = _rtl8821ae_phy_config_bb_with_pgheaderfile(hw,
 						    BASEBAND_CONFIG_PHY_REG);
 	}
@@ -3980,7 +3980,7 @@  static void _rtl8821ae_iqk_tx(struct ieee80211_hw *hw, enum radio_path path)
 				}
 			}
 
-			if (tx0iqkok == false)
+			if (!tx0iqkok)
 				break;				/* TXK fail, Don't do RXK */
 
 			if (vdf_enable == 1) {
@@ -4090,7 +4090,7 @@  static void _rtl8821ae_iqk_tx(struct ieee80211_hw *hw, enum radio_path path)
 						}
 					}
 
-					if (tx0iqkok == false) {   /* If RX mode TXK fail, then take TXK Result */
+					if (!tx0iqkok) {   /* If RX mode TXK fail, then take TXK Result */
 						tx_x0_rxk[cal] = tx_x0[cal];
 						tx_y0_rxk[cal] = tx_y0[cal];
 						tx0iqkok = true;
@@ -4249,7 +4249,7 @@  static void _rtl8821ae_iqk_tx(struct ieee80211_hw *hw, enum radio_path path)
 					}
 				}
 
-				if (tx0iqkok == false) {   /* If RX mode TXK fail, then take TXK Result */
+				if (!tx0iqkok) {   /* If RX mode TXK fail, then take TXK Result */
 					tx_x0_rxk[cal] = tx_x0[cal];
 					tx_y0_rxk[cal] = tx_y0[cal];
 					tx0iqkok = true;