ipv4: don't remove /proc/net/rt_acct
[safe/jmp/linux-2.6] / include / linux / clocksource.h
index 19ad43a..8a4a130 100644 (file)
@@ -149,14 +149,12 @@ extern u64 timecounter_cyc2time(struct timecounter *tc,
  * @disable:           optional function to disable the clocksource
  * @mask:              bitmask for two's complement
  *                     subtraction of non 64 bit counters
- * @mult:              cycle to nanosecond multiplier (adjusted by NTP)
- * @mult_orig:         cycle to nanosecond multiplier (unadjusted by NTP)
+ * @mult:              cycle to nanosecond multiplier
  * @shift:             cycle to nanosecond divisor (power of two)
+ * @max_idle_ns:       max idle time permitted by the clocksource (nsecs)
  * @flags:             flags describing special properties
  * @vread:             vsyscall based read
  * @resume:            resume function for the clocksource, if necessary
- * @cycle_interval:    Used internally by timekeeping core, please ignore.
- * @xtime_interval:    Used internally by timekeeping core, please ignore.
  */
 struct clocksource {
        /*
@@ -170,8 +168,8 @@ struct clocksource {
        void (*disable)(struct clocksource *cs);
        cycle_t mask;
        u32 mult;
-       u32 mult_orig;
        u32 shift;
+       u64 max_idle_ns;
        unsigned long flags;
        cycle_t (*vread)(void);
        void (*resume)(void);
@@ -182,19 +180,12 @@ struct clocksource {
 #define CLKSRC_FSYS_MMIO_SET(mmio, addr)      do { } while (0)
 #endif
 
-       /* timekeeping specific data, ignore */
-       cycle_t cycle_interval;
-       u64     xtime_interval;
-       u32     raw_interval;
        /*
         * Second part is written at each timer interrupt
         * Keep it in a different cache line to dirty no
         * more than one cache line.
         */
        cycle_t cycle_last ____cacheline_aligned_in_smp;
-       u64 xtime_nsec;
-       s64 error;
-       struct timespec raw_time;
 
 #ifdef CONFIG_CLOCKSOURCE_WATCHDOG
        /* Watchdog related data, used by the framework */
@@ -203,8 +194,6 @@ struct clocksource {
 #endif
 };
 
-extern struct clocksource *clock;      /* current clocksource */
-
 /*
  * Clock source flags bits::
  */
@@ -270,50 +259,15 @@ static inline u32 clocksource_hz2mult(u32 hz, u32 shift_constant)
 }
 
 /**
- * cyc2ns - converts clocksource cycles to nanoseconds
- * @cs:                Pointer to clocksource
- * @cycles:    Cycles
+ * clocksource_cyc2ns - converts clocksource cycles to nanoseconds
  *
- * Uses the clocksource and ntp ajdustment to convert cycle_ts to nanoseconds.
+ * Converts cycles to nanoseconds, using the given mult and shift.
  *
  * XXX - This could use some mult_lxl_ll() asm optimization
  */
-static inline s64 cyc2ns(struct clocksource *cs, cycle_t cycles)
+static inline s64 clocksource_cyc2ns(cycle_t cycles, u32 mult, u32 shift)
 {
-       u64 ret = (u64)cycles;
-       ret = (ret * cs->mult) >> cs->shift;
-       return ret;
-}
-
-/**
- * clocksource_calculate_interval - Calculates a clocksource interval struct
- *
- * @c:         Pointer to clocksource.
- * @length_nsec: Desired interval length in nanoseconds.
- *
- * Calculates a fixed cycle/nsec interval for a given clocksource/adjustment
- * pair and interval request.
- *
- * Unless you're the timekeeping code, you should not be using this!
- */
-static inline void clocksource_calculate_interval(struct clocksource *c,
-                                                 unsigned long length_nsec)
-{
-       u64 tmp;
-
-       /* Do the ns -> cycle conversion first, using original mult */
-       tmp = length_nsec;
-       tmp <<= c->shift;
-       tmp += c->mult_orig/2;
-       do_div(tmp, c->mult_orig);
-
-       c->cycle_interval = (cycle_t)tmp;
-       if (c->cycle_interval == 0)
-               c->cycle_interval = 1;
-
-       /* Go back from cycles -> shifted ns, this time use ntp adjused mult */
-       c->xtime_interval = (u64)c->cycle_interval * c->mult;
-       c->raw_interval = ((u64)c->cycle_interval * c->mult_orig) >> c->shift;
+       return ((u64) cycles * mult) >> shift;
 }
 
 
@@ -325,12 +279,25 @@ extern struct clocksource* clocksource_get_next(void);
 extern void clocksource_change_rating(struct clocksource *cs, int rating);
 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);
+extern void
+update_vsyscall(struct timespec *ts, struct clocksource *c, u32 mult);
 extern void update_vsyscall_tz(void);
 #else
-static inline void update_vsyscall(struct timespec *ts, struct clocksource *c)
+static inline void
+update_vsyscall(struct timespec *ts, struct clocksource *c, u32 mult)
 {
 }
 
@@ -339,4 +306,6 @@ static inline void update_vsyscall_tz(void)
 }
 #endif
 
+extern void timekeeping_notify(struct clocksource *clock);
+
 #endif /* _LINUX_CLOCKSOURCE_H */