* [PATCH 0/4] staging: rtlwifi: rtl8822be: Fix code styling issues and the hardcode of a func name
@ 2017-10-18 3:24 Frank A. Cancio Bello
2017-10-18 3:30 ` [PATCH 1/4] staging: rtlwifi: rtl8822be: Balance braces in else statement Frank A. Cancio Bello
` (3 more replies)
0 siblings, 4 replies; 5+ messages in thread
From: Frank A. Cancio Bello @ 2017-10-18 3:24 UTC (permalink / raw)
To: pablo, Julia.Lawall; +Cc: gregkh, outreachy-kernel
This patchset address code style issues with braces, parentheses and
comments. Beside it include a fix to a hardcoded function's name.
This is my first patchset ever, so I decided to keep it small to make it easy
to correct or apply if it is OK.
Frank A. Cancio Bello (4):
staging: rtlwifi: rtl8822be: Balance else statement braces
staging: rtlwifi: rtl8822be: Use __func__ instead of hardcoded name
staging: rtlwifi: rtl8822be: Remove useless parentheses
staging: rtlwifi: rtl8822be: Align the * in block comment
drivers/staging/rtlwifi/rtl8822be/fw.c | 7 ++++---
drivers/staging/rtlwifi/rtl8822be/led.c | 2 +-
drivers/staging/rtlwifi/rtl8822be/phy.c | 19 ++++++++++---------
drivers/staging/rtlwifi/rtl8822be/trx.c | 24 ++++++++++++------------
4 files changed, 27 insertions(+), 25 deletions(-)
--
2.7.4
^ permalink raw reply [flat|nested] 5+ messages in thread
* [PATCH 1/4] staging: rtlwifi: rtl8822be: Balance braces in else statement
2017-10-18 3:24 [PATCH 0/4] staging: rtlwifi: rtl8822be: Fix code styling issues and the hardcode of a func name Frank A. Cancio Bello
@ 2017-10-18 3:30 ` Frank A. Cancio Bello
2017-10-18 3:33 ` [PATCH 2/4] staging: rtlwifi: rtl8822be: Use __func__ instead of hardcoded name Frank A. Cancio Bello
` (2 subsequent siblings)
3 siblings, 0 replies; 5+ messages in thread
From: Frank A. Cancio Bello @ 2017-10-18 3:30 UTC (permalink / raw)
To: pablo, Julia.Lawall; +Cc: gregkh, outreachy-kernel
Add braces to else statements to comply with section 3) of 'Linux
kernel coding style' and avoid the following checkpatch message:
'CHECK: Unbalanced braces around else statement'
Credits to checkpatch.
Signed-off-by: Frank A. Cancio Bello <frank@generalsoftwareinc.com>
---
drivers/staging/rtlwifi/rtl8822be/fw.c | 3 ++-
drivers/staging/rtlwifi/rtl8822be/phy.c | 3 ++-
2 files changed, 4 insertions(+), 2 deletions(-)
diff --git a/drivers/staging/rtlwifi/rtl8822be/fw.c b/drivers/staging/rtlwifi/rtl8822be/fw.c
index 8e24da1..02f5004 100644
--- a/drivers/staging/rtlwifi/rtl8822be/fw.c
+++ b/drivers/staging/rtlwifi/rtl8822be/fw.c
@@ -766,9 +766,10 @@ void rtl8822be_set_fw_rsvdpagepkt(struct ieee80211_hw *hw, bool b_dl_finished)
rtl8822be_fill_h2c_cmd(hw, H2C_8822B_RSVDPAGE,
sizeof(u1_rsvd_page_loc),
u1_rsvd_page_loc);
- } else
+ } else {
RT_TRACE(rtlpriv, COMP_ERR, DBG_WARNING,
"Set RSVD page location to Fw FAIL!!!!!!.\n");
+ }
}
/* Should check FW support p2p or not. */
diff --git a/drivers/staging/rtlwifi/rtl8822be/phy.c b/drivers/staging/rtlwifi/rtl8822be/phy.c
index 921226b..589ef15 100644
--- a/drivers/staging/rtlwifi/rtl8822be/phy.c
+++ b/drivers/staging/rtlwifi/rtl8822be/phy.c
@@ -1562,9 +1562,10 @@ static char _rtl8822be_phy_get_txpower_limit(struct ieee80211_hw *hw, u8 band,
[channel_index]
[rate_section]
[channel_index][rf_path];
- } else
+ } else {
RT_TRACE(rtlpriv, COMP_INIT, DBG_LOUD,
"No power limit table of the specified band\n");
+ }
return power_limit;
}
--
2.7.4
^ permalink raw reply related [flat|nested] 5+ messages in thread
* [PATCH 2/4] staging: rtlwifi: rtl8822be: Use __func__ instead of hardcoded name
2017-10-18 3:24 [PATCH 0/4] staging: rtlwifi: rtl8822be: Fix code styling issues and the hardcode of a func name Frank A. Cancio Bello
2017-10-18 3:30 ` [PATCH 1/4] staging: rtlwifi: rtl8822be: Balance braces in else statement Frank A. Cancio Bello
@ 2017-10-18 3:33 ` Frank A. Cancio Bello
2017-10-18 3:35 ` [PATCH 3/4] staging: rtlwifi: rtl8822be: Remove useless parentheses Frank A. Cancio Bello
2017-10-18 3:37 ` [PATCH 4/4] staging: rtlwifi: rtl8822be: Align the * in block comment Frank A. Cancio Bello
3 siblings, 0 replies; 5+ messages in thread
From: Frank A. Cancio Bello @ 2017-10-18 3:33 UTC (permalink / raw)
To: pablo, Julia.Lawall; +Cc: gregkh, outreachy-kernel
Switch hardcoded function name with a reference to __func__ making
the code more maintenable and addressing the checkpatch warning:
WARNING: Prefer using '"%s...", __func__' to using 'rtl8822be_sc_mapping', this function's name, in a string
+ "rtl8822be_sc_mapping: Not Correct Primary40MHz Setting\n");
Credits to checkpatch.
Signed-off-by: Frank A. Cancio Bello <frank@generalsoftwareinc.com>
---
drivers/staging/rtlwifi/rtl8822be/trx.c | 6 +++---
1 file changed, 3 insertions(+), 3 deletions(-)
diff --git a/drivers/staging/rtlwifi/rtl8822be/trx.c b/drivers/staging/rtlwifi/rtl8822be/trx.c
index 38f80e4..54f65f3 100644
--- a/drivers/staging/rtlwifi/rtl8822be/trx.c
+++ b/drivers/staging/rtlwifi/rtl8822be/trx.c
@@ -571,9 +571,9 @@ static u8 rtl8822be_sc_mapping(struct ieee80211_hw *hw,
sc_setting_of_desc =
VHT_DATA_SC_20_UPPERST_OF_80MHZ;
else
- RT_TRACE(
- rtlpriv, COMP_SEND, DBG_LOUD,
- "rtl8822be_sc_mapping: Not Correct Primary40MHz Setting\n");
+ RT_TRACE(rtlpriv, COMP_SEND, DBG_LOUD,
+ "%s: Not Correct Primary40MHz Setting\n",
+ __func__);
}
} else if (rtlphy->current_chan_bw == HT_CHANNEL_WIDTH_20_40) {
if (ptcb_desc->packet_bw == HT_CHANNEL_WIDTH_20_40) {
--
2.7.4
^ permalink raw reply related [flat|nested] 5+ messages in thread
* [PATCH 3/4] staging: rtlwifi: rtl8822be: Remove useless parentheses
2017-10-18 3:24 [PATCH 0/4] staging: rtlwifi: rtl8822be: Fix code styling issues and the hardcode of a func name Frank A. Cancio Bello
2017-10-18 3:30 ` [PATCH 1/4] staging: rtlwifi: rtl8822be: Balance braces in else statement Frank A. Cancio Bello
2017-10-18 3:33 ` [PATCH 2/4] staging: rtlwifi: rtl8822be: Use __func__ instead of hardcoded name Frank A. Cancio Bello
@ 2017-10-18 3:35 ` Frank A. Cancio Bello
2017-10-18 3:37 ` [PATCH 4/4] staging: rtlwifi: rtl8822be: Align the * in block comment Frank A. Cancio Bello
3 siblings, 0 replies; 5+ messages in thread
From: Frank A. Cancio Bello @ 2017-10-18 3:35 UTC (permalink / raw)
To: pablo, Julia.Lawall; +Cc: gregkh, outreachy-kernel
Remove unnecessary parentheses to comply with preferred coding style for
the linux kernel and avoid the following checkpatch's message:
'CHECK: Unnecessary parentheses around'.
Credits to checkpatch.
Signed-off-by: Frank A. Cancio Bello <frank@generalsoftwareinc.com>
---
drivers/staging/rtlwifi/rtl8822be/fw.c | 4 ++--
drivers/staging/rtlwifi/rtl8822be/led.c | 2 +-
drivers/staging/rtlwifi/rtl8822be/phy.c | 10 +++++-----
drivers/staging/rtlwifi/rtl8822be/trx.c | 18 +++++++++---------
4 files changed, 17 insertions(+), 17 deletions(-)
diff --git a/drivers/staging/rtlwifi/rtl8822be/fw.c b/drivers/staging/rtlwifi/rtl8822be/fw.c
index 02f5004..fa62983 100644
--- a/drivers/staging/rtlwifi/rtl8822be/fw.c
+++ b/drivers/staging/rtlwifi/rtl8822be/fw.c
@@ -330,7 +330,7 @@ void rtl8822be_set_fw_pwrmode_cmd(struct ieee80211_hw *hw, u8 mode)
byte5 = btc_ops->btc_get_lps_val(rtlpriv);
power_state = btc_ops->btc_get_rpwm_val(rtlpriv);
- if ((rlbm == 2) && (byte5 & BIT(4))) {
+ if (rlbm == 2 && (byte5 & BIT(4))) {
/* Keep awake interval to 1 to prevent from
* decreasing coex performance
*/
@@ -835,7 +835,7 @@ void rtl8822be_set_p2p_ps_offload_cmd(struct ieee80211_hw *hw, u8 p2p_ps_state)
rtl_write_dword(rtlpriv, 0x5EC,
p2pinfo->noa_count_type[i]);
}
- if ((p2pinfo->opp_ps == 1) || (p2pinfo->noa_num > 0)) {
+ if (p2pinfo->opp_ps == 1 || p2pinfo->noa_num > 0) {
/* rst p2p circuit */
rtl_write_byte(rtlpriv, REG_DUAL_TSF_RST_8822B, BIT(4));
p2p_ps_offload->offload_en = 1;
diff --git a/drivers/staging/rtlwifi/rtl8822be/led.c b/drivers/staging/rtlwifi/rtl8822be/led.c
index f4b5af8..0054c89 100644
--- a/drivers/staging/rtlwifi/rtl8822be/led.c
+++ b/drivers/staging/rtlwifi/rtl8822be/led.c
@@ -114,7 +114,7 @@ void rtl8822be_led_control(struct ieee80211_hw *hw, enum led_ctl_mode ledaction)
struct rtl_priv *rtlpriv = rtl_priv(hw);
struct rtl_ps_ctl *ppsc = rtl_psc(rtl_priv(hw));
- if ((ppsc->rfoff_reason > RF_CHANGE_BY_PS) &&
+ if (ppsc->rfoff_reason > RF_CHANGE_BY_PS &&
(ledaction == LED_CTL_TX || ledaction == LED_CTL_RX ||
ledaction == LED_CTL_SITE_SURVEY || ledaction == LED_CTL_LINK ||
ledaction == LED_CTL_NO_LINK ||
diff --git a/drivers/staging/rtlwifi/rtl8822be/phy.c b/drivers/staging/rtlwifi/rtl8822be/phy.c
index 589ef15..aacaca6 100644
--- a/drivers/staging/rtlwifi/rtl8822be/phy.c
+++ b/drivers/staging/rtlwifi/rtl8822be/phy.c
@@ -1610,9 +1610,9 @@ u8 rtl8822be_get_txpower_index(struct ieee80211_hw *hw, u8 path, u8 rate,
char limit;
char powerdiff_byrate = 0;
- if (((rtlhal->current_bandtype == BAND_ON_2_4G) &&
+ if ((rtlhal->current_bandtype == BAND_ON_2_4G &&
(channel > 14 || channel < 1)) ||
- ((rtlhal->current_bandtype == BAND_ON_5G) && (channel <= 14))) {
+ (rtlhal->current_bandtype == BAND_ON_5G && channel <= 14)) {
index = 0;
RT_TRACE(rtlpriv, COMP_POWER_TRACKING, DBG_LOUD,
"Illegal channel!!\n");
@@ -1913,8 +1913,8 @@ static u8 _rtl8822be_phy_get_pri_ch_id(struct rtl_priv *rtlpriv)
if (rtlphy->current_chan_bw == HT_CHANNEL_WIDTH_80) {
/* primary channel is at lower subband of 80MHz & 40MHz */
- if ((mac->cur_40_prime_sc == HAL_PRIME_CHNL_OFFSET_LOWER) &&
- (mac->cur_80_prime_sc == HAL_PRIME_CHNL_OFFSET_LOWER)) {
+ if (mac->cur_40_prime_sc == HAL_PRIME_CHNL_OFFSET_LOWER &&
+ mac->cur_80_prime_sc == HAL_PRIME_CHNL_OFFSET_LOWER) {
pri_ch_idx = VHT_DATA_SC_20_LOWEST_OF_80MHZ;
/* primary channel is at
* lower subband of 80MHz & upper subband of 40MHz
@@ -2142,7 +2142,7 @@ static bool _rtl8822be_phy_set_rf_power_state(struct ieee80211_hw *hw,
switch (rfpwr_state) {
case ERFON:
- if ((ppsc->rfpwr_state == ERFOFF) &&
+ if (ppsc->rfpwr_state == ERFOFF &&
RT_IN_PS_LEVEL(ppsc, RT_RF_OFF_LEVL_HALT_NIC)) {
bool rtstatus = false;
u32 initialize_count = 0;
diff --git a/drivers/staging/rtlwifi/rtl8822be/trx.c b/drivers/staging/rtlwifi/rtl8822be/trx.c
index 54f65f3..87e15e4 100644
--- a/drivers/staging/rtlwifi/rtl8822be/trx.c
+++ b/drivers/staging/rtlwifi/rtl8822be/trx.c
@@ -165,7 +165,7 @@ static bool rtl8822be_get_rxdesc_is_ht(struct ieee80211_hw *hw, u8 *pdesc)
RT_TRACE(rtlpriv, COMP_RXDESC, DBG_LOUD, "rx_rate=0x%02x.\n", rx_rate);
- if ((rx_rate >= DESC_RATEMCS0) && (rx_rate <= DESC_RATEMCS15))
+ if (rx_rate >= DESC_RATEMCS0 && rx_rate <= DESC_RATEMCS15)
return true;
else
return false;
@@ -193,8 +193,8 @@ static u8 rtl8822be_get_rx_vht_nss(struct ieee80211_hw *hw, u8 *pdesc)
rx_rate = GET_RX_DESC_RX_RATE(pdesc);
- if ((rx_rate >= DESC_RATEVHT1SS_MCS0) &&
- (rx_rate <= DESC_RATEVHT1SS_MCS9))
+ if (rx_rate >= DESC_RATEVHT1SS_MCS0 &&
+ rx_rate <= DESC_RATEVHT1SS_MCS9)
vht_nss = 1;
else if ((rx_rate >= DESC_RATEVHT2SS_MCS0) &&
(rx_rate <= DESC_RATEVHT2SS_MCS9))
@@ -510,8 +510,8 @@ static u8 rtl8822be_bw_mapping(struct ieee80211_hw *hw,
else
bw_setting_of_desc = 0;
} else if (rtlphy->current_chan_bw == HT_CHANNEL_WIDTH_20_40) {
- if ((ptcb_desc->packet_bw == HT_CHANNEL_WIDTH_20_40) ||
- (ptcb_desc->packet_bw == HT_CHANNEL_WIDTH_80))
+ if (ptcb_desc->packet_bw == HT_CHANNEL_WIDTH_20_40 ||
+ ptcb_desc->packet_bw == HT_CHANNEL_WIDTH_80)
bw_setting_of_desc = 1;
else
bw_setting_of_desc = 0;
@@ -546,10 +546,10 @@ static u8 rtl8822be_sc_mapping(struct ieee80211_hw *hw,
"%s: Not Correct Primary40MHz Setting\n",
__func__);
} else {
- if ((mac->cur_40_prime_sc ==
- HAL_PRIME_CHNL_OFFSET_LOWER) &&
- (mac->cur_80_prime_sc ==
- HAL_PRIME_CHNL_OFFSET_LOWER))
+ if (mac->cur_40_prime_sc ==
+ HAL_PRIME_CHNL_OFFSET_LOWER &&
+ mac->cur_80_prime_sc ==
+ HAL_PRIME_CHNL_OFFSET_LOWER)
sc_setting_of_desc =
VHT_DATA_SC_20_LOWEST_OF_80MHZ;
else if ((mac->cur_40_prime_sc ==
--
2.7.4
^ permalink raw reply related [flat|nested] 5+ messages in thread
* [PATCH 4/4] staging: rtlwifi: rtl8822be: Align the * in block comment
2017-10-18 3:24 [PATCH 0/4] staging: rtlwifi: rtl8822be: Fix code styling issues and the hardcode of a func name Frank A. Cancio Bello
` (2 preceding siblings ...)
2017-10-18 3:35 ` [PATCH 3/4] staging: rtlwifi: rtl8822be: Remove useless parentheses Frank A. Cancio Bello
@ 2017-10-18 3:37 ` Frank A. Cancio Bello
3 siblings, 0 replies; 5+ messages in thread
From: Frank A. Cancio Bello @ 2017-10-18 3:37 UTC (permalink / raw)
To: pablo, Julia.Lawall; +Cc: gregkh, outreachy-kernel
Align the * on each line of a block comment to comply with kernel coding
style and address the following checkpatch message:
'WARNING: Block comments should align the * on each line'.
Credits to checkpatch.
Signed-off-by: Frank A. Cancio Bello <frank@generalsoftwareinc.com>
---
drivers/staging/rtlwifi/rtl8822be/phy.c | 6 +++---
1 file changed, 3 insertions(+), 3 deletions(-)
diff --git a/drivers/staging/rtlwifi/rtl8822be/phy.c b/drivers/staging/rtlwifi/rtl8822be/phy.c
index aacaca6..ef37ae9 100644
--- a/drivers/staging/rtlwifi/rtl8822be/phy.c
+++ b/drivers/staging/rtlwifi/rtl8822be/phy.c
@@ -1756,9 +1756,9 @@ static void _rtl8822be_phy_set_txpower_index(struct ieee80211_hw *hw,
static u32 index;
/*
- * For 8822B, phydm api use 4 bytes txagc value
- * driver must combine every four 1 byte to one 4 byte and send to phydm
- */
+ * For 8822B, phydm api use 4 bytes txagc value driver must
+ * combine every four 1 byte to one 4 byte and send to phydm
+ */
shift = rate & 0x03;
index |= ((u32)power_index << (shift * 8));
--
2.7.4
^ permalink raw reply related [flat|nested] 5+ messages in thread
end of thread, other threads:[~2017-10-18 3:37 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2017-10-18 3:24 [PATCH 0/4] staging: rtlwifi: rtl8822be: Fix code styling issues and the hardcode of a func name Frank A. Cancio Bello
2017-10-18 3:30 ` [PATCH 1/4] staging: rtlwifi: rtl8822be: Balance braces in else statement Frank A. Cancio Bello
2017-10-18 3:33 ` [PATCH 2/4] staging: rtlwifi: rtl8822be: Use __func__ instead of hardcoded name Frank A. Cancio Bello
2017-10-18 3:35 ` [PATCH 3/4] staging: rtlwifi: rtl8822be: Remove useless parentheses Frank A. Cancio Bello
2017-10-18 3:37 ` [PATCH 4/4] staging: rtlwifi: rtl8822be: Align the * in block comment Frank A. Cancio Bello
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.