diff options
author | Andy Shevchenko <andy.shevchenko@gmail.com> | 2024-03-03 15:07:32 +0300 |
---|---|---|
committer | Stephen Boyd <sboyd@kernel.org> | 2024-03-09 04:07:11 +0300 |
commit | c1ab111e62496d8c1232da767c2bc5cdc76596e5 (patch) | |
tree | 35e57143dff98c28050487bd0b6222f8c311a25f /drivers/clk/clk-fractional-divider.c | |
parent | 6e3f07f9df896fcb2ee80a7d61c70a64735590d9 (diff) | |
download | linux-c1ab111e62496d8c1232da767c2bc5cdc76596e5.tar.xz |
clk: fractional-divider: Use bit operations consistently
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>
Link: https://lore.kernel.org/r/20240303120732.240355-1-andy.shevchenko@gmail.com
Reviewed-by: Chen-Yu Tsai <wenst@chromium.org>
Signed-off-by: Stephen Boyd <sboyd@kernel.org>
Diffstat (limited to 'drivers/clk/clk-fractional-divider.c')
-rw-r--r-- | drivers/clk/clk-fractional-divider.c | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/drivers/clk/clk-fractional-divider.c b/drivers/clk/clk-fractional-divider.c index bd882c45385b..da057172cc90 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); |