diff options
author | Marek BehĂșn <marek.behun@nic.cz> | 2018-10-10 11:17:27 -0400 |
---|---|---|
committer | Wim Van Sebroeck <wim@linux-watchdog.org> | 2018-10-13 09:19:43 -0400 |
commit | c8ca6e70fb74cd3bb6fc0738aed40991b9de0b87 (patch) | |
tree | 77023db2b5400ca07861c328b56c909bcdb0403a | |
parent | cd69606ad05e1d6a930e2d29ac277c00108ef908 (diff) |
watchdog: armada_37xx_wdt: use do_div for u64 division
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>
-rw-r--r-- | drivers/watchdog/armada_37xx_wdt.c | 9 |
1 files changed, 5 insertions, 4 deletions
diff --git a/drivers/watchdog/armada_37xx_wdt.c b/drivers/watchdog/armada_37xx_wdt.c index c43c313ba63d..4b4054f54df9 100644 --- a/drivers/watchdog/armada_37xx_wdt.c +++ b/drivers/watchdog/armada_37xx_wdt.c | |||
@@ -156,10 +156,10 @@ static int armada_37xx_wdt_ping(struct watchdog_device *wdt) | |||
156 | static unsigned int armada_37xx_wdt_get_timeleft(struct watchdog_device *wdt) | 156 | static unsigned int armada_37xx_wdt_get_timeleft(struct watchdog_device *wdt) |
157 | { | 157 | { |
158 | struct armada_37xx_watchdog *dev = watchdog_get_drvdata(wdt); | 158 | struct armada_37xx_watchdog *dev = watchdog_get_drvdata(wdt); |
159 | unsigned int res; | 159 | u64 res; |
160 | 160 | ||
161 | res = get_counter_value(dev, CNTR_ID_WDOG) * | 161 | res = get_counter_value(dev, CNTR_ID_WDOG) * CNTR_CTRL_PRESCALE_MIN; |
162 | CNTR_CTRL_PRESCALE_MIN / dev->clk_rate; | 162 | do_div(res, dev->clk_rate); |
163 | 163 | ||
164 | return res; | 164 | return res; |
165 | } | 165 | } |
@@ -176,7 +176,8 @@ static int armada_37xx_wdt_set_timeout(struct watchdog_device *wdt, | |||
176 | * prescaler, which divides the clock rate by 2 | 176 | * prescaler, which divides the clock rate by 2 |
177 | * (CNTR_CTRL_PRESCALE_MIN). | 177 | * (CNTR_CTRL_PRESCALE_MIN). |
178 | */ | 178 | */ |
179 | dev->timeout = (u64)dev->clk_rate * timeout / CNTR_CTRL_PRESCALE_MIN; | 179 | dev->timeout = (u64)dev->clk_rate * timeout; |
180 | do_div(dev->timeout, CNTR_CTRL_PRESCALE_MIN); | ||
180 | 181 | ||
181 | return 0; | 182 | return 0; |
182 | } | 183 | } |