Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

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>

authored by

Andy Shevchenko and committed by
Stephen Boyd
c1ab111e 6e3f07f9

+4 -4
+4 -4
drivers/clk/clk-fractional-divider.c
··· 140 140 } 141 141 142 142 if (fd->flags & CLK_FRAC_DIVIDER_ZERO_BASED) { 143 - max_m = 1 << fd->mwidth; 144 - max_n = 1 << fd->nwidth; 143 + max_m = BIT(fd->mwidth); 144 + max_n = BIT(fd->nwidth); 145 145 } else { 146 146 max_m = GENMASK(fd->mwidth - 1, 0); 147 147 max_n = GENMASK(fd->nwidth - 1, 0); ··· 182 182 u32 val; 183 183 184 184 if (fd->flags & CLK_FRAC_DIVIDER_ZERO_BASED) { 185 - max_m = 1 << fd->mwidth; 186 - max_n = 1 << fd->nwidth; 185 + max_m = BIT(fd->mwidth); 186 + max_n = BIT(fd->nwidth); 187 187 } else { 188 188 max_m = GENMASK(fd->mwidth - 1, 0); 189 189 max_n = GENMASK(fd->nwidth - 1, 0);