mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* [PATCH] clk: tenstorrent: use regmap_assign_bits() for conditional set/clear
@ 2026-09-24  8:34 Peng Fan (OSS)
  2026-09-24 17:51 ` Anirudh Srinivasan
  2026-09-24 19:10 ` Drew Fustini
  0 siblings, 2 replies; 3+ messages in thread
From: Peng Fan (OSS) @ 2026-09-24  8:34 UTC (permalink / raw)
  To: Drew Fustini, Joel Stanley, Stephen Boyd, Brian Masney, Jerome Brunet
  Cc: linux-kernel, Peng Fan, linux-riscv, linux-clk

From: Peng Fan <peng.fan@nxp.com>

Replace if/else blocks using regmap_set_bits()/regmap_clear_bits() with
the simpler regmap_assign_bits() call.

Signed-off-by: Peng Fan <peng.fan@nxp.com>
---
 drivers/clk/tenstorrent/atlantis-prcm.c | 11 +++--------
 1 file changed, 3 insertions(+), 8 deletions(-)

diff --git a/drivers/clk/tenstorrent/atlantis-prcm.c b/drivers/clk/tenstorrent/atlantis-prcm.c
index 6d4386eeb7dae..854b9c48816f2 100644
--- a/drivers/clk/tenstorrent/atlantis-prcm.c
+++ b/drivers/clk/tenstorrent/atlantis-prcm.c
@@ -205,14 +205,9 @@ static int atlantis_clk_gate_endisable(struct clk_hw *hw, int enable)
 {
 	struct atlantis_clk_gate *gate = hw_to_atlantis_clk_gate(hw);
 
-	if (enable)
-		return regmap_set_bits(gate->common.regmap,
-				       gate->config.reg_offset,
-				       gate->config.enable);
-	else
-		return regmap_clear_bits(gate->common.regmap,
-					 gate->config.reg_offset,
-					 gate->config.enable);
+	return regmap_assign_bits(gate->common.regmap,
+				  gate->config.reg_offset,
+				  gate->config.enable, enable);
 }
 
 static int atlantis_clk_gate_enable(struct clk_hw *hw)
-- 
2.50.1


^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH] clk: tenstorrent: use regmap_assign_bits() for conditional set/clear
  2026-09-24  8:34 [PATCH] clk: tenstorrent: use regmap_assign_bits() for conditional set/clear Peng Fan (OSS)
@ 2026-09-24 17:51 ` Anirudh Srinivasan
  2026-09-24 19:10 ` Drew Fustini
  1 sibling, 0 replies; 3+ messages in thread
From: Anirudh Srinivasan @ 2026-09-24 17:51 UTC (permalink / raw)
  To: Peng Fan (OSS)
  Cc: Drew Fustini, Joel Stanley, Stephen Boyd, Brian Masney,
	Jerome Brunet, linux-kernel, Peng Fan, linux-riscv, linux-clk

Hi,

On Thu, Sep 24, 2026 at 04:34:38PM +0800, Peng Fan (OSS) wrote:
> From: Peng Fan <peng.fan@nxp.com>
> 
> Replace if/else blocks using regmap_set_bits()/regmap_clear_bits() with
> the simpler regmap_assign_bits() call.
> 
> Signed-off-by: Peng Fan <peng.fan@nxp.com>
> ---
>  drivers/clk/tenstorrent/atlantis-prcm.c | 11 +++--------
>  1 file changed, 3 insertions(+), 8 deletions(-)

Thanks for the fix.

Reviewed-by: Anirudh Srinivasan <asrinivasan@oss.tenstorrent.com>

> 
> diff --git a/drivers/clk/tenstorrent/atlantis-prcm.c b/drivers/clk/tenstorrent/atlantis-prcm.c
> index 6d4386eeb7dae..854b9c48816f2 100644
> --- a/drivers/clk/tenstorrent/atlantis-prcm.c
> +++ b/drivers/clk/tenstorrent/atlantis-prcm.c
> @@ -205,14 +205,9 @@ static int atlantis_clk_gate_endisable(struct clk_hw *hw, int enable)
>  {
>  	struct atlantis_clk_gate *gate = hw_to_atlantis_clk_gate(hw);
>  
> -	if (enable)
> -		return regmap_set_bits(gate->common.regmap,
> -				       gate->config.reg_offset,
> -				       gate->config.enable);
> -	else
> -		return regmap_clear_bits(gate->common.regmap,
> -					 gate->config.reg_offset,
> -					 gate->config.enable);
> +	return regmap_assign_bits(gate->common.regmap,
> +				  gate->config.reg_offset,
> +				  gate->config.enable, enable);
>  }
>  
>  static int atlantis_clk_gate_enable(struct clk_hw *hw)
> -- 
> 2.50.1
> 

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH] clk: tenstorrent: use regmap_assign_bits() for conditional set/clear
  2026-09-24  8:34 [PATCH] clk: tenstorrent: use regmap_assign_bits() for conditional set/clear Peng Fan (OSS)
  2026-09-24 17:51 ` Anirudh Srinivasan
@ 2026-09-24 19:10 ` Drew Fustini
  1 sibling, 0 replies; 3+ messages in thread
From: Drew Fustini @ 2026-09-24 19:10 UTC (permalink / raw)
  To: Peng Fan (OSS)
  Cc: Drew Fustini, Joel Stanley, Stephen Boyd, Brian Masney,
	Jerome Brunet, linux-kernel, Peng Fan, linux-riscv, linux-clk

On Thu, Sep 24, 2026 at 04:34:38PM +0800, Peng Fan (OSS) wrote:
> From: Peng Fan <peng.fan@nxp.com>
> 
> Replace if/else blocks using regmap_set_bits()/regmap_clear_bits() with
> the simpler regmap_assign_bits() call.
> 
> Signed-off-by: Peng Fan <peng.fan@nxp.com>
> ---
>  drivers/clk/tenstorrent/atlantis-prcm.c | 11 +++--------
>  1 file changed, 3 insertions(+), 8 deletions(-)
> 
> diff --git a/drivers/clk/tenstorrent/atlantis-prcm.c b/drivers/clk/tenstorrent/atlantis-prcm.c
> index 6d4386eeb7dae..854b9c48816f2 100644
> --- a/drivers/clk/tenstorrent/atlantis-prcm.c
> +++ b/drivers/clk/tenstorrent/atlantis-prcm.c
> @@ -205,14 +205,9 @@ static int atlantis_clk_gate_endisable(struct clk_hw *hw, int enable)
>  {
>  	struct atlantis_clk_gate *gate = hw_to_atlantis_clk_gate(hw);
>  
> -	if (enable)
> -		return regmap_set_bits(gate->common.regmap,
> -				       gate->config.reg_offset,
> -				       gate->config.enable);
> -	else
> -		return regmap_clear_bits(gate->common.regmap,
> -					 gate->config.reg_offset,
> -					 gate->config.enable);
> +	return regmap_assign_bits(gate->common.regmap,
> +				  gate->config.reg_offset,
> +				  gate->config.enable, enable);
>  }
>  
>  static int atlantis_clk_gate_enable(struct clk_hw *hw)
> -- 
> 2.50.1

Reviewed-by: Drew Fustini (Tenstorrent) <fustini@kernel.org>

I will apply this to tenstorrent-clk-for-next.

Thanks,
Drew


^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2026-09-24 19:10 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2026-09-24  8:34 [PATCH] clk: tenstorrent: use regmap_assign_bits() for conditional set/clear Peng Fan (OSS)
2026-09-24 17:51 ` Anirudh Srinivasan
2026-09-24 19:10 ` Drew Fustini

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®