From mboxrd@z Thu Jan 1 00:00:00 1970 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 60F0BC77B7E for ; Thu, 1 Jun 2023 15:14:22 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233671AbjFAPOV (ORCPT ); Thu, 1 Jun 2023 11:14:21 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:54712 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234299AbjFAPOS (ORCPT ); Thu, 1 Jun 2023 11:14:18 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 0630218F for ; Thu, 1 Jun 2023 08:14:17 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 9585361008 for ; Thu, 1 Jun 2023 15:14:16 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 23260C433D2; Thu, 1 Jun 2023 15:14:14 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1685632456; bh=BWuqix3iYt6ItyW/yuJYXANq/UkAe3dLO3iaTH5bAos=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=PIFSvxtK/eczcW/oiSWtq8/LRBF27fA/5p369wHLSDjrdsCCowQ+TgIodjhEInsgb 3CbR5A4IX5hFfPSH3kZ76v4gehNEfnhM7IAS03bV/2jpofmUrfRFi18x5BsPR4BjiK Z6ztrFX7/aH5oDcgI7NZXPTWKIF0DFrk3oezAAkY3aheftezh35+UxYLy2cZ33/Ts5 u7PYAhRiffx8dz3PX2sAhteAkiNkxRuTD1kfe25CdhMWg1CCmFGw8tE5MhtMXmZXv3 yFRMHmPmDQJ9Co0M0xVXEwg4WyDlli2LVp4k3FzY2EgyZ/mrQ92yxcVcb44CG6ivEd blcAMD216b84g== Date: Thu, 1 Jun 2023 17:14:12 +0200 From: Andi Shyti To: Uwe =?utf-8?Q?Kleine-K=C3=B6nig?= Cc: Dong Aisheng , Shawn Guo , Pengutronix Kernel Team , Fabio Estevam , NXP Linux Team , linux-i2c@vger.kernel.org, linux-arm-kernel@lists.infradead.org Subject: Re: [PATCH] i2c: imx-lpi2c: Don't open-code DIV_ROUND_UP Message-ID: <20230601151412.qfszgsl73q2jrr5l@intel.intel> References: <20230601132532.2749426-1-u.kleine-koenig@pengutronix.de> MIME-Version: 1.0 Content-Type: text/plain; charset=iso-8859-15 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: <20230601132532.2749426-1-u.kleine-koenig@pengutronix.de> Precedence: bulk List-ID: X-Mailing-List: linux-i2c@vger.kernel.org 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 > --- > 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 > clklo = clk_cycle - clkhi; > if (clklo < 64) > break; > > base-commit: ac9a78681b921877518763ba0e89202254349d1b > -- > 2.39.2 >