Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

[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>

authored by

Thomas Gleixner and committed by
Linus Torvalds
73b08d2a 95492e46

+20 -11
+1 -1
arch/i386/kernel/hpet.c
··· 26 26 .mask = HPET_MASK, 27 27 .mult = 0, /* set below */ 28 28 .shift = HPET_SHIFT, 29 - .is_continuous = 1, 29 + .flags = CLOCK_SOURCE_IS_CONTINUOUS, 30 30 }; 31 31 32 32 static int __init init_hpet_clocksource(void)
+5 -2
arch/i386/kernel/tsc.c
··· 314 314 .mult = 0, /* to be set */ 315 315 .shift = 22, 316 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 320 321 static int tsc_update_callback(void) ··· 435 434 clocksource_tsc.mult = clocksource_khz2mult(current_tsc_khz, 436 435 clocksource_tsc.shift); 437 436 /* lower the rating if we already know its unstable: */ 438 - if (check_tsc_unstable()) 437 + if (check_tsc_unstable()) { 439 438 clocksource_tsc.rating = 0; 439 + clocksource_tsc.flags &= ~CLOCK_SOURCE_IS_CONTINUOUS; 440 + } 440 441 441 442 init_timer(&verify_tsc_freq_timer); 442 443 verify_tsc_freq_timer.function = verify_tsc_freq;
+1 -1
arch/i386/kernel/vmitime.c
··· 115 115 .mask = CLOCKSOURCE_MASK(64), 116 116 .mult = 0, /* to be set */ 117 117 .shift = 22, 118 - .is_continuous = 1, 118 + .flags = CLOCK_SOURCE_IS_CONTINUOUS, 119 119 }; 120 120 121 121
+2 -1
drivers/clocksource/acpi_pm.c
··· 72 72 .mask = (cycle_t)ACPI_PM_MASK, 73 73 .mult = 0, /*to be caluclated*/ 74 74 .shift = 22, 75 - .is_continuous = 1, 75 + .flags = CLOCK_SOURCE_IS_CONTINUOUS, 76 + 76 77 }; 77 78 78 79
+1 -1
drivers/clocksource/cyclone.c
··· 31 31 .mask = CYCLONE_TIMER_MASK, 32 32 .mult = 10, 33 33 .shift = 0, 34 - .is_continuous = 1, 34 + .flags = CLOCK_SOURCE_IS_CONTINUOUS, 35 35 }; 36 36 37 37 static int __init init_cyclone_clocksource(void)
+1 -1
drivers/clocksource/scx200_hrt.c
··· 57 57 .rating = 250, 58 58 .read = read_hrt, 59 59 .mask = CLOCKSOURCE_MASK(32), 60 - .is_continuous = 1, 60 + .flags = CLOCK_SOURCE_IS_CONTINUOUS, 61 61 /* mult, shift are set based on mhz27 flag */ 62 62 }; 63 63
+8 -2
include/linux/clocksource.h
··· 45 45 * @mult: cycle to nanosecond multiplier 46 46 * @shift: cycle to nanosecond divisor (power of two) 47 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 49 * @cycle_interval: Used internally by timekeeping core, please ignore. 50 50 * @xtime_interval: Used internally by timekeeping core, please ignore. 51 51 */ ··· 58 58 u32 mult; 59 59 u32 shift; 60 60 int (*update_callback)(void); 61 - int is_continuous; 61 + unsigned long flags; 62 62 63 63 /* timekeeping specific data, ignore */ 64 64 cycle_t cycle_last, cycle_interval; 65 65 u64 xtime_nsec, xtime_interval; 66 66 s64 error; 67 67 }; 68 + 69 + /* 70 + * Clock source flags bits:: 71 + */ 72 + #define CLOCK_SOURCE_IS_CONTINUOUS 0x01 73 + #define CLOCK_SOURCE_MUST_VERIFY 0x02 68 74 69 75 /* simplify initialization of mask field */ 70 76 #define CLOCKSOURCE_MASK(bits) (cycle_t)(bits<64 ? ((1ULL<<bits)-1) : -1)
-1
kernel/time/jiffies.c
··· 62 62 .mask = 0xffffffff, /*32bits*/ 63 63 .mult = NSEC_PER_JIFFY << JIFFIES_SHIFT, /* details above */ 64 64 .shift = JIFFIES_SHIFT, 65 - .is_continuous = 0, /* tick based, not free running */ 66 65 }; 67 66 68 67 static int __init init_jiffies_clocksource(void)
+1 -1
kernel/timer.c
··· 871 871 do { 872 872 seq = read_seqbegin(&xtime_lock); 873 873 874 - ret = clock->is_continuous; 874 + ret = clock->flags & CLOCK_SOURCE_IS_CONTINUOUS; 875 875 876 876 } while (read_seqretry(&xtime_lock, seq)); 877 877