linux-clk.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH v1 1/1] clk: fractional-divider: Move mask calculations out of lock
@ 2024-03-03 12:14 Andy Shevchenko
  2024-03-04  3:28 ` Chen-Yu Tsai
                   ` (3 more replies)
  0 siblings, 4 replies; 7+ messages in thread
From: Andy Shevchenko @ 2024-03-03 12:14 UTC (permalink / raw)
  To: linux-clk, linux-kernel
  Cc: Michael Turquette, Stephen Boyd, Christophe JAILLET,
	Heiko Stuebner, Andy Shevchenko

There is no need to calculate masks under the lock taken.
Move them out of it.

Signed-off-by: Andy Shevchenko <andy.shevchenko@gmail.com>
---
 drivers/clk/clk-fractional-divider.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/drivers/clk/clk-fractional-divider.c b/drivers/clk/clk-fractional-divider.c
index a0178182fc72..da057172cc90 100644
--- a/drivers/clk/clk-fractional-divider.c
+++ b/drivers/clk/clk-fractional-divider.c
@@ -195,14 +195,14 @@ static int clk_fd_set_rate(struct clk_hw *hw, unsigned long rate,
 		n--;
 	}
 
+	mmask = GENMASK(fd->mwidth - 1, 0) << fd->mshift;
+	nmask = GENMASK(fd->nwidth - 1, 0) << fd->nshift;
+
 	if (fd->lock)
 		spin_lock_irqsave(fd->lock, flags);
 	else
 		__acquire(fd->lock);
 
-	mmask = GENMASK(fd->mwidth - 1, 0) << fd->mshift;
-	nmask = GENMASK(fd->nwidth - 1, 0) << fd->nshift;
-
 	val = clk_fd_readl(fd);
 	val &= ~(mmask | nmask);
 	val |= (m << fd->mshift) | (n << fd->nshift);
-- 
2.44.0


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

end of thread, other threads:[~2024-03-09 16:29 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-03-03 12:14 [PATCH v1 1/1] clk: fractional-divider: Move mask calculations out of lock Andy Shevchenko
2024-03-04  3:28 ` Chen-Yu Tsai
2024-03-04  7:05 ` Heiko Stübner
2024-03-09  1:06 ` Stephen Boyd
2024-03-09 16:29   ` Andy Shevchenko
2024-03-09  7:19 ` Christophe JAILLET
2024-03-09 16:27   ` Andy Shevchenko

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).