mirror of
https://github.com/adulau/aha.git
synced 2024-12-28 03:36:19 +00:00
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>
This commit is contained in:
parent
7d2f944a2b
commit
e3a4fab0c0
2 changed files with 11 additions and 36 deletions
|
@ -84,8 +84,16 @@ static inline int init_mips_clocksource(void)
|
|||
#endif
|
||||
}
|
||||
|
||||
extern void clocksource_set_clock(struct clocksource *cs, unsigned int clock);
|
||||
extern void clockevent_set_clock(struct clock_event_device *cd,
|
||||
unsigned int clock);
|
||||
static inline void clocksource_set_clock(struct clocksource *cs,
|
||||
unsigned int clock)
|
||||
{
|
||||
clocksource_calc_mult_shift(cs, clock, 4);
|
||||
}
|
||||
|
||||
static inline void clockevent_set_clock(struct clock_event_device *cd,
|
||||
unsigned int clock)
|
||||
{
|
||||
clockevents_calc_mult_shift(cd, clock, 4);
|
||||
}
|
||||
|
||||
#endif /* _ASM_TIME_H */
|
||||
|
|
|
@ -71,39 +71,6 @@ EXPORT_SYMBOL(perf_irq);
|
|||
|
||||
unsigned int mips_hpt_frequency;
|
||||
|
||||
void __init clocksource_set_clock(struct clocksource *cs, unsigned int clock)
|
||||
{
|
||||
u64 temp;
|
||||
u32 shift;
|
||||
|
||||
/* Find a shift value */
|
||||
for (shift = 32; shift > 0; shift--) {
|
||||
temp = (u64) NSEC_PER_SEC << shift;
|
||||
do_div(temp, clock);
|
||||
if ((temp >> 32) == 0)
|
||||
break;
|
||||
}
|
||||
cs->shift = shift;
|
||||
cs->mult = (u32) temp;
|
||||
}
|
||||
|
||||
void __cpuinit clockevent_set_clock(struct clock_event_device *cd,
|
||||
unsigned int clock)
|
||||
{
|
||||
u64 temp;
|
||||
u32 shift;
|
||||
|
||||
/* Find a shift value */
|
||||
for (shift = 32; shift > 0; shift--) {
|
||||
temp = (u64) clock << shift;
|
||||
do_div(temp, NSEC_PER_SEC);
|
||||
if ((temp >> 32) == 0)
|
||||
break;
|
||||
}
|
||||
cd->shift = shift;
|
||||
cd->mult = (u32) temp;
|
||||
}
|
||||
|
||||
/*
|
||||
* This function exists in order to cause an error due to a duplicate
|
||||
* definition if platform code should have its own implementation. The hook
|
||||
|
|
Loading…
Reference in a new issue