Remove parentheses in rtlwifi
cover Remove parentheses in rtlwifi
The following patches remove the parentheses around the right hand side of expressions in rtlwifi. Issue found by Coccinelle using the following semantic patch:
@@
expression e1, e2, e3;
@@
(
if (e1)
e2;
else
e3;
|
-e1 = (e2);
+e1 = e2;
)
Nishka Dasgupta (3):
staging: rtlwifi: phydm: phydm_hwconfig.c: Remove parentheses
staging: rtlwifi: phydm: phydm_adc_sampling.c Remove brackets
staging: rtlwifi: phydm: phydm_debug.c: Remove brackets
.../staging/rtlwifi/phydm/phydm_adc_sampling.c | 4 ++-- drivers/staging/rtlwifi/phydm/phydm_debug.c | 12 ++++++------ drivers/staging/rtlwifi/phydm/phydm_hwconfig.c | 16 ++++++++-------- 3 files changed, 16 insertions(+), 16 deletions(-)
Signature · 1 line
2.19.1
PATCH 1/3 staging: rtlwifi: phydm: phydm_hwconfig.c: Remove parentheses
Remove parentheses around right hand side of expression. Issue found with Coccinelle.
--- drivers/staging/rtlwifi/phydm/phydm_hwconfig.c | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-)
drivers/staging/rtlwifi/phydm/phydm_hwconfig.c +8 -8
@@ -218,7 +218,7 @@ static u32 phydm_process_rssi_ofdm(struct phy_dm_struct *dm,/* Calculate average RSSI */ switch (rx_count) {case 2 : - rssi_linear = (rssi_linear >>1 ); + rssi_linear = rssi_linear >>1 ;break ;case 3 :/* rssi_linear/3 ~ rssi_linear*11/32 */
@@ -227,7 +227,7 @@ static u32 phydm_process_rssi_ofdm(struct phy_dm_struct *dm,5 ;break ;case 4 : - rssi_linear = (rssi_linear >>2 ); + rssi_linear = rssi_linear >>2 ;break ; }
@@ -813,8 +813,8 @@ static void odm_rx_phy_status_jaguar_series_parsing( cck_highpwr = dm->is_cck_high_power; cck_agc_rpt = phy_sta_rpt->cfosho[0 ]; - LNA_idx = ((cck_agc_rpt &0xE0 ) >>5 ); - VGA_idx = (cck_agc_rpt &0x1F ); + LNA_idx = (cck_agc_rpt &0xE0 ) >>5 ; + VGA_idx = cck_agc_rpt &0x1F ;if (dm->support_ic_type ==ODM_RTL8812 ) { rx_pwr_all =
@@ -1435,7 +1435,7 @@ static void phydm_set_per_path_phy_info(u8 rx_path, s8 rx_pwr, s8 rx_evm,if (rx_evm <0 ) {/* Calculate EVM in dBm */ - evm_dbm = ((u8)(0 - rx_evm) >>1 ); + evm_dbm = (u8)(0 - rx_evm) >>1 ;/* Calculate EVM in percentage */ if (evm_dbm >=33 )
@@ -1509,7 +1509,7 @@ static void phydm_get_rx_phy_status_type0(struct phy_dm_struct *dm,if (!dm->cck_new_agc) {u8 lna_idx, vga_idx; - lna_idx = ((phy_sta_rpt->lna_h <<3 ) | phy_sta_rpt->lna_l); + lna_idx = (phy_sta_rpt->lna_h <<3 ) | phy_sta_rpt->lna_l; vga_idx = phy_sta_rpt->vga;/* JJ ADD 20161014 */
@@ -1774,7 +1774,7 @@ phydm_process_rssi_for_dm_new_type(struct phy_dm_struct *dm,switch (phy_info->rx_count +1 ) {case 2 : - rssi_linear = (rssi_linear >>1 ); + rssi_linear = rssi_linear >>1 ;break ;case 3 :/* rssi_linear/3 ~ rssi_linear*11/32 */
@@ -1783,7 +1783,7 @@ phydm_process_rssi_for_dm_new_type(struct phy_dm_struct *dm,5 ;break ;case 4 : - rssi_linear = (rssi_linear >>2 ); + rssi_linear = rssi_linear >>2 ;break ; } rssi_ave =odm_convert_to_db (rssi_linear);
Signature · 1 line
2.19.1
PATCH 2/3 staging: rtlwifi: phydm: phydm_adc_sampling.c Remove brackets
In reply to Nishka DasguptaRemove parentheses around right hand side of expression. Issue found with Coccinelle.
--- drivers/staging/rtlwifi/phydm/phydm_adc_sampling.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/staging/rtlwifi/phydm/phydm_adc_sampling.c +2 -2
@@ -67,7 +67,7 @@ static void phydm_la_get_tx_pkt_buf(void *dm_void)"is_round_up = ((%d)), finish_addr=((0x%x)), 0x7c0=((0x%x))\n" , is_round_up, finish_addr, value32);/*Byte to 64Byte*/ - smp_number = ((adc_smp_buf->buffer_size) >>3 ); + smp_number = (adc_smp_buf->buffer_size) >>3 ; }else { addr = adc_smp_buf->start_pos;
@@ -103,7 +103,7 @@ static void phydm_la_get_tx_pkt_buf(void *dm_void)/*Reg140=0x780+(addr>>12), *addr=0x30~0x3F, total 16 pages */ - page = (addr >>12 ); + page = addr >>12 ; }odm_set_bb_reg (dm,0x0140 ,MASKLWORD ,0x780 + page);
Signature · 1 line
2.19.1
PATCH 3/3 staging: rtlwifi: phydm: phydm_debug.c: Remove brackets
In reply to Nishka DasguptaRemove parentheses around right hand side of expression and fix resulting alignment issues. Issue found with Coccinelle.
--- drivers/staging/rtlwifi/phydm/phydm_debug.c | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-)
drivers/staging/rtlwifi/phydm/phydm_debug.c +6 -6
@@ -51,20 +51,20 @@ static inline void phydm_check_dmval_txagc(struct phy_dm_struct *dm, u32 used, (power_index <<16 ) | (power_index <<8 ) | (power_index);for (i =0 ; i <ODM_RATEVHTSS2MCS9 ; i +=4 ) - status = (status & -phydm_api_set_txagc ( + status = status & +phydm_api_set_txagc ( dm, power_index, (enum odm_rf_radio_path ) dm_value[1 ], - i, false)); + i, false); }else if (dm->support_ic_type &ODM_RTL8197F ) {for (i =0 ; i <=ODM_RATEMCS15 ; i++) - status = (status & -phydm_api_set_txagc ( + status = status & +phydm_api_set_txagc ( dm, power_index, (enum odm_rf_radio_path ) dm_value[1 ], - i, false)); + i, false); }if (status)
Signature · 1 line
2.19.1
Re: [Outreachy kernel] [PATCH 3/3] staging: rtlwifi: phydm: phydm_debug.c: Remove brackets
Quoted 13 lines · Nishka Dasgupta' via outreachy-kernel
Remove parentheses around right hand side of expression and fix resulting alignment issues. Issue found with Coccinelle.
Signed-off-by Nishka Dasgupta <[email protected]>--- drivers/staging/rtlwifi/phydm/phydm_debug.c | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-)drivers/staging/rtlwifi/phydm/phydm_debug.c +0
-0
drivers/staging/rtlwifi/phydm/phydm_debug.c static inline void phydm_check_dmval_txagc(struct phy_dm_struct *dm, u32 used, · line 55
Quoted 7 lines
drivers/staging/rtlwifi/phydm/phydm_debug.c +2
-2@@ -51,20 +51,20 @@ static inline void phydm_check_dmval_txagc(struct phy_dm_struct *dm, u32 used, (power_index <<16 ) | (power_index <<8 ) | (power_index);for (i =0 ; i <ODM_RATEVHTSS2MCS9 ; i +=4 ) - status = (status & - phydm_api_set_txagc( + status = status & + phydm_api_set_txagc(
How about using &= in these cases? The code is a bit complex, and that would make it simpler.
julia
Quoted 29 lines
drivers/staging/rtlwifi/phydm/phydm_debug.c +4
-5dm, power_index, (enum odm_rf_radio_path ) dm_value[1 ], - i, false)); + i, false); }else if (dm->support_ic_type &ODM_RTL8197F ) {for (i =0 ; i <=ODM_RATEMCS15 ; i++) - status = (status & -phydm_api_set_txagc ( + status = status & +phydm_api_set_txagc ( dm, power_index, (enum odm_rf_radio_path ) dm_value[1 ], - i, false)); + i, false); }if (status) --2.19.1
--
You received this message because you are subscribed to the Google Groups "outreachy-kernel" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. To post to this group, send email to [email protected].
To view this discussion on the web visit https://groups.google.com/d/msgid/outreachy-kernel/20190328193041.13541-4-nishka.dasgupta%40yahoo.com.
For more options, visit https://groups.google.com/d/optout.