aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorThomas Gleixner <tglx@linutronix.de>2007-02-16 04:27:36 -0500
committerLinus Torvalds <torvalds@woody.linux-foundation.org>2007-02-16 11:13:57 -0500
commit73b08d2aa4245806ef1bdd48463e9a0b045c62cf (patch)
tree1cd5b3a7b9f889bb6ff1e7fc6c9a95751faad4d7
parent95492e4646e5de8b43d9a7908d6177fb737b61f0 (diff)
[PATCH] clocksource: replace is_continuous by a flag field
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>
-rw-r--r--arch/i386/kernel/hpet.c2
-rw-r--r--arch/i386/kernel/tsc.c7
-rw-r--r--arch/i386/kernel/vmitime.c2
-rw-r--r--drivers/clocksource/acpi_pm.c3
-rw-r--r--drivers/clocksource/cyclone.c2
-rw-r--r--drivers/clocksource/scx200_hrt.c2
-rw-r--r--include/linux/clocksource.h10
-rw-r--r--kernel/time/jiffies.c1
-rw-r--r--kernel/timer.c2
9 files changed, 20 insertions, 11 deletions
diff --git a/arch/i386/kernel/hpet.c b/arch/i386/kernel/hpet.c
index 0b29d41322a2..7d2739fff3a3 100644
--- a/arch/i386/kernel/hpet.c
+++ b/arch/i386/kernel/hpet.c
@@ -26,7 +26,7 @@ static struct clocksource clocksource_hpet = {
26 .mask = HPET_MASK, 26 .mask = HPET_MASK,
27 .mult = 0, /* set below */ 27 .mult = 0, /* set below */
28 .shift = HPET_SHIFT, 28 .shift = HPET_SHIFT,
29 .is_continuous = 1, 29 .flags = CLOCK_SOURCE_IS_CONTINUOUS,
30}; 30};
31 31
32static int __init init_hpet_clocksource(void) 32static int __init init_hpet_clocksource(void)
diff --git a/arch/i386/kernel/tsc.c b/arch/i386/kernel/tsc.c
index 0fd93107ff9a..a37654991788 100644
--- a/arch/i386/kernel/tsc.c
+++ b/arch/i386/kernel/tsc.c
@@ -314,7 +314,8 @@ static struct clocksource clocksource_tsc = {
314 .mult = 0, /* to be set */ 314 .mult = 0, /* to be set */
315 .shift = 22, 315 .shift = 22,
316 .update_callback = tsc_update_callback, 316 .update_callback = tsc_update_callback,
317 .is_continuous = 1, 317 .flags = CLOCK_SOURCE_IS_CONTINUOUS |
318 CLOCK_SOURCE_MUST_VERIFY,
318}; 319};
319 320
320static int tsc_update_callback(void) 321static int tsc_update_callback(void)
@@ -434,8 +435,10 @@ static int __init init_tsc_clocksource(void)
434 clocksource_tsc.mult = clocksource_khz2mult(current_tsc_khz, 435 clocksource_tsc.mult = clocksource_khz2mult(current_tsc_khz,
435 clocksource_tsc.shift); 436 clocksource_tsc.shift);
436 /* lower the rating if we already know its unstable: */ 437 /* lower the rating if we already know its unstable: */
437 if (check_tsc_unstable()) 438 if (check_tsc_unstable()) {
438 clocksource_tsc.rating = 0; 439 clocksource_tsc.rating = 0;
440 clocksource_tsc.flags &= ~CLOCK_SOURCE_IS_CONTINUOUS;
441 }
439 442
440 init_timer(&verify_tsc_freq_timer); 443 init_timer(&verify_tsc_freq_timer);
441 verify_tsc_freq_timer.function = verify_tsc_freq; 444 verify_tsc_freq_timer.function = verify_tsc_freq;
diff --git a/arch/i386/kernel/vmitime.c b/arch/i386/kernel/vmitime.c
index 2e2d8dbcbd68..76d2adcae5a3 100644
--- a/arch/i386/kernel/vmitime.c
+++ b/arch/i386/kernel/vmitime.c
@@ -115,7 +115,7 @@ static struct clocksource clocksource_vmi = {
115 .mask = CLOCKSOURCE_MASK(64), 115 .mask = CLOCKSOURCE_MASK(64),
116 .mult = 0, /* to be set */ 116 .mult = 0, /* to be set */
117 .shift = 22, 117 .shift = 22,
118 .is_continuous = 1, 118 .flags = CLOCK_SOURCE_IS_CONTINUOUS,
119}; 119};
120 120
121 121
diff --git a/drivers/clocksource/acpi_pm.c b/drivers/clocksource/acpi_pm.c
index b6bcdbbf57b3..c7276a61695b 100644
--- a/drivers/clocksource/acpi_pm.c
+++ b/drivers/clocksource/acpi_pm.c
@@ -72,7 +72,8 @@ static struct clocksource clocksource_acpi_pm = {
72 .mask = (cycle_t)ACPI_PM_MASK, 72 .mask = (cycle_t)ACPI_PM_MASK,
73 .mult = 0, /*to be caluclated*/ 73 .mult = 0, /*to be caluclated*/
74 .shift = 22, 74 .shift = 22,
75 .is_continuous = 1, 75 .flags = CLOCK_SOURCE_IS_CONTINUOUS,
76
76}; 77};
77 78
78 79
diff --git a/drivers/clocksource/cyclone.c b/drivers/clocksource/cyclone.c
index bf4d3d50d1c4..4f3925ceb360 100644
--- a/drivers/clocksource/cyclone.c
+++ b/drivers/clocksource/cyclone.c
@@ -31,7 +31,7 @@ static struct clocksource clocksource_cyclone = {
31 .mask = CYCLONE_TIMER_MASK, 31 .mask = CYCLONE_TIMER_MASK,
32 .mult = 10, 32 .mult = 10,
33 .shift = 0, 33 .shift = 0,
34 .is_continuous = 1, 34 .flags = CLOCK_SOURCE_IS_CONTINUOUS,
35}; 35};
36 36
37static int __init init_cyclone_clocksource(void) 37static int __init init_cyclone_clocksource(void)
diff --git a/drivers/clocksource/scx200_hrt.c b/drivers/clocksource/scx200_hrt.c
index 22915cc46ba7..b92da677aa5d 100644
--- a/drivers/clocksource/scx200_hrt.c
+++ b/drivers/clocksource/scx200_hrt.c
@@ -57,7 +57,7 @@ static struct clocksource cs_hrt = {
57 .rating = 250, 57 .rating = 250,
58 .read = read_hrt, 58 .read = read_hrt,
59 .mask = CLOCKSOURCE_MASK(32), 59 .mask = CLOCKSOURCE_MASK(32),
60 .is_continuous = 1, 60 .flags = CLOCK_SOURCE_IS_CONTINUOUS,
61 /* mult, shift are set based on mhz27 flag */ 61 /* mult, shift are set based on mhz27 flag */
62}; 62};
63 63
diff --git a/include/linux/clocksource.h b/include/linux/clocksource.h
index 55d714052374..45b0c310ae82 100644
--- a/include/linux/clocksource.h
+++ b/include/linux/clocksource.h
@@ -45,7 +45,7 @@ typedef u64 cycle_t;
45 * @mult: cycle to nanosecond multiplier 45 * @mult: cycle to nanosecond multiplier
46 * @shift: cycle to nanosecond divisor (power of two) 46 * @shift: cycle to nanosecond divisor (power of two)
47 * @update_callback: called when safe to alter clocksource values 47 * @update_callback: called when safe to alter clocksource values
48 * @is_continuous: defines if clocksource is free-running. 48 * @flags: flags describing special properties
49 * @cycle_interval: Used internally by timekeeping core, please ignore. 49 * @cycle_interval: Used internally by timekeeping core, please ignore.
50 * @xtime_interval: Used internally by timekeeping core, please ignore. 50 * @xtime_interval: Used internally by timekeeping core, please ignore.
51 */ 51 */
@@ -58,7 +58,7 @@ struct clocksource {
58 u32 mult; 58 u32 mult;
59 u32 shift; 59 u32 shift;
60 int (*update_callback)(void); 60 int (*update_callback)(void);
61 int is_continuous; 61 unsigned long flags;
62 62
63 /* timekeeping specific data, ignore */ 63 /* timekeeping specific data, ignore */
64 cycle_t cycle_last, cycle_interval; 64 cycle_t cycle_last, cycle_interval;
@@ -66,6 +66,12 @@ struct clocksource {
66 s64 error; 66 s64 error;
67}; 67};
68 68
69/*
70 * Clock source flags bits::
71 */
72#define CLOCK_SOURCE_IS_CONTINUOUS 0x01
73#define CLOCK_SOURCE_MUST_VERIFY 0x02
74
69/* simplify initialization of mask field */ 75/* simplify initialization of mask field */
70#define CLOCKSOURCE_MASK(bits) (cycle_t)(bits<64 ? ((1ULL<<bits)-1) : -1) 76#define CLOCKSOURCE_MASK(bits) (cycle_t)(bits<64 ? ((1ULL<<bits)-1) : -1)
71 77
diff --git a/kernel/time/jiffies.c b/kernel/time/jiffies.c
index a99b2a6e6a07..3be8da8fed7e 100644
--- a/kernel/time/jiffies.c
+++ b/kernel/time/jiffies.c
@@ -62,7 +62,6 @@ struct clocksource clocksource_jiffies = {
62 .mask = 0xffffffff, /*32bits*/ 62 .mask = 0xffffffff, /*32bits*/
63 .mult = NSEC_PER_JIFFY << JIFFIES_SHIFT, /* details above */ 63 .mult = NSEC_PER_JIFFY << JIFFIES_SHIFT, /* details above */
64 .shift = JIFFIES_SHIFT, 64 .shift = JIFFIES_SHIFT,
65 .is_continuous = 0, /* tick based, not free running */
66}; 65};
67 66
68static int __init init_jiffies_clocksource(void) 67static int __init init_jiffies_clocksource(void)
diff --git a/kernel/timer.c b/kernel/timer.c
index 8f4bf1e6a3ed..1144ff2c2ea3 100644
--- a/kernel/timer.c
+++ b/kernel/timer.c
@@ -871,7 +871,7 @@ int timekeeping_is_continuous(void)
871 do { 871 do {
872 seq = read_seqbegin(&xtime_lock); 872 seq = read_seqbegin(&xtime_lock);
873 873
874 ret = clock->is_continuous; 874 ret = clock->flags & CLOCK_SOURCE_IS_CONTINUOUS;
875 875
876 } while (read_seqretry(&xtime_lock, seq)); 876 } while (read_seqretry(&xtime_lock, seq));
877 877