summaryrefslogtreecommitdiff
path: root/kernel/time
diff options
context:
space:
mode:
authorKevin Hilman <khilman@linaro.org>2015-06-11 14:37:45 -0700
committerKevin Hilman <khilman@linaro.org>2015-06-11 14:37:45 -0700
commitecdf94da6f91310d08081e05db78a6c997b44e4b (patch)
tree0528ddc7e2b34046b3bd98dedf89ca7fee40c1ae /kernel/time
parente28f23d8aaf3c3455edcdf646d910757051a07e3 (diff)
parentc65b99f046843d2455aa231747b5a07a999a9f3d (diff)
Merge tag 'v4.1-rc6' into next/dt
Linux 4.1-rc6 Conflicts: arch/arm/boot/dts/zynq-7000.dtsi Resolution summary: Mainline had an earlier version of the commit, resolve in favor of the newer patch in next/dt branch.
Diffstat (limited to 'kernel/time')
-rw-r--r--kernel/time/hrtimer.c14
1 files changed, 8 insertions, 6 deletions
diff --git a/kernel/time/hrtimer.c b/kernel/time/hrtimer.c
index 76d4bd962b19..93ef7190bdea 100644
--- a/kernel/time/hrtimer.c
+++ b/kernel/time/hrtimer.c
@@ -266,21 +266,23 @@ lock_hrtimer_base(const struct hrtimer *timer, unsigned long *flags)
/*
* Divide a ktime value by a nanosecond value
*/
-u64 __ktime_divns(const ktime_t kt, s64 div)
+s64 __ktime_divns(const ktime_t kt, s64 div)
{
- u64 dclc;
int sft = 0;
+ s64 dclc;
+ u64 tmp;
dclc = ktime_to_ns(kt);
+ tmp = dclc < 0 ? -dclc : dclc;
+
/* Make sure the divisor is less than 2^32: */
while (div >> 32) {
sft++;
div >>= 1;
}
- dclc >>= sft;
- do_div(dclc, (unsigned long) div);
-
- return dclc;
+ tmp >>= sft;
+ do_div(tmp, (unsigned long) div);
+ return dclc < 0 ? -tmp : tmp;
}
EXPORT_SYMBOL_GPL(__ktime_divns);
#endif /* BITS_PER_LONG >= 64 */