diff options
author | Maxime Ripard <maxime.ripard@free-electrons.com> | 2014-07-01 11:33:16 +0200 |
---|---|---|
committer | Nicolas Ferre <nicolas.ferre@atmel.com> | 2014-09-02 18:52:22 +0200 |
commit | 2d7fdbe23c990a843177e3bff9a093d2f5fa4e02 (patch) | |
tree | 73a2cd1803d3bc92dccdc0955ceb3eaa68bc8a05 /arch/arm | |
parent | ARM: at91: generic.h: Add include safe guards (diff) | |
download | linux-2d7fdbe23c990a843177e3bff9a093d2f5fa4e02.tar.xz linux-2d7fdbe23c990a843177e3bff9a093d2f5fa4e02.zip |
ARM: at91: PIT: Use DIV_ROUND_CLOSEST to compute the cycles
Until now, the pit_cycle computation was dividing the rate by HZ, rounding to
the closest integer, but without using the appropriate macro.
Signed-off-by: Maxime Ripard <maxime.ripard@free-electrons.com>
Acked-by: Boris BREZILLON <boris.brezillon@free-electrons.com>
Acked-by: Alexandre Belloni <alexandre.belloni@free-electrons.com>
Acked-by: Daniel Lezcano <daniel.lezcano@linaro.org>
Signed-off-by: Nicolas Ferre <nicolas.ferre@atmel.com>
Diffstat (limited to 'arch/arm')
-rw-r--r-- | arch/arm/mach-at91/at91sam926x_time.c | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/arch/arm/mach-at91/at91sam926x_time.c b/arch/arm/mach-at91/at91sam926x_time.c index fd3170b65fbb..2e6f1a37ab90 100644 --- a/arch/arm/mach-at91/at91sam926x_time.c +++ b/arch/arm/mach-at91/at91sam926x_time.c @@ -252,7 +252,7 @@ void __init at91sam926x_pit_init(void) if (IS_ERR(mck)) panic("AT91: PIT: Unable to get mck clk\n"); pit_rate = clk_get_rate(mck) / 16; - pit_cycle = (pit_rate + HZ/2) / HZ; + pit_cycle = DIV_ROUND_CLOSEST(pit_rate, HZ); WARN_ON(((pit_cycle - 1) & ~AT91_PIT_PIV) != 0); /* Initialize and enable the timer */ |