[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20260112134900.4142954-6-andriy.shevchenko@linux.intel.com>
Date: Mon, 12 Jan 2026 14:46:13 +0100
From: Andy Shevchenko <andriy.shevchenko@...ux.intel.com>
To: Andi Shyti <andi@...da.it>,
Andy Shevchenko <andriy.shevchenko@...ux.intel.com>,
Wolfram Sang <wsa+renesas@...g-engineering.com>,
Qianfeng Rong <rongqianfeng@...o.com>,
linux-i2c@...r.kernel.org,
linux-kernel@...r.kernel.org,
linux-arm-kernel@...ts.infradead.org,
linux-mediatek@...ts.infradead.org,
linux-rockchip@...ts.infradead.org
Cc: Khalil Blaiech <kblaiech@...dia.com>,
Asmaa Mnebhi <asmaa@...dia.com>,
Andi Shyti <andi.shyti@...nel.org>,
Qii Wang <qii.wang@...iatek.com>,
Matthias Brugger <matthias.bgg@...il.com>,
AngeloGioacchino Del Regno <angelogioacchino.delregno@...labora.com>,
Linus Walleij <linusw@...nel.org>,
Heiko Stuebner <heiko@...ech.de>,
Patrice Chotard <patrice.chotard@...s.st.com>,
Ard Biesheuvel <ardb@...nel.org>
Subject: [PATCH v1 5/7] i2c: rk3x: Use HZ_PER_GHZ constant instead of plain number
Use defined constant to avoid the possible mistakes and to provide
an additional information on the units.
Signed-off-by: Andy Shevchenko <andriy.shevchenko@...ux.intel.com>
---
drivers/i2c/busses/i2c-rk3x.c | 12 ++++++------
1 file changed, 6 insertions(+), 6 deletions(-)
diff --git a/drivers/i2c/busses/i2c-rk3x.c b/drivers/i2c/busses/i2c-rk3x.c
index d4e9196445c0..fcede9f6ed54 100644
--- a/drivers/i2c/busses/i2c-rk3x.c
+++ b/drivers/i2c/busses/i2c-rk3x.c
@@ -19,6 +19,7 @@
#include <linux/of_irq.h>
#include <linux/spinlock.h>
#include <linux/clk.h>
+#include <linux/units.h>
#include <linux/wait.h>
#include <linux/mfd/syscon.h>
#include <linux/regmap.h>
@@ -896,13 +897,12 @@ static void rk3x_i2c_adapt_div(struct rk3x_i2c *i2c, unsigned long clk_rate)
clk_disable(i2c->pclk);
- t_low_ns = div_u64(((u64)calc.div_low + 1) * 8 * 1000000000, clk_rate);
- t_high_ns = div_u64(((u64)calc.div_high + 1) * 8 * 1000000000,
- clk_rate);
+ t_low_ns = div_u64(8ULL * HZ_PER_GHZ * (calc.div_low + 1), clk_rate);
+ t_high_ns = div_u64(8ULL * HZ_PER_GHZ * (calc.div_high + 1), clk_rate);
dev_dbg(i2c->dev,
- "CLK %lukhz, Req %uns, Act low %lluns high %lluns\n",
- clk_rate / 1000,
- 1000000000 / t->bus_freq_hz,
+ "CLK %lukHz, Req %luns, Act low %lluns high %lluns\n",
+ clk_rate / HZ_PER_KHZ,
+ HZ_PER_GHZ / t->bus_freq_hz,
t_low_ns, t_high_ns);
}
--
2.50.1
Powered by blists - more mailing lists