aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--arch/i386/kernel/hpet.c4
-rw-r--r--arch/i386/kernel/i8253.c2
-rw-r--r--arch/i386/kernel/tsc.c2
-rw-r--r--drivers/clocksource/acpi_pm.c2
-rw-r--r--drivers/clocksource/cyclone.c4
-rw-r--r--include/linux/clocksource.h2
6 files changed, 9 insertions, 7 deletions
diff --git a/arch/i386/kernel/hpet.c b/arch/i386/kernel/hpet.c
index 23e7d2c5d253..c6737c35815d 100644
--- a/arch/i386/kernel/hpet.c
+++ b/arch/i386/kernel/hpet.c
@@ -6,7 +6,7 @@
6#include <asm/hpet.h> 6#include <asm/hpet.h>
7#include <asm/io.h> 7#include <asm/io.h>
8 8
9#define HPET_MASK 0xFFFFFFFF 9#define HPET_MASK CLOCKSOURCE_MASK(32)
10#define HPET_SHIFT 22 10#define HPET_SHIFT 22
11 11
12/* FSEC = 10^-15 NSEC = 10^-9 */ 12/* FSEC = 10^-15 NSEC = 10^-9 */
@@ -23,7 +23,7 @@ static struct clocksource clocksource_hpet = {
23 .name = "hpet", 23 .name = "hpet",
24 .rating = 250, 24 .rating = 250,
25 .read = read_hpet, 25 .read = read_hpet,
26 .mask = (cycle_t)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 .is_continuous = 1,
diff --git a/arch/i386/kernel/i8253.c b/arch/i386/kernel/i8253.c
index 5b13739a7ff4..38aa7f19f1d3 100644
--- a/arch/i386/kernel/i8253.c
+++ b/arch/i386/kernel/i8253.c
@@ -69,7 +69,7 @@ static struct clocksource clocksource_pit = {
69 .name = "pit", 69 .name = "pit",
70 .rating = 110, 70 .rating = 110,
71 .read = pit_read, 71 .read = pit_read,
72 .mask = (cycle_t)-1, 72 .mask = CLOCKSOURCE_MASK(64),
73 .mult = 0, 73 .mult = 0,
74 .shift = 20, 74 .shift = 20,
75}; 75};
diff --git a/arch/i386/kernel/tsc.c b/arch/i386/kernel/tsc.c
index 1c3c927755de..7e0d8dab2075 100644
--- a/arch/i386/kernel/tsc.c
+++ b/arch/i386/kernel/tsc.c
@@ -337,7 +337,7 @@ static struct clocksource clocksource_tsc = {
337 .name = "tsc", 337 .name = "tsc",
338 .rating = 300, 338 .rating = 300,
339 .read = read_tsc, 339 .read = read_tsc,
340 .mask = (cycle_t)-1, 340 .mask = CLOCKSOURCE_MASK(64),
341 .mult = 0, /* to be set */ 341 .mult = 0, /* to be set */
342 .shift = 22, 342 .shift = 22,
343 .update_callback = tsc_update_callback, 343 .update_callback = tsc_update_callback,
diff --git a/drivers/clocksource/acpi_pm.c b/drivers/clocksource/acpi_pm.c
index 066dc77433d5..7ad3be8c0f49 100644
--- a/drivers/clocksource/acpi_pm.c
+++ b/drivers/clocksource/acpi_pm.c
@@ -32,7 +32,7 @@
32 */ 32 */
33u32 pmtmr_ioport __read_mostly; 33u32 pmtmr_ioport __read_mostly;
34 34
35#define ACPI_PM_MASK 0xFFFFFF /* limit it to 24 bits */ 35#define ACPI_PM_MASK CLOCKSOURCE_MASK(24) /* limit it to 24 bits */
36 36
37static inline u32 read_pmtmr(void) 37static inline u32 read_pmtmr(void)
38{ 38{
diff --git a/drivers/clocksource/cyclone.c b/drivers/clocksource/cyclone.c
index 5906a0af825d..bf4d3d50d1c4 100644
--- a/drivers/clocksource/cyclone.c
+++ b/drivers/clocksource/cyclone.c
@@ -14,7 +14,7 @@
14#define CYCLONE_MPCS_OFFSET 0x51A8 /* offset to select register */ 14#define CYCLONE_MPCS_OFFSET 0x51A8 /* offset to select register */
15#define CYCLONE_MPMC_OFFSET 0x51D0 /* offset to count register */ 15#define CYCLONE_MPMC_OFFSET 0x51D0 /* offset to count register */
16#define CYCLONE_TIMER_FREQ 99780000 /* 100Mhz, but not really */ 16#define CYCLONE_TIMER_FREQ 99780000 /* 100Mhz, but not really */
17#define CYCLONE_TIMER_MASK 0xFFFFFFFF /* 32 bit mask */ 17#define CYCLONE_TIMER_MASK CLOCKSOURCE_MASK(32) /* 32 bit mask */
18 18
19int use_cyclone = 0; 19int use_cyclone = 0;
20static void __iomem *cyclone_ptr; 20static void __iomem *cyclone_ptr;
@@ -28,7 +28,7 @@ static struct clocksource clocksource_cyclone = {
28 .name = "cyclone", 28 .name = "cyclone",
29 .rating = 250, 29 .rating = 250,
30 .read = read_cyclone, 30 .read = read_cyclone,
31 .mask = (cycle_t)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 .is_continuous = 1,
diff --git a/include/linux/clocksource.h b/include/linux/clocksource.h
index 5f4a7f72f3ee..4bc94282c364 100644
--- a/include/linux/clocksource.h
+++ b/include/linux/clocksource.h
@@ -65,6 +65,8 @@ struct clocksource {
65 u64 interval_snsecs; 65 u64 interval_snsecs;
66}; 66};
67 67
68/* simplify initialization of mask field */
69#define CLOCKSOURCE_MASK(bits) (cycle_t)(bits<64 ? ((1ULL<<bits)-1) : -1)
68 70
69/** 71/**
70 * clocksource_khz2mult - calculates mult from khz and shift 72 * clocksource_khz2mult - calculates mult from khz and shift