From: Andi Shyti <andi.shyti@kernel.org>
To: "Uwe Kleine-König" <u.kleine-koenig@pengutronix.de>
Cc: Dong Aisheng <aisheng.dong@nxp.com>,
Shawn Guo <shawnguo@kernel.org>,
Pengutronix Kernel Team <kernel@pengutronix.de>,
Fabio Estevam <festevam@gmail.com>,
NXP Linux Team <linux-imx@nxp.com>,
linux-i2c@vger.kernel.org, linux-arm-kernel@lists.infradead.org
Subject: Re: [PATCH] i2c: imx-lpi2c: Don't open-code DIV_ROUND_UP
Date: Thu, 1 Jun 2023 17:14:12 +0200 [thread overview]
Message-ID: <20230601151412.qfszgsl73q2jrr5l@intel.intel> (raw)
In-Reply-To: <20230601132532.2749426-1-u.kleine-koenig@pengutronix.de>
Hi Uwe,
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>
> ---
> drivers/i2c/busses/i2c-imx-lpi2c.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> 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);
you updated this at the end... looks good :)
Reviewed-by: Andi Shyti <andi.shyti@kernel.org>
Andi
> clklo = clk_cycle - clkhi;
> if (clklo < 64)
> break;
>
> base-commit: ac9a78681b921877518763ba0e89202254349d1b
> --
> 2.39.2
>
_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
next prev parent reply other threads:[~2023-06-01 15:14 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-06-01 13:25 [PATCH] i2c: imx-lpi2c: Don't open-code DIV_ROUND_UP Uwe Kleine-König
2023-06-01 15:14 ` Andi Shyti [this message]
2023-06-09 15:27 ` Wolfram Sang
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20230601151412.qfszgsl73q2jrr5l@intel.intel \
--to=andi.shyti@kernel.org \
--cc=aisheng.dong@nxp.com \
--cc=festevam@gmail.com \
--cc=kernel@pengutronix.de \
--cc=linux-arm-kernel@lists.infradead.org \
--cc=linux-i2c@vger.kernel.org \
--cc=linux-imx@nxp.com \
--cc=shawnguo@kernel.org \
--cc=u.kleine-koenig@pengutronix.de \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox