From cab1826e1a9d8318e99d9df945d9715ce5e4a7c8 Mon Sep 17 00:00:00 2001
From: John Stultz <johnstul@us.ibm.com>
Date: Sun, 12 Jan 2003 23:44:53 -0800
Subject: [PATCH] [PATCH] linux-2.5.57_timer-none_A0.patch

This creates an empty timer_opt structure (timer_none) which is then
used as a default initializer to the timer pointer.  This lets us avoid
having to check before dereferencing the timer in future code.
---
 arch/i386/kernel/time.c              |  3 ++-
 arch/i386/kernel/timers/Makefile     |  2 +-
 arch/i386/kernel/timers/timer_none.c | 24 ++++++++++++++++++++++++
 3 files changed, 27 insertions(+), 2 deletions(-)
 create mode 100644 arch/i386/kernel/timers/timer_none.c

diff --git a/arch/i386/kernel/time.c b/arch/i386/kernel/time.c
index ef1cfa33b154..4db7f942440f 100644
--- a/arch/i386/kernel/time.c
+++ b/arch/i386/kernel/time.c
@@ -78,7 +78,8 @@ spinlock_t rtc_lock = SPIN_LOCK_UNLOCKED;
 spinlock_t i8253_lock = SPIN_LOCK_UNLOCKED;
 EXPORT_SYMBOL(i8253_lock);
 
-struct timer_opts* timer;
+extern struct timer_opts timer_none;
+struct timer_opts* timer = &timer_none;
 
 /*
  * This version of gettimeofday has microsecond resolution
diff --git a/arch/i386/kernel/timers/Makefile b/arch/i386/kernel/timers/Makefile
index 4e891aabbfa5..f16c0c0b263f 100644
--- a/arch/i386/kernel/timers/Makefile
+++ b/arch/i386/kernel/timers/Makefile
@@ -2,6 +2,6 @@
 # Makefile for x86 timers
 #
 
-obj-y := timer.o timer_tsc.o timer_pit.o
+obj-y := timer.o timer_none.o timer_tsc.o timer_pit.o
 
 obj-$(CONFIG_X86_CYCLONE)	+= timer_cyclone.o
diff --git a/arch/i386/kernel/timers/timer_none.c b/arch/i386/kernel/timers/timer_none.c
new file mode 100644
index 000000000000..cca5eda7cefa
--- /dev/null
+++ b/arch/i386/kernel/timers/timer_none.c
@@ -0,0 +1,24 @@
+#include <asm/timer.h>
+
+static int init_none(void)
+{
+	return 0;
+}
+
+static void mark_offset_none(void)
+{
+	/* nothing needed */
+}
+
+static unsigned long get_offset_none(void)
+{
+	return 0;
+}
+
+
+/* tsc timer_opts struct */
+struct timer_opts timer_none = {
+	.init =		init_none, 
+	.mark_offset =	mark_offset_none, 
+	.get_offset =	get_offset_none,
+};
-- 
2.30.9