diff mbox series

i2c: imx-lpi2c: Don't open-code DIV_ROUND_UP

Message ID 20230601132532.2749426-1-u.kleine-koenig@pengutronix.de
State New
Headers show
Series i2c: imx-lpi2c: Don't open-code DIV_ROUND_UP | expand

Commit Message

Uwe Kleine-König June 1, 2023, 1:25 p.m. UTC
There is no change in the generated code (tested on an ARCH=arm
allmodconfig build).

Signed-off-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de>
---
 drivers/i2c/busses/i2c-imx-lpi2c.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)


base-commit: ac9a78681b921877518763ba0e89202254349d1b

Comments

Wolfram Sang June 9, 2023, 3:27 p.m. UTC | #1
On Thu, Jun 01, 2023 at 03:25:32PM +0200, Uwe Kleine-König wrote:
> There is no change in the generated code (tested on an ARCH=arm
> allmodconfig build).
> 
> Signed-off-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de>

Applied to for-next, thanks!
diff mbox series

Patch

diff --git a/drivers/i2c/busses/i2c-imx-lpi2c.c b/drivers/i2c/busses/i2c-imx-lpi2c.c
index 1af0a637d7f1..ae6ce28d3330 100644
--- a/drivers/i2c/busses/i2c-imx-lpi2c.c
+++ b/drivers/i2c/busses/i2c-imx-lpi2c.c
@@ -217,7 +217,7 @@  static int lpi2c_imx_config(struct lpi2c_imx_struct *lpi2c_imx)
 	for (prescale = 0; prescale <= 7; prescale++) {
 		clk_cycle = clk_rate / ((1 << prescale) * lpi2c_imx->bitrate)
 			    - 3 - (filt >> 1);
-		clkhi = (clk_cycle + I2C_CLK_RATIO) / (I2C_CLK_RATIO + 1);
+		clkhi = DIV_ROUND_UP(clk_cycle, I2C_CLK_RATIO + 1);
 		clklo = clk_cycle - clkhi;
 		if (clklo < 64)
 			break;