[patch 67/87] x86: hpet: provide separate functions to stop and start the counter

From: Greg KH
Date: Tue Jun 09 2009 - 06:33:39 EST


2.6.29-stable review patch. If anyone has any objections, please let us know.

------------------

From: Andreas Herrmann <andreas.herrmann3@xxxxxxx>

commit 8d6f0c8214928f7c5083dd54ecb69c5d615b516e upstream.

By splitting up existing hpet_start_counter function.

Signed-off-by: Andreas Herrmann <andreas.herrmann3@xxxxxxx>
Cc: Mark Hounschell <markh@xxxxxxxxxx>
Cc: Borislav Petkov <borislav.petkov@xxxxxxx>
Signed-off-by: Ingo Molnar <mingo@xxxxxxx>
Cc: Chuck Ebbert <cebbert@xxxxxxxxxx>
Signed-off-by: Greg Kroah-Hartman <gregkh@xxxxxxx>

---
arch/x86/kernel/hpet.c | 22 ++++++++++++++++------
1 file changed, 16 insertions(+), 6 deletions(-)

--- a/arch/x86/kernel/hpet.c
+++ b/arch/x86/kernel/hpet.c
@@ -191,27 +191,37 @@ static struct clock_event_device hpet_cl
.rating = 50,
};

-static void hpet_start_counter(void)
+static void hpet_stop_counter(void)
{
unsigned long cfg = hpet_readl(HPET_CFG);
-
cfg &= ~HPET_CFG_ENABLE;
hpet_writel(cfg, HPET_CFG);
hpet_writel(0, HPET_COUNTER);
hpet_writel(0, HPET_COUNTER + 4);
+}
+
+static void hpet_start_counter(void)
+{
+ unsigned long cfg = hpet_readl(HPET_CFG);
cfg |= HPET_CFG_ENABLE;
hpet_writel(cfg, HPET_CFG);
}

+static void hpet_restart_counter(void)
+{
+ hpet_stop_counter();
+ hpet_start_counter();
+}
+
static void hpet_resume_device(void)
{
force_hpet_resume();
}

-static void hpet_restart_counter(void)
+static void hpet_resume_counter(void)
{
hpet_resume_device();
- hpet_start_counter();
+ hpet_restart_counter();
}

static void hpet_enable_legacy_int(void)
@@ -695,7 +705,7 @@ static struct clocksource clocksource_hp
.mask = HPET_MASK,
.shift = HPET_SHIFT,
.flags = CLOCK_SOURCE_IS_CONTINUOUS,
- .resume = hpet_restart_counter,
+ .resume = hpet_resume_counter,
#ifdef CONFIG_X86_64
.vread = vread_hpet,
#endif
@@ -707,7 +717,7 @@ static int hpet_clocksource_register(voi
cycle_t t1;

/* Start the counter */
- hpet_start_counter();
+ hpet_restart_counter();

/* Verify whether hpet counter works */
t1 = read_hpet();


--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/