* [PATCH v1 1/1] clk: fractional-divider: Use bit operations consistently
@ 2024-03-03 12:07 Andy Shevchenko
2024-03-04 3:24 ` Chen-Yu Tsai
2024-03-09 1:07 ` Stephen Boyd
0 siblings, 2 replies; 3+ messages in thread
From: Andy Shevchenko @ 2024-03-03 12:07 UTC (permalink / raw)
To: linux-clk, linux-kernel; +Cc: Michael Turquette, Stephen Boyd, Andy Shevchenko
Use BIT() where makes sense. This alings usage of bit operations
in the same pieces of code. Moreover, strictly speaking by the
letter of the C standard, left shift of 1 by 31 bits is UB (undefined
behaviour), switching to BIT() addresses that as well.
Signed-off-by: Andy Shevchenko <andy.shevchenko@gmail.com>
---
drivers/clk/clk-fractional-divider.c | 8 ++++----
1 file changed, 4 insertions(+), 4 deletions(-)
diff --git a/drivers/clk/clk-fractional-divider.c b/drivers/clk/clk-fractional-divider.c
index 5067e067e906..a0178182fc72 100644
--- a/drivers/clk/clk-fractional-divider.c
+++ b/drivers/clk/clk-fractional-divider.c
@@ -140,8 +140,8 @@ void clk_fractional_divider_general_approximation(struct clk_hw *hw,
}
if (fd->flags & CLK_FRAC_DIVIDER_ZERO_BASED) {
- max_m = 1 << fd->mwidth;
- max_n = 1 << fd->nwidth;
+ max_m = BIT(fd->mwidth);
+ max_n = BIT(fd->nwidth);
} else {
max_m = GENMASK(fd->mwidth - 1, 0);
max_n = GENMASK(fd->nwidth - 1, 0);
@@ -182,8 +182,8 @@ static int clk_fd_set_rate(struct clk_hw *hw, unsigned long rate,
u32 val;
if (fd->flags & CLK_FRAC_DIVIDER_ZERO_BASED) {
- max_m = 1 << fd->mwidth;
- max_n = 1 << fd->nwidth;
+ max_m = BIT(fd->mwidth);
+ max_n = BIT(fd->nwidth);
} else {
max_m = GENMASK(fd->mwidth - 1, 0);
max_n = GENMASK(fd->nwidth - 1, 0);
--
2.44.0
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH v1 1/1] clk: fractional-divider: Use bit operations consistently
2024-03-03 12:07 [PATCH v1 1/1] clk: fractional-divider: Use bit operations consistently Andy Shevchenko
@ 2024-03-04 3:24 ` Chen-Yu Tsai
2024-03-09 1:07 ` Stephen Boyd
1 sibling, 0 replies; 3+ messages in thread
From: Chen-Yu Tsai @ 2024-03-04 3:24 UTC (permalink / raw)
To: Andy Shevchenko; +Cc: linux-clk, linux-kernel, Michael Turquette, Stephen Boyd
On Sun, Mar 3, 2024 at 8:07 PM Andy Shevchenko
<andy.shevchenko@gmail.com> wrote:
>
> Use BIT() where makes sense. This alings usage of bit operations
> in the same pieces of code. Moreover, strictly speaking by the
> letter of the C standard, left shift of 1 by 31 bits is UB (undefined
> behaviour), switching to BIT() addresses that as well.
>
> Signed-off-by: Andy Shevchenko <andy.shevchenko@gmail.com>
Reviewed-by: Chen-Yu Tsai <wenst@chromium.org>
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH v1 1/1] clk: fractional-divider: Use bit operations consistently
2024-03-03 12:07 [PATCH v1 1/1] clk: fractional-divider: Use bit operations consistently Andy Shevchenko
2024-03-04 3:24 ` Chen-Yu Tsai
@ 2024-03-09 1:07 ` Stephen Boyd
1 sibling, 0 replies; 3+ messages in thread
From: Stephen Boyd @ 2024-03-09 1:07 UTC (permalink / raw)
To: Andy Shevchenko, linux-clk, linux-kernel
Cc: Michael Turquette, Andy Shevchenko
Quoting Andy Shevchenko (2024-03-03 04:07:32)
> Use BIT() where makes sense. This alings usage of bit operations
> in the same pieces of code. Moreover, strictly speaking by the
> letter of the C standard, left shift of 1 by 31 bits is UB (undefined
> behaviour), switching to BIT() addresses that as well.
>
> Signed-off-by: Andy Shevchenko <andy.shevchenko@gmail.com>
> ---
Applied to clk-next
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2024-03-09 1:07 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2024-03-03 12:07 [PATCH v1 1/1] clk: fractional-divider: Use bit operations consistently Andy Shevchenko
2024-03-04 3:24 ` Chen-Yu Tsai
2024-03-09 1:07 ` Stephen Boyd
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®