* [PATCH] staging: rtl8192e: Remove unncessary paranthesis.
@ 2019-03-26 17:11 Sanjana Sanikommu
2019-03-26 17:54 ` [Outreachy kernel] " Julia Lawall
0 siblings, 1 reply; 4+ messages in thread
From: Sanjana Sanikommu @ 2019-03-26 17:11 UTC (permalink / raw)
To: gregkh; +Cc: outreachy-kernel
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
-)
)
Signed-off-by: Sanjana Sanikommu <sanjana99reddy99@gmail.com>
---
.../staging/rtl8192e/rtl8192e/r8192E_phy.c | 20 +++++++++----------
1 file changed, 10 insertions(+), 10 deletions(-)
diff --git a/drivers/staging/rtl8192e/rtl8192e/r8192E_phy.c b/drivers/staging/rtl8192e/rtl8192e/r8192E_phy.c
index 73497d559b77..3de07a79b3e0 100644
--- a/drivers/staging/rtl8192e/rtl8192e/r8192E_phy.c
+++ b/drivers/staging/rtl8192e/rtl8192e/r8192E_phy.c
@@ -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),
--
2.17.1
^ permalink raw reply related [flat|nested] 4+ messages in thread
* Re: [Outreachy kernel] [PATCH] staging: rtl8192e: Remove unncessary paranthesis.
2019-03-26 17:11 [PATCH] staging: rtl8192e: Remove unncessary paranthesis Sanjana Sanikommu
@ 2019-03-26 17:54 ` Julia Lawall
2019-03-27 12:59 ` 16r01a0546
2019-03-27 13:02 ` sanjana99reddy99
0 siblings, 2 replies; 4+ messages in thread
From: Julia Lawall @ 2019-03-26 17:54 UTC (permalink / raw)
To: Sanjana Sanikommu; +Cc: gregkh, outreachy-kernel
On Tue, 26 Mar 2019, Sanjana Sanikommu wrote:
> 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.
> expression l, r, t;
> @@
>
> (
> l = (r op t)
> |
> l =
> -(
> r
> -)
> )
>
> Signed-off-by: Sanjana Sanikommu <sanjana99reddy99@gmail.com>
> ---
> .../staging/rtl8192e/rtl8192e/r8192E_phy.c | 20 +++++++++----------
> 1 file changed, 10 insertions(+), 10 deletions(-)
>
> diff --git a/drivers/staging/rtl8192e/rtl8192e/r8192E_phy.c b/drivers/staging/rtl8192e/rtl8192e/r8192E_phy.c
> index 73497d559b77..3de07a79b3e0 100644
> --- a/drivers/staging/rtl8192e/rtl8192e/r8192E_phy.c
> +++ b/drivers/staging/rtl8192e/rtl8192e/r8192E_phy.c
> @@ -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
> 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),
> --
> 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 outreachy-kernel+unsubscribe@googlegroups.com.
> To post to this group, send email to outreachy-kernel@googlegroups.com.
> 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.
>
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [Outreachy kernel] [PATCH] staging: rtl8192e: Remove unncessary paranthesis.
2019-03-26 17:54 ` [Outreachy kernel] " Julia Lawall
@ 2019-03-27 12:59 ` 16r01a0546
2019-03-27 13:02 ` sanjana99reddy99
1 sibling, 0 replies; 4+ messages in thread
From: 16r01a0546 @ 2019-03-27 12:59 UTC (permalink / raw)
To: outreachy-kernel
[-- Attachment #1.1: Type: text/plain, Size: 5701 bytes --]
On Tuesday, March 26, 2019 at 11:24:17 PM UTC+5:30, Julia Lawall wrote:
>
>
>
> On Tue, 26 Mar 2019, Sanjana Sanikommu wrote:
>
> > 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.
Yes, I agree I would remove == from binary operator
>
>
> > expression l, r, t;
> > @@
> >
> > (
> > l = (r op t)
> > |
> > l =
> > -(
> > r
> > -)
> > )
> >
> > Signed-off-by: Sanjana Sanikommu <sanjana9...@gmail.com <javascript:>>
> > ---
> > .../staging/rtl8192e/rtl8192e/r8192E_phy.c | 20 +++++++++----------
> > 1 file changed, 10 insertions(+), 10 deletions(-)
> >
> > diff --git a/drivers/staging/rtl8192e/rtl8192e/r8192E_phy.c
> b/drivers/staging/rtl8192e/rtl8192e/r8192E_phy.c
> > index 73497d559b77..3de07a79b3e0 100644
> > --- a/drivers/staging/rtl8192e/rtl8192e/r8192E_phy.c
> > +++ b/drivers/staging/rtl8192e/rtl8192e/r8192E_phy.c
> > @@ -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?
>
> Yes, I will update semantic patch
Sanjana
> julia
>
> > 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),
> > --
> > 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 outreachy-kern...@googlegroups.com <javascript:>.
> > To post to this group, send email to outreach...@googlegroups.com
> <javascript:>.
> > 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.
> >
>
[-- Attachment #1.2: Type: text/html, Size: 9582 bytes --]
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [Outreachy kernel] [PATCH] staging: rtl8192e: Remove unncessary paranthesis.
2019-03-26 17:54 ` [Outreachy kernel] " Julia Lawall
2019-03-27 12:59 ` 16r01a0546
@ 2019-03-27 13:02 ` sanjana99reddy99
1 sibling, 0 replies; 4+ messages in thread
From: sanjana99reddy99 @ 2019-03-27 13:02 UTC (permalink / raw)
To: outreachy-kernel
[-- Attachment #1.1: Type: text/plain, Size: 5745 bytes --]
On Tuesday, March 26, 2019 at 11:24:17 PM UTC+5:30, Julia Lawall wrote:
>
>
>
> On Tue, 26 Mar 2019, Sanjana Sanikommu wrote:
>
> > 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.
>
Yes, I agree I would remove == from binary operators.
>
> > expression l, r, t;
> > @@
> >
> > (
> > l = (r op t)
> > |
> > l =
> > -(
> > r
> > -)
> > )
> >
> > Signed-off-by: Sanjana Sanikommu <sanjana9...@gmail.com <javascript:>>
> > ---
> > .../staging/rtl8192e/rtl8192e/r8192E_phy.c | 20 +++++++++----------
> > 1 file changed, 10 insertions(+), 10 deletions(-)
> >
> > diff --git a/drivers/staging/rtl8192e/rtl8192e/r8192E_phy.c
> b/drivers/staging/rtl8192e/rtl8192e/r8192E_phy.c
> > index 73497d559b77..3de07a79b3e0 100644
> > --- a/drivers/staging/rtl8192e/rtl8192e/r8192E_phy.c
> > +++ b/drivers/staging/rtl8192e/rtl8192e/r8192E_phy.c
> > @@ -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?
>
> Yes, I will update my semantic patch by considering parenthesis :)
Sanjana
>
> julia
>
> > 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),
> > --
> > 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 outreachy-kern...@googlegroups.com <javascript:>.
> > To post to this group, send email to outreach...@googlegroups.com
> <javascript:>.
> > 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.
> >
>
[-- Attachment #1.2: Type: text/html, Size: 9754 bytes --]
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2019-03-31 17:58 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-03-26 17:11 [PATCH] staging: rtl8192e: Remove unncessary paranthesis Sanjana Sanikommu
2019-03-26 17:54 ` [Outreachy kernel] " Julia Lawall
2019-03-27 12:59 ` 16r01a0546
2019-03-27 13:02 ` sanjana99reddy99
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.