From: Andy Shevchenko Date: Mon, 12 Jan 2026 13:46:12 +0000 (+0100) Subject: i2c: nomadik: Use HZ_PER_GHZ constant instead of plain number X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=f83aa451460683c33824571269216e52154615da;p=thirdparty%2Flinux.git 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 Reviewed-by: Linus Walleij Reviewed-by: Wolfram Sang Reviewed-by: AngeloGioacchino Del Regno Signed-off-by: Andi Shyti Link: https://lore.kernel.org/r/20260112134900.4142954-5-andriy.shevchenko@linux.intel.com --- 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 #include #include +#include #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: