[PATCH] clocksource: replace is_continuous by a flag field
authorThomas Gleixner <tglx@linutronix.de>
Fri, 16 Feb 2007 09:27:36 +0000 (01:27 -0800)
committerLinus Torvalds <torvalds@woody.linux-foundation.org>
Fri, 16 Feb 2007 16:13:57 +0000 (08:13 -0800)
Using a flag filed allows to encode more than one information into a variable.
Preparatory patch for the generic clocksource verification.

[mingo@elte.hu: convert vmitime.c to the new clocksource flag]
Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
Signed-off-by: Ingo Molnar <mingo@elte.hu>
Cc: john stultz <johnstul@us.ibm.com>
Cc: Roman Zippel <zippel@linux-m68k.org>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
arch/i386/kernel/hpet.c
arch/i386/kernel/tsc.c
arch/i386/kernel/vmitime.c
drivers/clocksource/acpi_pm.c
drivers/clocksource/cyclone.c
drivers/clocksource/scx200_hrt.c
include/linux/clocksource.h
kernel/time/jiffies.c
kernel/timer.c

index 0b29d41322a2620c50a0bdc98fa1ec314d397ac9..7d2739fff3a34ad5b6ddaeae42d91060bb49179d 100644 (file)
@@ -26,7 +26,7 @@ static struct clocksource clocksource_hpet = {
        .mask           = HPET_MASK,
        .mult           = 0, /* set below */
        .shift          = HPET_SHIFT,
-       .is_continuous  = 1,
+       .flags          = CLOCK_SOURCE_IS_CONTINUOUS,
 };
 
 static int __init init_hpet_clocksource(void)
index 0fd93107ff9a6d3fa75d9ab1438faff039cef537..a37654991788e12cd8e1872a7c3fc508093d105e 100644 (file)
@@ -314,7 +314,8 @@ static struct clocksource clocksource_tsc = {
        .mult                   = 0, /* to be set */
        .shift                  = 22,
        .update_callback        = tsc_update_callback,
-       .is_continuous          = 1,
+       .flags                  = CLOCK_SOURCE_IS_CONTINUOUS |
+                                 CLOCK_SOURCE_MUST_VERIFY,
 };
 
 static int tsc_update_callback(void)
@@ -434,8 +435,10 @@ static int __init init_tsc_clocksource(void)
                clocksource_tsc.mult = clocksource_khz2mult(current_tsc_khz,
                                                        clocksource_tsc.shift);
                /* lower the rating if we already know its unstable: */
-               if (check_tsc_unstable())
+               if (check_tsc_unstable()) {
                        clocksource_tsc.rating = 0;
+                       clocksource_tsc.flags &= ~CLOCK_SOURCE_IS_CONTINUOUS;
+               }
 
                init_timer(&verify_tsc_freq_timer);
                verify_tsc_freq_timer.function = verify_tsc_freq;
index 2e2d8dbcbd68bee1d6bf4cf6052cea2c02fedc12..76d2adcae5a30b74ed5505544cf5c0b45d89e427 100644 (file)
@@ -115,7 +115,7 @@ static struct clocksource clocksource_vmi = {
        .mask                   = CLOCKSOURCE_MASK(64),
        .mult                   = 0, /* to be set */
        .shift                  = 22,
-       .is_continuous          = 1,
+       .flags                  = CLOCK_SOURCE_IS_CONTINUOUS,
 };
 
 
index b6bcdbbf57b3fe5ab0810fc6221fcab1d9b744ed..c7276a61695b1ec0f20905124a675a667f586882 100644 (file)
@@ -72,7 +72,8 @@ static struct clocksource clocksource_acpi_pm = {
        .mask           = (cycle_t)ACPI_PM_MASK,
        .mult           = 0, /*to be caluclated*/
        .shift          = 22,
-       .is_continuous  = 1,
+       .flags          = CLOCK_SOURCE_IS_CONTINUOUS,
+
 };
 
 
index bf4d3d50d1c4e9a7c76c05f9b8476ebf3896f8c2..4f3925ceb36041a8cdbdaab80b0c330eebb28a61 100644 (file)
@@ -31,7 +31,7 @@ static struct clocksource clocksource_cyclone = {
        .mask           = CYCLONE_TIMER_MASK,
        .mult           = 10,
        .shift          = 0,
-       .is_continuous  = 1,
+       .flags          = CLOCK_SOURCE_IS_CONTINUOUS,
 };
 
 static int __init init_cyclone_clocksource(void)
index 22915cc46ba7fbe56ef7e52896ce74c9490b8e7a..b92da677aa5d8e23673e192a8c5bcdf67ae46de0 100644 (file)
@@ -57,7 +57,7 @@ static struct clocksource cs_hrt = {
        .rating         = 250,
        .read           = read_hrt,
        .mask           = CLOCKSOURCE_MASK(32),
-       .is_continuous  = 1,
+       .flags          = CLOCK_SOURCE_IS_CONTINUOUS,
        /* mult, shift are set based on mhz27 flag */
 };
 
index 55d7140523746834055c886b6425ebc9d997db6e..45b0c310ae82ab8e8275509daae1e06ce4391b66 100644 (file)
@@ -45,7 +45,7 @@ typedef u64 cycle_t;
  * @mult:              cycle to nanosecond multiplier
  * @shift:             cycle to nanosecond divisor (power of two)
  * @update_callback:   called when safe to alter clocksource values
- * @is_continuous:     defines if clocksource is free-running.
+ * @flags:             flags describing special properties
  * @cycle_interval:    Used internally by timekeeping core, please ignore.
  * @xtime_interval:    Used internally by timekeeping core, please ignore.
  */
@@ -58,7 +58,7 @@ struct clocksource {
        u32 mult;
        u32 shift;
        int (*update_callback)(void);
-       int is_continuous;
+       unsigned long flags;
 
        /* timekeeping specific data, ignore */
        cycle_t cycle_last, cycle_interval;
@@ -66,6 +66,12 @@ struct clocksource {
        s64 error;
 };
 
+/*
+ * Clock source flags bits::
+ */
+#define CLOCK_SOURCE_IS_CONTINUOUS     0x01
+#define CLOCK_SOURCE_MUST_VERIFY       0x02
+
 /* simplify initialization of mask field */
 #define CLOCKSOURCE_MASK(bits) (cycle_t)(bits<64 ? ((1ULL<<bits)-1) : -1)
 
index a99b2a6e6a07354781da79b6067b1944d438d5f9..3be8da8fed7efa1a972fca3c0c249dc7f1a983fa 100644 (file)
@@ -62,7 +62,6 @@ struct clocksource clocksource_jiffies = {
        .mask           = 0xffffffff, /*32bits*/
        .mult           = NSEC_PER_JIFFY << JIFFIES_SHIFT, /* details above */
        .shift          = JIFFIES_SHIFT,
-       .is_continuous  = 0, /* tick based, not free running */
 };
 
 static int __init init_jiffies_clocksource(void)
index 8f4bf1e6a3ed7fd66e9ba16ece4fef730a97d058..1144ff2c2ea3c61efcf3a40993d35b7c7c7d745a 100644 (file)
@@ -871,7 +871,7 @@ int timekeeping_is_continuous(void)
        do {
                seq = read_seqbegin(&xtime_lock);
 
-               ret = clock->is_continuous;
+               ret = clock->flags & CLOCK_SOURCE_IS_CONTINUOUS;
 
        } while (read_seqretry(&xtime_lock, seq));