Skip to content

Commit c1ab111

Browse files
andy-shevbebarino
authored andcommitted
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 <[email protected]> Link: https://lore.kernel.org/r/[email protected] Reviewed-by: Chen-Yu Tsai <[email protected]> Signed-off-by: Stephen Boyd <[email protected]>
1 parent 6e3f07f commit c1ab111

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

drivers/clk/clk-fractional-divider.c

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -140,8 +140,8 @@ void clk_fractional_divider_general_approximation(struct clk_hw *hw,
140140
}
141141

142142
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);
145145
} else {
146146
max_m = GENMASK(fd->mwidth - 1, 0);
147147
max_n = GENMASK(fd->nwidth - 1, 0);
@@ -182,8 +182,8 @@ static int clk_fd_set_rate(struct clk_hw *hw, unsigned long rate,
182182
u32 val;
183183

184184
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);
187187
} else {
188188
max_m = GENMASK(fd->mwidth - 1, 0);
189189
max_n = GENMASK(fd->nwidth - 1, 0);

0 commit comments

Comments
 (0)