Skip to content

Commit

Permalink
watchdog: armada_37xx_wdt: use do_div for u64 division
Browse files Browse the repository at this point in the history
When the driver is built on 32 bit architectures during compile test,
the linker complains about "__udivdi3" being undefined. We have to use
do_div macro instead of the division operator when dividing u64 value.

Signed-off-by: Marek Behún <marek.behun@nic.cz>
Reviewed-by: Guenter Roeck <linux@roeck-us.net>
Signed-off-by: Guenter Roeck <linux@roeck-us.net>
Signed-off-by: Wim Van Sebroeck <wim@linux-watchdog.org>
  • Loading branch information
Marek Behún authored and Wim Van Sebroeck committed Oct 13, 2018
1 parent cd69606 commit c8ca6e7
Showing 1 changed file with 5 additions and 4 deletions.
9 changes: 5 additions & 4 deletions drivers/watchdog/armada_37xx_wdt.c
Original file line number Diff line number Diff line change
Expand Up @@ -156,10 +156,10 @@ static int armada_37xx_wdt_ping(struct watchdog_device *wdt)
static unsigned int armada_37xx_wdt_get_timeleft(struct watchdog_device *wdt)
{
struct armada_37xx_watchdog *dev = watchdog_get_drvdata(wdt);
unsigned int res;
u64 res;

res = get_counter_value(dev, CNTR_ID_WDOG) *
CNTR_CTRL_PRESCALE_MIN / dev->clk_rate;
res = get_counter_value(dev, CNTR_ID_WDOG) * CNTR_CTRL_PRESCALE_MIN;
do_div(res, dev->clk_rate);

return res;
}
Expand All @@ -176,7 +176,8 @@ static int armada_37xx_wdt_set_timeout(struct watchdog_device *wdt,
* prescaler, which divides the clock rate by 2
* (CNTR_CTRL_PRESCALE_MIN).
*/
dev->timeout = (u64)dev->clk_rate * timeout / CNTR_CTRL_PRESCALE_MIN;
dev->timeout = (u64)dev->clk_rate * timeout;
do_div(dev->timeout, CNTR_CTRL_PRESCALE_MIN);

return 0;
}
Expand Down

0 comments on commit c8ca6e7

Please sign in to comment.