Received: by 2002:a05:6a10:f347:0:0:0:0 with SMTP id d7csp4972209pxu; Tue, 22 Dec 2020 05:33:36 -0800 (PST) X-Google-Smtp-Source: ABdhPJxmkzrnoM+AqphRwxXZC+8fv12Locif4zOMXOPrJ87BCVoJs1SJ+708RIK3y00uHcVuiYnD X-Received: by 2002:a50:cd9c:: with SMTP id p28mr19853809edi.83.1608644015965; Tue, 22 Dec 2020 05:33:35 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1608644015; cv=none; d=google.com; s=arc-20160816; b=VsLd2F8ph4h6MYqPLWh47Z+30x+5WAc+w5B0nDs8FtxtQnznR9tvHO1IWcrEf33P3C qL3DbwJ4PiepQOKKn72FySxL/EURzqgAdj8w51dTfDA/RZylDSXzoc10MitzVk6RCREz dLotEICBRTrLXjUsM3fQET9CxNh3EjjcADqPGyT7tkv0t1EnyVPpAiqtGMdYOPq5gbSO kuZPA9Xk3rHE7gVO/Vuvt77CXuZlALsQO4qK4oRLhE4cZTKEF6jrgk0I5vAE3v1TqFGu vgKEm9MiXmvnHuAtbbuPZ7987x0X9xtqaBxis657bgzPNpJpTuiHaiM7iMNl6cPR2wZO y3/Q== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :message-id:date:subject:cc:to:from; bh=ko8kMxuVpRksUTTYwX+oazzbL3qrGL3TZrLPugxc+LE=; b=RyE54L/xt0JMl5lX5YkKtjf9Sly7zP/JAkQnWTH1mc+2fEWFZ2eJxebm2TuX4hUoF+ EmkTAdyNoRve4UqNT4pEjZtBxj4JlOHqlinRXErKm1XU3Y2l5rLeHGcjeHxj8h23PL/n 5yGcuSkZM4GO9as2FeoG3ITM9u8LKtFvjialW2z82EAOBqT/Ot6QcJzXEy4c4I1LP14/ oRLTyykMkkO0ZguF+likoX4u5eD2hRQ/FrLoTc9JVD0apeYhVD2IdHH/XG4veGT8qRB0 cfWAikL3ySyPq5834JFonUo9Ybzr5t6NVeU/ETFO94gjEu1Z1uMSEldATfEHtFm+uxPY tpuA== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id md13si10811069ejb.324.2020.12.22.05.33.13; Tue, 22 Dec 2020 05:33:35 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727558AbgLVNcV (ORCPT + 99 others); Tue, 22 Dec 2020 08:32:21 -0500 Received: from szxga06-in.huawei.com ([45.249.212.32]:9471 "EHLO szxga06-in.huawei.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727146AbgLVNcU (ORCPT ); Tue, 22 Dec 2020 08:32:20 -0500 Received: from DGGEMS406-HUB.china.huawei.com (unknown [172.30.72.59]) by szxga06-in.huawei.com (SkyGuard) with ESMTP id 4D0cfj6R67zhw4Y; Tue, 22 Dec 2020 21:30:53 +0800 (CST) Received: from ubuntu.network (10.175.138.68) by DGGEMS406-HUB.china.huawei.com (10.3.19.206) with Microsoft SMTP Server id 14.3.498.0; Tue, 22 Dec 2020 21:31:21 +0800 From: Zheng Yongjun To: , , , , CC: , , , "Zheng Yongjun" Subject: [PATCH -next] i2c: busses: use DIV_ROUND_UP macro to do calculation Date: Tue, 22 Dec 2020 21:31:31 +0800 Message-ID: <20201222133131.19525-1-zhengyongjun3@huawei.com> X-Mailer: git-send-email 2.22.0 MIME-Version: 1.0 Content-Transfer-Encoding: 7BIT Content-Type: text/plain; charset=US-ASCII X-Originating-IP: [10.175.138.68] X-CFilter-Loop: Reflected Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Don't open-code DIV_ROUND_UP() kernel macro. Signed-off-by: Zheng Yongjun --- drivers/i2c/busses/i2c-imx.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/drivers/i2c/busses/i2c-imx.c b/drivers/i2c/busses/i2c-imx.c index e6f8d6e45a15..346c196cbce7 100644 --- a/drivers/i2c/busses/i2c-imx.c +++ b/drivers/i2c/busses/i2c-imx.c @@ -529,7 +529,7 @@ static void i2c_imx_set_clk(struct imx_i2c_struct *i2c_imx, i2c_imx->cur_clk = i2c_clk_rate; - div = (i2c_clk_rate + i2c_imx->bitrate - 1) / i2c_imx->bitrate; + div = DIV_ROUND_UP(i2c_clk_rate, i2c_imx->bitrate); if (div < i2c_clk_div[0].div) i = 0; else if (div > i2c_clk_div[i2c_imx->hwdata->ndivs - 1].div) @@ -547,8 +547,8 @@ static void i2c_imx_set_clk(struct imx_i2c_struct *i2c_imx, * This delay is used in I2C bus disable function * to fix chip hardware bug. */ - i2c_imx->disable_delay = (500000U * i2c_clk_div[i].div - + (i2c_clk_rate / 2) - 1) / (i2c_clk_rate / 2); + i2c_imx->disable_delay = DIV_ROUND_UP(500000U * i2c_clk_div[i].div, + i2c_clk_rate / 2); #ifdef CONFIG_I2C_DEBUG_BUS dev_dbg(&i2c_imx->adapter.dev, "I2C_CLK=%d, REQ DIV=%d\n", -- 2.22.0