soc: brcmstb: pm-arm: Remove duplicate/repeating constant

Message ID Y+dT6du6Nysyd8/t@ubun2204.myguest.virtualbox.org
State New
Headers
Series soc: brcmstb: pm-arm: Remove duplicate/repeating constant |

Commit Message

Deepak R Varma Feb. 11, 2023, 8:38 a.m. UTC
  Constant DDR_PHY_RST_N is unnecessarily or'ed with itself. Remove
the redundant constant from the expression.
Issue identified using doublebitand.cocci Coccinelle semantic patch.

Signed-off-by: Deepak R Varma <drv@mailo.com>
---
Please note: I was unable to build the change though I had the appropriate
config, arch and  cross compiler. I used the following:
	.config = bmips_stb_defconfig
	ARCH=mips
	CROSS_COMPILE=/usr/bin/mips-linux-gnu-
	BRCMSTB_PM=y

Let me know what I missed so I can build the objects myself. Thank you.


 drivers/soc/bcm/brcmstb/pm/pm-arm.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
  

Comments

Christophe JAILLET Feb. 11, 2023, 2:55 p.m. UTC | #1
Le 11/02/2023 à 09:38, Deepak R Varma a écrit :
> Constant DDR_PHY_RST_N is unnecessarily or'ed with itself. Remove
> the redundant constant from the expression.
> Issue identified using doublebitand.cocci Coccinelle semantic patch.
> 
> Signed-off-by: Deepak R Varma <drv@mailo.com>
> ---
> Please note: I was unable to build the change though I had the appropriate
> config, arch and  cross compiler. I used the following:
> 	.config = bmips_stb_defconfig
> 	ARCH=mips
> 	CROSS_COMPILE=/usr/bin/mips-linux-gnu-
> 	BRCMSTB_PM=y

The driver is pm-arm.c, try with arm instead of mips?

Worked for me with make.cross

> 
> Let me know what I missed so I can build the objects myself. Thank you.
> 
> 
>   drivers/soc/bcm/brcmstb/pm/pm-arm.c | 4 ++--
>   1 file changed, 2 insertions(+), 2 deletions(-)
> 
> diff --git a/drivers/soc/bcm/brcmstb/pm/pm-arm.c b/drivers/soc/bcm/brcmstb/pm/pm-arm.c
> index d681cd24c6e1..633e715446f7 100644
> --- a/drivers/soc/bcm/brcmstb/pm/pm-arm.c
> +++ b/drivers/soc/bcm/brcmstb/pm/pm-arm.c
> @@ -288,7 +288,7 @@ static inline void s5entry_method1(void)
>   		/* Step 3: Channel A (RST_N = CKE = 0) */
>   		tmp = readl_relaxed(ctrl.memcs[i].ddr_phy_base +
>   				  ctrl.phy_a_standby_ctrl_offs);
> -		tmp &= ~(DDR_PHY_RST_N | DDR_PHY_RST_N);
> +		tmp &= ~DDR_PHY_RST_N;

Based on step 3 comment above, maybe:

  -		tmp &= ~(DDR_PHY_RST_N | DDR_PHY_RST_N);
  +		tmp &= ~(DDR_PHY_RST_N | DDR_PHY_CKE);

?
>   		writel_relaxed(tmp, ctrl.memcs[i].ddr_phy_base +
>   			     ctrl.phy_a_standby_ctrl_offs);
>   
> @@ -296,7 +296,7 @@ static inline void s5entry_method1(void)
>   		if (ctrl.phy_b_standby_ctrl_offs != DDR_PHY_NO_CHANNEL) {
>   			tmp = readl_relaxed(ctrl.memcs[i].ddr_phy_base +
>   					  ctrl.phy_b_standby_ctrl_offs);
> -			tmp &= ~(DDR_PHY_RST_N | DDR_PHY_RST_N);
> +			tmp &= ~DDR_PHY_RST_N;

No such comment, but the code looks the same, so...

CJ

>   			writel_relaxed(tmp, ctrl.memcs[i].ddr_phy_base +
>   				     ctrl.phy_b_standby_ctrl_offs);
>   		}
  

Patch

diff --git a/drivers/soc/bcm/brcmstb/pm/pm-arm.c b/drivers/soc/bcm/brcmstb/pm/pm-arm.c
index d681cd24c6e1..633e715446f7 100644
--- a/drivers/soc/bcm/brcmstb/pm/pm-arm.c
+++ b/drivers/soc/bcm/brcmstb/pm/pm-arm.c
@@ -288,7 +288,7 @@  static inline void s5entry_method1(void)
 		/* Step 3: Channel A (RST_N = CKE = 0) */
 		tmp = readl_relaxed(ctrl.memcs[i].ddr_phy_base +
 				  ctrl.phy_a_standby_ctrl_offs);
-		tmp &= ~(DDR_PHY_RST_N | DDR_PHY_RST_N);
+		tmp &= ~DDR_PHY_RST_N;
 		writel_relaxed(tmp, ctrl.memcs[i].ddr_phy_base +
 			     ctrl.phy_a_standby_ctrl_offs);
 
@@ -296,7 +296,7 @@  static inline void s5entry_method1(void)
 		if (ctrl.phy_b_standby_ctrl_offs != DDR_PHY_NO_CHANNEL) {
 			tmp = readl_relaxed(ctrl.memcs[i].ddr_phy_base +
 					  ctrl.phy_b_standby_ctrl_offs);
-			tmp &= ~(DDR_PHY_RST_N | DDR_PHY_RST_N);
+			tmp &= ~DDR_PHY_RST_N;
 			writel_relaxed(tmp, ctrl.memcs[i].ddr_phy_base +
 				     ctrl.phy_b_standby_ctrl_offs);
 		}