From patchwork Thu Jun 1 13:25:32 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Uwe_Kleine-K=C3=B6nig?= X-Patchwork-Id: 688015 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id B11C5C7EE29 for ; Thu, 1 Jun 2023 13:26:20 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233749AbjFAN0T (ORCPT ); Thu, 1 Jun 2023 09:26:19 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:34494 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233844AbjFAN0B (ORCPT ); Thu, 1 Jun 2023 09:26:01 -0400 Received: from metis.ext.pengutronix.de (metis.ext.pengutronix.de [IPv6:2001:67c:670:201:290:27ff:fe1d:cc33]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 347231B7 for ; Thu, 1 Jun 2023 06:25:41 -0700 (PDT) Received: from drehscheibe.grey.stw.pengutronix.de ([2a0a:edc0:0:c01:1d::a2]) by metis.ext.pengutronix.de with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1q4iJ6-0004xW-Iv; Thu, 01 Jun 2023 15:25:36 +0200 Received: from [2a0a:edc0:0:900:1d::77] (helo=ptz.office.stw.pengutronix.de) by drehscheibe.grey.stw.pengutronix.de with esmtp (Exim 4.94.2) (envelope-from ) id 1q4iJ5-004Mhv-Ol; Thu, 01 Jun 2023 15:25:35 +0200 Received: from ukl by ptz.office.stw.pengutronix.de with local (Exim 4.94.2) (envelope-from ) id 1q4iJ5-00AARb-4b; Thu, 01 Jun 2023 15:25:35 +0200 From: =?utf-8?q?Uwe_Kleine-K=C3=B6nig?= To: Dong Aisheng , Shawn Guo Cc: Pengutronix Kernel Team , Fabio Estevam , NXP Linux Team , linux-i2c@vger.kernel.org, linux-arm-kernel@lists.infradead.org Subject: [PATCH] i2c: imx-lpi2c: Don't open-code DIV_ROUND_UP Date: Thu, 1 Jun 2023 15:25:32 +0200 Message-Id: <20230601132532.2749426-1-u.kleine-koenig@pengutronix.de> X-Mailer: git-send-email 2.39.2 MIME-Version: 1.0 X-Developer-Signature: v=1; a=openpgp-sha256; l=948; i=u.kleine-koenig@pengutronix.de; h=from:subject; bh=uhu5f9qNVEJbzFwOYvmm2pKMCGWEve5udki5Qdmtwk0=; b=owEBbQGS/pANAwAKAY+A+1h9Ev5OAcsmYgBkeJxL4woxOhtmsc/1qX3cs68x7KdDFJvVSoBtw 1fqqOnGiHKJATMEAAEKAB0WIQQ/gaxpOnoeWYmt/tOPgPtYfRL+TgUCZHicSwAKCRCPgPtYfRL+ Ti8mCACVIJi+O2LuZPf7FFD6Kh3xhVBFWTT59qELsj30lmIQC3yOTh8jrgLt420fW/BVJlyawR9 vwDY5LzGvBAMrt7r9ktsMaEqroMFZV3AwiPqHWLKFVVBj65GxJHh6rJo/wepiRMnGyYupZh6R0n f68r3wTd3z31Fnde1iSJNkcRov13H2iP7r08TSQxM4xIPf+R97g/l+Zf+g2QLgvwR92oMwz8FEF jHNw+CgRRQ0hDJeOLRbEUFaNgzoi7O3bilEXVkoHgyXaSFNT40mePG8zsIw+ovVq1O8MfeWLCzn 9a16X2lohsQaEalJtbzARTqKrnO5yEYU4V2LUVnOPasEKMLV X-Developer-Key: i=u.kleine-koenig@pengutronix.de; a=openpgp; fpr=0D2511F322BFAB1C1580266BE2DCDD9132669BD6 X-SA-Exim-Connect-IP: 2a0a:edc0:0:c01:1d::a2 X-SA-Exim-Mail-From: ukl@pengutronix.de X-SA-Exim-Scanned: No (on metis.ext.pengutronix.de); SAEximRunCond expanded to false X-PTX-Original-Recipient: linux-i2c@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-i2c@vger.kernel.org There is no change in the generated code (tested on an ARCH=arm allmodconfig build). Signed-off-by: Uwe Kleine-König --- drivers/i2c/busses/i2c-imx-lpi2c.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) base-commit: ac9a78681b921877518763ba0e89202254349d1b 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;