aboutsummaryrefslogtreecommitdiffstats
path: root/arch/powerpc/kernel/time.c
diff options
context:
space:
mode:
Diffstat (limited to 'arch/powerpc/kernel/time.c')
-rw-r--r--arch/powerpc/kernel/time.c11
1 files changed, 10 insertions, 1 deletions
diff --git a/arch/powerpc/kernel/time.c b/arch/powerpc/kernel/time.c
index 9ba2cc88591d..6c6093d67f30 100644
--- a/arch/powerpc/kernel/time.c
+++ b/arch/powerpc/kernel/time.c
@@ -903,12 +903,21 @@ static void decrementer_set_mode(enum clock_event_mode mode,
903 decrementer_set_next_event(DECREMENTER_MAX, dev); 903 decrementer_set_next_event(DECREMENTER_MAX, dev);
904} 904}
905 905
906static inline uint64_t div_sc64(unsigned long ticks, unsigned long nsec,
907 int shift)
908{
909 uint64_t tmp = ((uint64_t)ticks) << shift;
910
911 do_div(tmp, nsec);
912 return tmp;
913}
914
906static void __init setup_clockevent_multiplier(unsigned long hz) 915static void __init setup_clockevent_multiplier(unsigned long hz)
907{ 916{
908 u64 mult, shift = 32; 917 u64 mult, shift = 32;
909 918
910 while (1) { 919 while (1) {
911 mult = div_sc(hz, NSEC_PER_SEC, shift); 920 mult = div_sc64(hz, NSEC_PER_SEC, shift);
912 if (mult && (mult >> 32UL) == 0UL) 921 if (mult && (mult >> 32UL) == 0UL)
913 break; 922 break;
914 923