staging: rtl8192e: Remove unncessary paranthesis.
PATCH 1/1 staging: rtl8192e: Remove unncessary paranthesis.
Challenge suggested by coccinelle.
Remove unnecessary parathesis around the right hand of assignment using the below script.
@@
binary operator op = {==,!=,&&,||,>=,<=,&,|}; expression l, r, t;
@@
(
l = (r op t)
|
l =
-(
r
-)
)
--- .../staging/rtl8192e/rtl8192e/r8192E_phy.c | 20 +++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-)
drivers/staging/rtl8192e/rtl8192e/r8192E_phy.c +10 -10
@@ -81,8 +81,8 @@ void rtl92e_set_bb_reg(struct net_device *dev, u32 dwRegAddr, u32 dwBitMask,if (dwBitMask != bMaskDWord) { OriginalValue =rtl92e_readl (dev, dwRegAddr); BitShift =_rtl92e_calculate_bit_shift (dwBitMask); - NewValue = (((OriginalValue) & (~dwBitMask)) | - (dwData << BitShift)); + NewValue = ((OriginalValue) & (~dwBitMask)) | + (dwData << BitShift);rtl92e_writel (dev, dwRegAddr, NewValue); }else rtl92e_writel (dev, dwRegAddr, dwData);
@@ -223,8 +223,8 @@ void rtl92e_set_rf_reg(struct net_device *dev, enum rf90_radio_path eRFPath, Original_Value =_rtl92e_phy_rf_fw_read (dev, eRFPath, RegAddr); BitShift =_rtl92e_calculate_bit_shift (BitMask); - New_Value = (((Original_Value) & (~BitMask)) | - (Data << BitShift)); + New_Value = ((Original_Value) & (~BitMask)) | + (Data << BitShift);_rtl92e_phy_rf_fw_write (dev, eRFPath, RegAddr, New_Value);
@@ -237,8 +237,8 @@ void rtl92e_set_rf_reg(struct net_device *dev, enum rf90_radio_path eRFPath, Original_Value =_rtl92e_phy_rf_read (dev, eRFPath, RegAddr); BitShift =_rtl92e_calculate_bit_shift (BitMask); - New_Value = (((Original_Value) & (~BitMask)) | - (Data << BitShift)); + New_Value = ((Original_Value) & (~BitMask)) | + (Data << BitShift);_rtl92e_phy_rf_write (dev, eRFPath, RegAddr, New_Value); }else
@@ -571,9 +571,9 @@ static bool _rtl92e_bb_config_para_file(struct net_device *dev)if (priv->IC_Cut >VERSION_8190_BD ) {if (priv->rf_type ==RF_2T4R ) - dwRegValue = (priv->AntennaTxPwDiff[2 ]<<8 | + dwRegValue = priv->AntennaTxPwDiff[2 ]<<8 | priv->AntennaTxPwDiff[1 ]<<4 | - priv->AntennaTxPwDiff[0 ]); + priv->AntennaTxPwDiff[0 ];else dwRegValue =0x0 ; rtl92e_set_bb_reg(dev, rFPGA0_TxGainStage,
@@ -655,9 +655,9 @@ void rtl92e_set_tx_power(struct net_device *dev, u8 channel) priv->AntennaTxPwDiff[1 ] = (u8)(ant_pwr_diff); priv->AntennaTxPwDiff[0 ] =0 ; - u4RegValue = (priv->AntennaTxPwDiff[2 ]<<8 | + u4RegValue = priv->AntennaTxPwDiff[2 ]<<8 | priv->AntennaTxPwDiff[1 ]<<4 | - priv->AntennaTxPwDiff[0 ]); + priv->AntennaTxPwDiff[0 ]; rtl92e_set_bb_reg(dev, rFPGA0_TxGainStage, (bXBTxAGC|bXCTxAGC|bXDTxAGC),
Signature · 1 line
2.17.1
Quoted 6 lines · Sanjana Sanikommu
Challenge suggested by coccinelle.
Remove unnecessary parathesis around the right hand of assignment using the below script.@@
binary operator op = {==,!=,&&,||,>=,<=,&,|};
It's not relevant to your actual patch, but for == it could be a better idea to leave things as they are. x = y == z; is a bit easy to misread.
Quoted 22 lines
expression l, r, t;
@@(
l = (r op t)
|
l =
-(
r
-)
)Signed-off-by Sanjana Sanikommu <[email protected]>--- .../staging/rtl8192e/rtl8192e/r8192E_phy.c | 20 +++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-)drivers/staging/rtl8192e/rtl8192e/r8192E_phy.c +0
-0
drivers/staging/rtl8192e/rtl8192e/r8192E_phy.c void rtl92e_set_bb_reg(struct net_device *dev, u32 dwRegAddr, u32 dwBitMask, · line 85
Quoted 7 lines
drivers/staging/rtl8192e/rtl8192e/r8192E_phy.c +2
-2@@ -81,8 +81,8 @@ void rtl92e_set_bb_reg(struct net_device *dev, u32 dwRegAddr, u32 dwBitMask,if (dwBitMask != bMaskDWord) { OriginalValue =rtl92e_readl (dev, dwRegAddr); BitShift =_rtl92e_calculate_bit_shift (dwBitMask); - NewValue = (((OriginalValue) & (~dwBitMask)) | - (dwData << BitShift)); + NewValue = ((OriginalValue) & (~dwBitMask)) | + (dwData << BitShift);
The parentheses on (OriginalValue) and (~dwBitMask) are not needed and make the code harder to read (more clutter). Could you update your semantic patch to also take this case into account?
julia
Quoted 59 lines
drivers/staging/rtl8192e/rtl8192e/r8192E_phy.c +8
-9rtl92e_writel (dev, dwRegAddr, NewValue); }else rtl92e_writel (dev, dwRegAddr, dwData);@@ -223,8 +223,8 @@ void rtl92e_set_rf_reg(struct net_device *dev, enum rf90_radio_path eRFPath, Original_Value =_rtl92e_phy_rf_fw_read (dev, eRFPath, RegAddr); BitShift =_rtl92e_calculate_bit_shift (BitMask); - New_Value = (((Original_Value) & (~BitMask)) | - (Data << BitShift)); + New_Value = ((Original_Value) & (~BitMask)) | + (Data << BitShift);_rtl92e_phy_rf_fw_write (dev, eRFPath, RegAddr, New_Value);@@ -237,8 +237,8 @@ void rtl92e_set_rf_reg(struct net_device *dev, enum rf90_radio_path eRFPath, Original_Value =_rtl92e_phy_rf_read (dev, eRFPath, RegAddr); BitShift =_rtl92e_calculate_bit_shift (BitMask); - New_Value = (((Original_Value) & (~BitMask)) | - (Data << BitShift)); + New_Value = ((Original_Value) & (~BitMask)) | + (Data << BitShift);_rtl92e_phy_rf_write (dev, eRFPath, RegAddr, New_Value); }else @@ -571,9 +571,9 @@ static bool _rtl92e_bb_config_para_file(struct net_device *dev)if (priv->IC_Cut >VERSION_8190_BD ) {if (priv->rf_type ==RF_2T4R ) - dwRegValue = (priv->AntennaTxPwDiff[2 ]<<8 | + dwRegValue = priv->AntennaTxPwDiff[2 ]<<8 | priv->AntennaTxPwDiff[1 ]<<4 | - priv->AntennaTxPwDiff[0 ]); + priv->AntennaTxPwDiff[0 ];else dwRegValue =0x0 ; rtl92e_set_bb_reg(dev, rFPGA0_TxGainStage,@@ -655,9 +655,9 @@ void rtl92e_set_tx_power(struct net_device *dev, u8 channel) priv->AntennaTxPwDiff[1 ] = (u8)(ant_pwr_diff); priv->AntennaTxPwDiff[0 ] =0 ; - u4RegValue = (priv->AntennaTxPwDiff[2 ]<<8 | + u4RegValue = priv->AntennaTxPwDiff[2 ]<<8 | priv->AntennaTxPwDiff[1 ]<<4 | - priv->AntennaTxPwDiff[0 ]); + priv->AntennaTxPwDiff[0 ]; rtl92e_set_bb_reg(dev, rFPGA0_TxGainStage, (bXBTxAGC|bXCTxAGC|bXDTxAGC), --2.17.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/20190326171111.20036-1-sanjana99reddy99%40gmail.com.
For more options, visit https://groups.google.com/d/optout.
Quoted 9 lines · Julia Lawall
Quoted 4 lines · Sanjana Sanikommu
Challenge suggested by coccinelle.
Remove unnecessary parathesis around the right hand of assignment using the below script.
Quoted 6 lines
Quoted 2 lines
@@
binary operator op = {==,!=,&&,||,>=,<=,&,|};It's not relevant to your actual patch, but for == it could be a better idea to leave things as they are. x = y == z; is a bit easy to misread.
Yes, I agree I would remove == from binary operators.
Quoted 33 lines
Quoted 13 lines
expression l, r, t;
@@(
l = (r op t)
|
l =
-(
r
-)
)Review
Quoted 6 lines
Signed-off-by Sanjana Sanikommu <[email protected] <javascript:>>---
.../staging/rtl8192e/rtl8192e/r8192E_phy.c | 20 +++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-)(quoted diff) +0
-0
b/drivers/staging/rtl8192e/rtl8192e/r8192E_phy.cdrivers/staging/rtl8192e/rtl8192e/r8192E_phy.c void rtl92e_set_bb_reg(struct net_device *dev, u32
Quoted 4 lines
index
73497d559b77..3de07a79b3e0100644drivers/staging/rtl8192e/rtl8192e/r8192E_phy.c +0
-0@@ -81,8 +81,8 @@ void rtl92e_set_bb_reg(struct net_device *dev, u32dwRegAddr, u32 dwBitMask,
drivers/staging/rtl8192e/rtl8192e/r8192E_phy.c void rtl92e_set_bb_reg(struct net_device *dev, u32 dwRegAddr, u32 dwBitMask, · line 85
Quoted 7 lines
drivers/staging/rtl8192e/rtl8192e/r8192E_phy.c +2
-2if (dwBitMask != bMaskDWord) { OriginalValue =rtl92e_readl (dev, dwRegAddr); BitShift =_rtl92e_calculate_bit_shift (dwBitMask); - NewValue = (((OriginalValue) & (~dwBitMask)) | - (dwData << BitShift)); + NewValue = ((OriginalValue) & (~dwBitMask)) | + (dwData << BitShift);
Quoted 7 lines
The parentheses on (OriginalValue) and (~dwBitMask) are not needed and make the code harder to read (more clutter). Could you update your semantic patch to also take this case into account?
Yes, I will update my semantic patch by considering parenthesis :)
Sanjana
Quoted 78 lines
julia
drivers/staging/rtl8192e/rtl8192e/r8192E_phy.c void rtl92e_set_rf_reg(struct net_device *dev, enum
Quoted 4 lines
drivers/staging/rtl8192e/rtl8192e/r8192E_phy.c +0
-0rtl92e_writel (dev, dwRegAddr, NewValue); }else rtl92e_writel (dev, dwRegAddr, dwData);@@ -223,8 +223,8 @@ void rtl92e_set_rf_reg(struct net_device *dev, enum
rf90_radio_patheRFPath,drivers/staging/rtl8192e/rtl8192e/r8192E_phy.c void rtl92e_set_rf_reg(struct net_device *dev, enum · line 223
Quoted 1 line
drivers/staging/rtl8192e/rtl8192e/r8192E_phy.c +0
-0Original_Value = _rtl92e_phy_rf_fw_read(dev,eRFPath,
Quoted 1 line
RegAddr);Quoted 1 line
BitShift =
_rtl92e_calculate_bit_shift(BitMask);drivers/staging/rtl8192e/rtl8192e/r8192E_phy.c void rtl92e_set_rf_reg(struct net_device *dev, enum
Quoted 8 lines
drivers/staging/rtl8192e/rtl8192e/r8192E_phy.c +2
-2- New_Value = (((Original_Value) & (~BitMask)) | - (Data << BitShift)); + New_Value = ((Original_Value) & (~BitMask)) | + (Data << BitShift);_rtl92e_phy_rf_fw_write (dev, eRFPath, RegAddr, New_Value);@@ -237,8 +237,8 @@ void rtl92e_set_rf_reg(struct net_device *dev, enum
rf90_radio_patheRFPath,drivers/staging/rtl8192e/rtl8192e/r8192E_phy.c void rtl92e_set_rf_reg(struct net_device *dev, enum · line 237
Quoted 1 line
drivers/staging/rtl8192e/rtl8192e/r8192E_phy.c +0
-0Original_Value = _rtl92e_phy_rf_read(dev,eRFPath,
drivers/staging/rtl8192e/rtl8192e/r8192E_phy.c void rtl92e_set_rf_reg(struct net_device *dev, enum · line 239
Quoted 2 lines
drivers/staging/rtl8192e/rtl8192e/r8192E_phy.c +0
-0RegAddr); BitShift =
_rtl92e_calculate_bit_shift(BitMask);drivers/staging/rtl8192e/rtl8192e/r8192E_phy.c void rtl92e_set_rf_reg(struct net_device *dev, enum rf90_radio_path eRFPath,
Quoted 6 lines
drivers/staging/rtl8192e/rtl8192e/r8192E_phy.c +2
-2- New_Value = (((Original_Value) & (~BitMask)) | - (Data << BitShift)); + New_Value = ((Original_Value) & (~BitMask)) | + (Data << BitShift); _rtl92e_phy_rf_write(dev, eRFPath, RegAddr,
New_Value);drivers/staging/rtl8192e/rtl8192e/r8192E_phy.c static bool _rtl92e_bb_config_para_file(struct
Quoted 2 lines
drivers/staging/rtl8192e/rtl8192e/r8192E_phy.c +0
-0}else @@ -571,9 +571,9 @@ static bool _rtl92e_bb_config_para_file(struct
net_device*dev)drivers/staging/rtl8192e/rtl8192e/r8192E_phy.c void rtl92e_set_tx_power(struct net_device *dev, u8
Quoted 12 lines
drivers/staging/rtl8192e/rtl8192e/r8192E_phy.c +2
-2if (priv->IC_Cut >VERSION_8190_BD ) {if (priv->rf_type ==RF_2T4R ) - dwRegValue = (priv->AntennaTxPwDiff[2 ]<<8 | + dwRegValue = priv->AntennaTxPwDiff[2 ]<<8 | priv->AntennaTxPwDiff[1 ]<<4 | - priv->AntennaTxPwDiff[0 ]); + priv->AntennaTxPwDiff[0 ];else dwRegValue =0x0 ; rtl92e_set_bb_reg(dev, rFPGA0_TxGainStage,@@ -655,9 +655,9 @@ void rtl92e_set_tx_power(struct net_device *dev, u8channel)
Quoted 16 lines
drivers/staging/rtl8192e/rtl8192e/r8192E_phy.c +2
-2priv->AntennaTxPwDiff[1 ] = (u8)(ant_pwr_diff); priv->AntennaTxPwDiff[0 ] =0 ; - u4RegValue = (priv->AntennaTxPwDiff[2 ]<<8 | + u4RegValue = priv->AntennaTxPwDiff[2 ]<<8 | priv->AntennaTxPwDiff[1 ]<<4 | - priv->AntennaTxPwDiff[0 ]); + priv->AntennaTxPwDiff[0 ]; rtl92e_set_bb_reg(dev, rFPGA0_TxGainStage, (bXBTxAGC|bXCTxAGC|bXDTxAGC),Signature · 4 lines
2.17.1 -- You received this message because you are subscribed to the GoogleGroups "outreachy-kernel" group.
Quoted 1 line
To unsubscribe from this group and stop receiving emails from it, send
an email to [email protected] <javascript:>.
Quoted 1 line
To post to this group, send email to [email protected]
<javascript:>.
Quoted 1 line
To view this discussion on the web visit
Quoted 2 lines
For more options, visit https://groups.google.com/d/optout.
Quoted 9 lines · Julia Lawall
Quoted 4 lines · Sanjana Sanikommu
Challenge suggested by coccinelle.
Remove unnecessary parathesis around the right hand of assignment using the below script.
Quoted 5 lines
Quoted 2 lines
@@
binary operator op = {==,!=,&&,||,>=,<=,&,|};It's not relevant to your actual patch, but for == it could be a better idea to leave things as they are. x = y == z; is a bit easy to misread.
Yes, I agree I would remove == from binary operator
Quoted 34 lines
Quoted 14 lines
expression l, r, t;
@@(
l = (r op t)
|
l =
-(
r
-)
)Review
Quoted 6 lines
Signed-off-by Sanjana Sanikommu <[email protected] <javascript:>>---
.../staging/rtl8192e/rtl8192e/r8192E_phy.c | 20 +++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-)(quoted diff) +0
-0
b/drivers/staging/rtl8192e/rtl8192e/r8192E_phy.cdrivers/staging/rtl8192e/rtl8192e/r8192E_phy.c void rtl92e_set_bb_reg(struct net_device *dev, u32
Quoted 4 lines
index
73497d559b77..3de07a79b3e0100644drivers/staging/rtl8192e/rtl8192e/r8192E_phy.c +0
-0@@ -81,8 +81,8 @@ void rtl92e_set_bb_reg(struct net_device *dev, u32dwRegAddr, u32 dwBitMask,
drivers/staging/rtl8192e/rtl8192e/r8192E_phy.c void rtl92e_set_bb_reg(struct net_device *dev, u32 dwRegAddr, u32 dwBitMask, · line 85
Quoted 7 lines
drivers/staging/rtl8192e/rtl8192e/r8192E_phy.c +2
-2if (dwBitMask != bMaskDWord) { OriginalValue =rtl92e_readl (dev, dwRegAddr); BitShift =_rtl92e_calculate_bit_shift (dwBitMask); - NewValue = (((OriginalValue) & (~dwBitMask)) | - (dwData << BitShift)); + NewValue = ((OriginalValue) & (~dwBitMask)) | + (dwData << BitShift);
Quoted 5 lines
The parentheses on (OriginalValue) and (~dwBitMask) are not needed and make the code harder to read (more clutter). Could you update your semantic patch to also take this case into account?
Yes, I will update semantic patch
Sanjana
Quoted 77 lines
julia
drivers/staging/rtl8192e/rtl8192e/r8192E_phy.c void rtl92e_set_rf_reg(struct net_device *dev, enum
Quoted 4 lines
drivers/staging/rtl8192e/rtl8192e/r8192E_phy.c +0
-0rtl92e_writel (dev, dwRegAddr, NewValue); }else rtl92e_writel (dev, dwRegAddr, dwData);@@ -223,8 +223,8 @@ void rtl92e_set_rf_reg(struct net_device *dev, enum
rf90_radio_patheRFPath,drivers/staging/rtl8192e/rtl8192e/r8192E_phy.c void rtl92e_set_rf_reg(struct net_device *dev, enum · line 223
Quoted 1 line
drivers/staging/rtl8192e/rtl8192e/r8192E_phy.c +0
-0Original_Value = _rtl92e_phy_rf_fw_read(dev,eRFPath,
Quoted 1 line
RegAddr);Quoted 1 line
BitShift =
_rtl92e_calculate_bit_shift(BitMask);drivers/staging/rtl8192e/rtl8192e/r8192E_phy.c void rtl92e_set_rf_reg(struct net_device *dev, enum
Quoted 8 lines
drivers/staging/rtl8192e/rtl8192e/r8192E_phy.c +2
-2- New_Value = (((Original_Value) & (~BitMask)) | - (Data << BitShift)); + New_Value = ((Original_Value) & (~BitMask)) | + (Data << BitShift);_rtl92e_phy_rf_fw_write (dev, eRFPath, RegAddr, New_Value);@@ -237,8 +237,8 @@ void rtl92e_set_rf_reg(struct net_device *dev, enum
rf90_radio_patheRFPath,drivers/staging/rtl8192e/rtl8192e/r8192E_phy.c void rtl92e_set_rf_reg(struct net_device *dev, enum · line 237
Quoted 1 line
drivers/staging/rtl8192e/rtl8192e/r8192E_phy.c +0
-0Original_Value = _rtl92e_phy_rf_read(dev,eRFPath,
drivers/staging/rtl8192e/rtl8192e/r8192E_phy.c void rtl92e_set_rf_reg(struct net_device *dev, enum · line 239
Quoted 2 lines
drivers/staging/rtl8192e/rtl8192e/r8192E_phy.c +0
-0RegAddr); BitShift =
_rtl92e_calculate_bit_shift(BitMask);drivers/staging/rtl8192e/rtl8192e/r8192E_phy.c void rtl92e_set_rf_reg(struct net_device *dev, enum rf90_radio_path eRFPath,
Quoted 6 lines
drivers/staging/rtl8192e/rtl8192e/r8192E_phy.c +2
-2- New_Value = (((Original_Value) & (~BitMask)) | - (Data << BitShift)); + New_Value = ((Original_Value) & (~BitMask)) | + (Data << BitShift); _rtl92e_phy_rf_write(dev, eRFPath, RegAddr,
New_Value);drivers/staging/rtl8192e/rtl8192e/r8192E_phy.c static bool _rtl92e_bb_config_para_file(struct
Quoted 2 lines
drivers/staging/rtl8192e/rtl8192e/r8192E_phy.c +0
-0}else @@ -571,9 +571,9 @@ static bool _rtl92e_bb_config_para_file(struct
net_device*dev)drivers/staging/rtl8192e/rtl8192e/r8192E_phy.c void rtl92e_set_tx_power(struct net_device *dev, u8
Quoted 12 lines
drivers/staging/rtl8192e/rtl8192e/r8192E_phy.c +2
-2if (priv->IC_Cut >VERSION_8190_BD ) {if (priv->rf_type ==RF_2T4R ) - dwRegValue = (priv->AntennaTxPwDiff[2 ]<<8 | + dwRegValue = priv->AntennaTxPwDiff[2 ]<<8 | priv->AntennaTxPwDiff[1 ]<<4 | - priv->AntennaTxPwDiff[0 ]); + priv->AntennaTxPwDiff[0 ];else dwRegValue =0x0 ; rtl92e_set_bb_reg(dev, rFPGA0_TxGainStage,@@ -655,9 +655,9 @@ void rtl92e_set_tx_power(struct net_device *dev, u8channel)
Quoted 16 lines
drivers/staging/rtl8192e/rtl8192e/r8192E_phy.c +2
-2priv->AntennaTxPwDiff[1 ] = (u8)(ant_pwr_diff); priv->AntennaTxPwDiff[0 ] =0 ; - u4RegValue = (priv->AntennaTxPwDiff[2 ]<<8 | + u4RegValue = priv->AntennaTxPwDiff[2 ]<<8 | priv->AntennaTxPwDiff[1 ]<<4 | - priv->AntennaTxPwDiff[0 ]); + priv->AntennaTxPwDiff[0 ]; rtl92e_set_bb_reg(dev, rFPGA0_TxGainStage, (bXBTxAGC|bXCTxAGC|bXDTxAGC),Signature · 4 lines
2.17.1 -- You received this message because you are subscribed to the GoogleGroups "outreachy-kernel" group.
Quoted 1 line
To unsubscribe from this group and stop receiving emails from it, send
an email to [email protected] <javascript:>.
Quoted 1 line
To post to this group, send email to [email protected]
<javascript:>.
Quoted 1 line
To view this discussion on the web visit
Quoted 2 lines
For more options, visit https://groups.google.com/d/optout.