summaryrefslogtreecommitdiff
path: root/drivers/i2c
diff options
context:
space:
mode:
authorAndy Shevchenko <andriy.shevchenko@linux.intel.com>2026-01-12 14:46:12 +0100
committerAndi Shyti <andi.shyti@kernel.org>2026-01-13 18:34:29 +0100
commitf83aa451460683c33824571269216e52154615da (patch)
treeeab106a88c452d4ebd8362086e84fd76e5217dbc /drivers/i2c
parentec416d46910153b4faf41eef2be72778c18c7adb (diff)
i2c: nomadik: 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. While at it, drop unneeded 64-bit division, all operands fit 32-bit. Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com> Reviewed-by: Linus Walleij <linusw@kernel.org> Reviewed-by: Wolfram Sang <wsa+renesas@sang-engineering.com> Reviewed-by: AngeloGioacchino Del Regno <angelogioacchino.delregno@collabora.com> Signed-off-by: Andi Shyti <andi.shyti@kernel.org> Link: https://lore.kernel.org/r/20260112134900.4142954-5-andriy.shevchenko@linux.intel.com
Diffstat (limited to 'drivers/i2c')
-rw-r--r--drivers/i2c/busses/i2c-nomadik.c7
1 files changed, 4 insertions, 3 deletions
diff --git a/drivers/i2c/busses/i2c-nomadik.c b/drivers/i2c/busses/i2c-nomadik.c
index 19b648fc094d..b63ee51c1652 100644
--- a/drivers/i2c/busses/i2c-nomadik.c
+++ b/drivers/i2c/busses/i2c-nomadik.c
@@ -31,6 +31,7 @@
#include <linux/pm_runtime.h>
#include <linux/regmap.h>
#include <linux/slab.h>
+#include <linux/units.h>
#define DRIVER_NAME "nmk-i2c"
@@ -419,10 +420,10 @@ static void setup_i2c_controller(struct nmk_i2c_dev *priv)
* modes are 250ns, 100ns, 10ns respectively.
*
* As the time for one cycle T in nanoseconds is
- * T = (1/f) * 1000000000 =>
- * slsu = cycles / (1000000000 / f) + 1
+ * T = (1/f) * HZ_PER_GHZ =>
+ * slsu = cycles / (HZ_PER_GHZ / f) + 1
*/
- ns = DIV_ROUND_UP_ULL(1000000000ULL, i2c_clk);
+ ns = DIV_ROUND_UP(HZ_PER_GHZ, i2c_clk);
switch (priv->sm) {
case I2C_FREQ_MODE_FAST:
case I2C_FREQ_MODE_FAST_PLUS: