diff options
author | Andy Shevchenko <andriy.shevchenko@linux.intel.com> | 2021-07-12 16:20:26 +0200 |
---|---|---|
committer | Wolfram Sang <wsa@kernel.org> | 2021-08-11 16:43:25 +0200 |
commit | c045214a0f31dd5d6be716ed2f119b57b6c5d3a2 (patch) | |
tree | 4b7a3b3c39b8a225633f66b3396eeefa9fbd06a5 /drivers/i2c/busses/i2c-designware-platdrv.c | |
parent | units: Add SI metric prefix definitions (diff) | |
download | linux-c045214a0f31dd5d6be716ed2f119b57b6c5d3a2.tar.xz linux-c045214a0f31dd5d6be716ed2f119b57b6c5d3a2.zip |
i2c: designware: Use DIV_ROUND_CLOSEST() macro
Instead of open-coding DIV_ROUND_CLOSEST() and similar use the macros directly.
While at it, replace numbers with predefined SI metric prefixes.
No functional change intended.
Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Signed-off-by: Wolfram Sang <wsa@kernel.org>
Diffstat (limited to 'drivers/i2c/busses/i2c-designware-platdrv.c')
-rw-r--r-- | drivers/i2c/busses/i2c-designware-platdrv.c | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/drivers/i2c/busses/i2c-designware-platdrv.c b/drivers/i2c/busses/i2c-designware-platdrv.c index 4b37f28ec0c6..21113665ddea 100644 --- a/drivers/i2c/busses/i2c-designware-platdrv.c +++ b/drivers/i2c/busses/i2c-designware-platdrv.c @@ -31,12 +31,13 @@ #include <linux/sched.h> #include <linux/slab.h> #include <linux/suspend.h> +#include <linux/units.h> #include "i2c-designware-core.h" static u32 i2c_dw_get_clk_rate_khz(struct dw_i2c_dev *dev) { - return clk_get_rate(dev->clk)/1000; + return clk_get_rate(dev->clk) / KILO; } #ifdef CONFIG_ACPI @@ -270,7 +271,7 @@ static int dw_i2c_plat_probe(struct platform_device *pdev) if (!dev->sda_hold_time && t->sda_hold_ns) dev->sda_hold_time = - div_u64(clk_khz * t->sda_hold_ns + 500000, 1000000); + DIV_S64_ROUND_CLOSEST(clk_khz * t->sda_hold_ns, MICRO); } adap = &dev->adapter; |