diff options
author | Thomas Gleixner <tglx@linutronix.de> | 2009-11-11 09:05:34 -0500 |
---|---|---|
committer | Thomas Gleixner <tglx@linutronix.de> | 2009-11-13 14:46:24 -0500 |
commit | e3a4fab0c0c30e21e104712f4e9cb39f175d0f21 (patch) | |
tree | 3e785ac76f07c043f9eaecc59427cda61bc54b67 /arch/mips/kernel/time.c | |
parent | 7d2f944a2b836c69a9d260a0a5f0d1720d57fdff (diff) |
mips: Use generic mult/shift factor calculation for clocks
Replace the MIPS functions of mult/shift factor calculation for clock
events and clock sources with inline functions which call the generic
functions. The minimum guaranteed conversion range is set to 4 seconds
which corresponds to the current MIPS implementation.
Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
Cc: Mikael Pettersson <mikpe@it.uu.se>
Acked-by: Ralf Baechle <ralf@linux-mips.org>
Acked-by: Linus Walleij <linus.walleij@stericsson.com>
Cc: John Stultz <johnstul@us.ibm.com>
LKML-Reference: <20091111134229.807255074@linutronix.de>
Diffstat (limited to 'arch/mips/kernel/time.c')
-rw-r--r-- | arch/mips/kernel/time.c | 33 |
1 files changed, 0 insertions, 33 deletions
diff --git a/arch/mips/kernel/time.c b/arch/mips/kernel/time.c index 1f467d534642..fb7497405510 100644 --- a/arch/mips/kernel/time.c +++ b/arch/mips/kernel/time.c | |||
@@ -71,39 +71,6 @@ EXPORT_SYMBOL(perf_irq); | |||
71 | 71 | ||
72 | unsigned int mips_hpt_frequency; | 72 | unsigned int mips_hpt_frequency; |
73 | 73 | ||
74 | void __init clocksource_set_clock(struct clocksource *cs, unsigned int clock) | ||
75 | { | ||
76 | u64 temp; | ||
77 | u32 shift; | ||
78 | |||
79 | /* Find a shift value */ | ||
80 | for (shift = 32; shift > 0; shift--) { | ||
81 | temp = (u64) NSEC_PER_SEC << shift; | ||
82 | do_div(temp, clock); | ||
83 | if ((temp >> 32) == 0) | ||
84 | break; | ||
85 | } | ||
86 | cs->shift = shift; | ||
87 | cs->mult = (u32) temp; | ||
88 | } | ||
89 | |||
90 | void __cpuinit clockevent_set_clock(struct clock_event_device *cd, | ||
91 | unsigned int clock) | ||
92 | { | ||
93 | u64 temp; | ||
94 | u32 shift; | ||
95 | |||
96 | /* Find a shift value */ | ||
97 | for (shift = 32; shift > 0; shift--) { | ||
98 | temp = (u64) clock << shift; | ||
99 | do_div(temp, NSEC_PER_SEC); | ||
100 | if ((temp >> 32) == 0) | ||
101 | break; | ||
102 | } | ||
103 | cd->shift = shift; | ||
104 | cd->mult = (u32) temp; | ||
105 | } | ||
106 | |||
107 | /* | 74 | /* |
108 | * This function exists in order to cause an error due to a duplicate | 75 | * This function exists in order to cause an error due to a duplicate |
109 | * definition if platform code should have its own implementation. The hook | 76 | * definition if platform code should have its own implementation. The hook |