Skip to content

Commit

Permalink
s390/cputime: fix 31-bit compile
Browse files Browse the repository at this point in the history
git commit 8461b63
"s390: translate cputime magic constants to macros"
introduce a built error for 31-bit:

  kernel/built-in.o: In function `posix_cpu_timer_set':
  posix-cpu-timers.c:(.text+0x2a8cc): undefined reference to `__udivdi3'

The original code is actually broken for 31-bit and has been
corrected by the above commit by forcing the compiler to use
64-bit arithmetic through the CPUTIME_PER_USEC define.

To fix the compile error replace the 64-bit division with
a call to __div().

Signed-off-by: Martin Schwidefsky <schwidefsky@de.ibm.com>
  • Loading branch information
Martin Schwidefsky committed Dec 8, 2014
1 parent 8622384 commit 3519978
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion arch/s390/include/asm/cputime.h
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,7 @@ static inline cputime_t secs_to_cputime(const unsigned int s)
static inline cputime_t timespec_to_cputime(const struct timespec *value)
{
unsigned long long ret = value->tv_sec * CPUTIME_PER_SEC;
return (__force cputime_t)(ret + (value->tv_nsec * CPUTIME_PER_USEC) / NSEC_PER_USEC);
return (__force cputime_t)(ret + __div(value->tv_nsec * CPUTIME_PER_USEC, NSEC_PER_USEC));
}

static inline void cputime_to_timespec(const cputime_t cputime,
Expand Down

0 comments on commit 3519978

Please sign in to comment.