Revert "clocksource: Provide a generic mult/shift factor calculation"
author黄涛 <huangtao@rock-chips.com>
Sat, 30 Jul 2011 07:56:49 +0000 (15:56 +0800)
committer黄涛 <huangtao@rock-chips.com>
Sat, 30 Jul 2011 07:56:49 +0000 (15:56 +0800)
This reverts commit cfc80b68293040b1f06c1fb388d3bd448721aa7b.

include/linux/clockchips.h
include/linux/clocksource.h
kernel/time/clocksource.c

index b7905462043cf3a7d8da526db4aa8f8f533492e9..3a1dbba4d3ae2da500e710387d130cd8ad5dd4c2 100644 (file)
@@ -130,13 +130,6 @@ extern int clockevents_program_event(struct clock_event_device *dev,
 
 extern void clockevents_handle_noop(struct clock_event_device *dev);
 
-static inline void
-clockevents_calc_mult_shift(struct clock_event_device *ce, u32 freq, u32 minsec)
-{
-       return clocks_calc_mult_shift(&ce->mult, &ce->shift, NSEC_PER_SEC,
-                                     freq, minsec);
-}
-
 #ifdef CONFIG_GENERIC_CLOCKEVENTS
 extern void clockevents_notify(unsigned long reason, void *arg);
 #else
index 8a4a130cc19698ab8a03c6c6344e3b24f42932f8..f73bc1b68c107d9d68531de46ad916d18de070c3 100644 (file)
@@ -281,16 +281,6 @@ extern void clocksource_resume(void);
 extern struct clocksource * __init __weak clocksource_default_clock(void);
 extern void clocksource_mark_unstable(struct clocksource *cs);
 
-extern void
-clocks_calc_mult_shift(u32 *mult, u32 *shift, u32 from, u32 to, u32 minsec);
-
-static inline void
-clocksource_calc_mult_shift(struct clocksource *cs, u32 freq, u32 minsec)
-{
-       return clocks_calc_mult_shift(&cs->mult, &cs->shift, freq,
-                                     NSEC_PER_SEC, minsec);
-}
-
 #ifdef CONFIG_GENERIC_TIME_VSYSCALL
 extern void
 update_vsyscall(struct timespec *ts, struct clocksource *c, u32 mult);
index 6d7c7fe5396a147a2b49109f96957d6c7fb578a4..bf4fe98bcba8b4f16c9f4db35a9fb471c7c18660 100644 (file)
@@ -107,59 +107,6 @@ u64 timecounter_cyc2time(struct timecounter *tc,
 }
 EXPORT_SYMBOL(timecounter_cyc2time);
 
-/**
- * clocks_calc_mult_shift - calculate mult/shift factors for scaled math of clocks
- * @mult:      pointer to mult variable
- * @shift:     pointer to shift variable
- * @from:      frequency to convert from
- * @to:                frequency to convert to
- * @minsec:    guaranteed runtime conversion range in seconds
- *
- * The function evaluates the shift/mult pair for the scaled math
- * operations of clocksources and clockevents.
- *
- * @to and @from are frequency values in HZ. For clock sources @to is
- * NSEC_PER_SEC == 1GHz and @from is the counter frequency. For clock
- * event @to is the counter frequency and @from is NSEC_PER_SEC.
- *
- * The @minsec conversion range argument controls the time frame in
- * seconds which must be covered by the runtime conversion with the
- * calculated mult and shift factors. This guarantees that no 64bit
- * overflow happens when the input value of the conversion is
- * multiplied with the calculated mult factor. Larger ranges may
- * reduce the conversion accuracy by chosing smaller mult and shift
- * factors.
- */
-void
-clocks_calc_mult_shift(u32 *mult, u32 *shift, u32 from, u32 to, u32 minsec)
-{
-       u64 tmp;
-       u32 sft, sftacc= 32;
-
-       /*
-        * Calculate the shift factor which is limiting the conversion
-        * range:
-        */
-       tmp = ((u64)minsec * from) >> 32;
-       while (tmp) {
-               tmp >>=1;
-               sftacc--;
-       }
-
-       /*
-        * Find the conversion shift/mult pair which has the best
-        * accuracy and fits the maxsec conversion range:
-        */
-       for (sft = 32; sft > 0; sft--) {
-               tmp = (u64) to << sft;
-               do_div(tmp, from);
-               if ((tmp >> sftacc) == 0)
-                       break;
-       }
-       *mult = tmp;
-       *shift = sft;
-}
-
 /*[Clocksource internal variables]---------
  * curr_clocksource:
  *     currently selected clocksource.