From: Zwane Mwaikambo Now that things got cleaned up a bit, there is no real reason why the pit initialisation code has to be in i8259.c. Move it to timer_pit.ca Signed-off-by: Zwane Mwaikambo DESC move-pit-code-to-timer_pit-warning-fix EDESC Signed-off-by: Andrew Morton --- 25-akpm/arch/i386/kernel/i8259.c | 45 +--------------------------- 25-akpm/arch/i386/kernel/timers/timer_pit.c | 44 +++++++++++++++++++++++++++ 25-akpm/include/asm-i386/timer.h | 1 3 files changed, 48 insertions(+), 42 deletions(-) diff -puN arch/i386/kernel/i8259.c~move-pit-code-to-timer_pit arch/i386/kernel/i8259.c --- 25/arch/i386/kernel/i8259.c~move-pit-code-to-timer_pit Mon Aug 16 16:18:09 2004 +++ 25-akpm/arch/i386/kernel/i8259.c Mon Aug 16 16:18:12 2004 @@ -4,7 +4,6 @@ #include #include #include -#include #include #include #include @@ -12,10 +11,12 @@ #include #include +#include #include #include #include #include +#include #include #include #include @@ -388,46 +389,6 @@ void __init init_ISA_irqs (void) } } -static void setup_timer(void) -{ - extern spinlock_t i8253_lock; - unsigned long flags; - - spin_lock_irqsave(&i8253_lock, flags); - outb_p(0x34,PIT_MODE); /* binary, mode 2, LSB/MSB, ch 0 */ - udelay(10); - outb_p(LATCH & 0xff , PIT_CH0); /* LSB */ - udelay(10); - outb(LATCH >> 8 , PIT_CH0); /* MSB */ - spin_unlock_irqrestore(&i8253_lock, flags); -} - -static int timer_resume(struct sys_device *dev) -{ - setup_timer(); - return 0; -} - -static struct sysdev_class timer_sysclass = { - set_kset_name("timer"), - .resume = timer_resume, -}; - -static struct sys_device device_timer = { - .id = 0, - .cls = &timer_sysclass, -}; - -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); - void __init init_IRQ(void) { int i; @@ -459,7 +420,7 @@ void __init init_IRQ(void) * Set the clock to HZ Hz, we already have a valid * vector now: */ - setup_timer(); + setup_pit_timer(); /* * External FPU? Set up irq13 if so, for diff -puN arch/i386/kernel/timers/timer_pit.c~move-pit-code-to-timer_pit arch/i386/kernel/timers/timer_pit.c --- 25/arch/i386/kernel/timers/timer_pit.c~move-pit-code-to-timer_pit Mon Aug 16 16:18:09 2004 +++ 25-akpm/arch/i386/kernel/timers/timer_pit.c Mon Aug 16 16:18:09 2004 @@ -7,6 +7,9 @@ #include #include #include +#include +#include +#include #include #include #include @@ -156,3 +159,44 @@ struct timer_opts timer_pit = { .monotonic_clock = monotonic_clock_pit, .delay = delay_pit, }; + +void setup_pit_timer(void) +{ + extern spinlock_t i8253_lock; + unsigned long flags; + + spin_lock_irqsave(&i8253_lock, flags); + outb_p(0x34,PIT_MODE); /* binary, mode 2, LSB/MSB, ch 0 */ + udelay(10); + outb_p(LATCH & 0xff , PIT_CH0); /* LSB */ + udelay(10); + outb(LATCH >> 8 , PIT_CH0); /* MSB */ + spin_unlock_irqrestore(&i8253_lock, flags); +} + +static int timer_resume(struct sys_device *dev) +{ + setup_pit_timer(); + return 0; +} + +static struct sysdev_class timer_sysclass = { + set_kset_name("timer"), + .resume = timer_resume, +}; + +static struct sys_device device_timer = { + .id = 0, + .cls = &timer_sysclass, +}; + +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); + diff -puN include/asm-i386/timer.h~move-pit-code-to-timer_pit include/asm-i386/timer.h --- 25/include/asm-i386/timer.h~move-pit-code-to-timer_pit Mon Aug 16 16:18:12 2004 +++ 25-akpm/include/asm-i386/timer.h Mon Aug 16 16:18:12 2004 @@ -28,6 +28,7 @@ struct timer_opts{ extern struct timer_opts* select_timer(void); extern void clock_fallback(void); +void setup_pit_timer(void); /* Modifiers for buggy PIT handling */ _