mirror of
				https://github.com/torvalds/linux.git
				synced 2025-11-04 10:40:15 +02:00 
			
		
		
		
	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>
This commit is contained in:
		
							parent
							
								
									6e3f07f9df
								
							
						
					
					
						commit
						c1ab111e62
					
				
					 1 changed files with 4 additions and 4 deletions
				
			
		| 
						 | 
					@ -140,8 +140,8 @@ void clk_fractional_divider_general_approximation(struct clk_hw *hw,
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	if (fd->flags & CLK_FRAC_DIVIDER_ZERO_BASED) {
 | 
						if (fd->flags & CLK_FRAC_DIVIDER_ZERO_BASED) {
 | 
				
			||||||
		max_m = 1 << fd->mwidth;
 | 
							max_m = BIT(fd->mwidth);
 | 
				
			||||||
		max_n = 1 << fd->nwidth;
 | 
							max_n = BIT(fd->nwidth);
 | 
				
			||||||
	} else {
 | 
						} else {
 | 
				
			||||||
		max_m = GENMASK(fd->mwidth - 1, 0);
 | 
							max_m = GENMASK(fd->mwidth - 1, 0);
 | 
				
			||||||
		max_n = GENMASK(fd->nwidth - 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;
 | 
						u32 val;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	if (fd->flags & CLK_FRAC_DIVIDER_ZERO_BASED) {
 | 
						if (fd->flags & CLK_FRAC_DIVIDER_ZERO_BASED) {
 | 
				
			||||||
		max_m = 1 << fd->mwidth;
 | 
							max_m = BIT(fd->mwidth);
 | 
				
			||||||
		max_n = 1 << fd->nwidth;
 | 
							max_n = BIT(fd->nwidth);
 | 
				
			||||||
	} else {
 | 
						} else {
 | 
				
			||||||
		max_m = GENMASK(fd->mwidth - 1, 0);
 | 
							max_m = GENMASK(fd->mwidth - 1, 0);
 | 
				
			||||||
		max_n = GENMASK(fd->nwidth - 1, 0);
 | 
							max_n = GENMASK(fd->nwidth - 1, 0);
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
		Loading…
	
		Reference in a new issue