i2c: imx-lpi2c: Don't open-code DIV_ROUND_UP
authorUwe Kleine-König <u.kleine-koenig@pengutronix.de>
Thu, 1 Jun 2023 13:25:32 +0000 (15:25 +0200)
committerWolfram Sang <wsa@kernel.org>
Fri, 9 Jun 2023 15:30:47 +0000 (17:30 +0200)
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>
Reviewed-by: Andi Shyti <andi.shyti@kernel.org>
Signed-off-by: Wolfram Sang <wsa@kernel.org>
drivers/i2c/busses/i2c-imx-lpi2c.c

index 48e695880d0af1a9c493054a736825baac65e275..f8fa80203902672bea2c728a59f8a010be24700e 100644 (file)
@@ -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;