@@ -169,13 +169,17 @@ static inline bool ktime_before(const ktime_t cmp1, const ktime_t cmp2)
extern s64 __ktime_divns(const ktime_t kt, s64 div);
static inline s64 ktime_divns(const ktime_t kt, s64 div)
{
+ s64 ns = kt.tv64;
+
/*
* Negative divisors could cause an inf loop,
* so bug out here.
*/
BUG_ON(div < 0);
- if (__builtin_constant_p(div) && !(div >> 32)) {
- s64 ns = kt.tv64;
+
+ if ((ns >> 32) == 0) {
+ return (s32)ns / div;
+ else if (__builtin_constant_p(div) && !(div >> 32)) {
u64 tmp = ns < 0 ? -ns : ns;
do_div(tmp, div);