lkml.org 
[lkml]   [2005]   [Nov]   [26]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
Patch in this message
/
Date
From
SubjectRe: [PATCH 5/13] Time: i386 Conversion - part 1: Move timer_pit.c to i8253.c

- clean up timeofday-arch-i386-part1.patch

Signed-off-by: Ingo Molnar <mingo@elte.hu>

arch/i386/kernel/i8253.c | 29 +++++++++++++++++------------
1 files changed, 17 insertions(+), 12 deletions(-)
Index: linux/arch/i386/kernel/i8253.c
===================================================================
--- linux.orig/arch/i386/kernel/i8253.c
+++ linux/arch/i386/kernel/i8253.c
@@ -2,12 +2,12 @@
* i8253.c 8253/PIT functions
*
*/
-#include <linux/init.h>
-#include <linux/jiffies.h>
+#include <linux/clocksource.h>
#include <linux/spinlock.h>
+#include <linux/jiffies.h>
#include <linux/sysdev.h>
-#include <linux/clocksource.h>
#include <linux/module.h>
+#include <linux/init.h>

#include <asm/delay.h>
#include <asm/i8253.h>
@@ -34,6 +34,7 @@ void setup_pit_timer(void)
static int timer_resume(struct sys_device *dev)
{
setup_pit_timer();
+
return 0;
}

@@ -50,19 +51,20 @@ static struct sys_device device_timer =
static int __init init_timer_sysfs(void)
{
int error = sysdev_class_register(&timer_sysclass);
+
if (!error)
error = sysdev_register(&device_timer);
+
return error;
}

device_initcall(init_timer_sysfs);

-
-/* Since the PIT overflows every tick, its not very useful
+/*
+ * Since the PIT overflows every tick, its not very useful
* to just read by itself. So use jiffies to emulate a free
- * running counter.
+ * running counter:
*/
-
static cycle_t pit_read(void)
{
unsigned long flags, seq;
@@ -85,6 +87,7 @@ static cycle_t pit_read(void)
count = LATCH - 1;
}
spin_unlock_irqrestore(&i8253_lock, flags);
+
jifs = jiffies_64;
} while (read_seqretry(&xtime_lock, seq));

@@ -95,21 +98,23 @@ static cycle_t pit_read(void)
}

static struct clocksource clocksource_pit = {
- .name = "pit",
+ .name = "pit",
.rating = 110,
- .read = pit_read,
- .mask = (cycle_t)-1,
- .mult = 0,
- .shift = 20,
+ .read = pit_read,
+ .mask = (cycle_t)-1,
+ .mult = 0,
+ .shift = 20,
};

static int __init init_pit_clocksource(void)
{
+ /* TODO: bogus limit of 4 CPUs? --mingo */
if (num_possible_cpus() > 4) /* PIT does not scale! */
return 0;

clocksource_pit.mult = clocksource_hz2mult(CLOCK_TICK_RATE, 20);
register_clocksource(&clocksource_pit);
+
return 0;
}
module_init(init_pit_clocksource);
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
\
 
 \ /
  Last update: 2005-11-26 15:57    [from the cache]
©2003-2011 Jasper Spaans