Skip to content

Commit dd3db6e

Browse files
committed
[MIPS] i8253: Cleanup.
Signed-off-by: Ralf Baechle <ralf@linux-mips.org>
1 parent 9aa4cc1 commit dd3db6e

1 file changed

Lines changed: 12 additions & 11 deletions

File tree

‎arch/mips/kernel/i8253.c‎

Lines changed: 12 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@
1212
#include <asm/delay.h>
1313
#include <asm/i8253.h>
1414
#include <asm/io.h>
15+
#include <asm/time.h>
1516

1617
static DEFINE_SPINLOCK(i8253_lock);
1718

@@ -87,11 +88,10 @@ struct clock_event_device pit_clockevent = {
8788
.features = CLOCK_EVT_FEAT_PERIODIC | CLOCK_EVT_FEAT_ONESHOT,
8889
.set_mode = init_pit_timer,
8990
.set_next_event = pit_next_event,
90-
.shift = 32,
9191
.irq = 0,
9292
};
9393

94-
irqreturn_t timer_interrupt(int irq, void *dev_id)
94+
static irqreturn_t timer_interrupt(int irq, void *dev_id)
9595
{
9696
pit_clockevent.event_handler(&pit_clockevent);
9797

@@ -111,19 +111,20 @@ static struct irqaction irq0 = {
111111
*/
112112
void __init setup_pit_timer(void)
113113
{
114+
struct clock_event_device *cd = &pit_clockevent;
115+
unsigned int cpu = smp_processor_id();
116+
114117
/*
115118
* Start pit with the boot cpu mask and make it global after the
116119
* IO_APIC has been initialized.
117120
*/
118-
pit_clockevent.cpumask = cpumask_of_cpu(0);
119-
pit_clockevent.mult = div_sc(CLOCK_TICK_RATE, NSEC_PER_SEC, 32);
120-
pit_clockevent.max_delta_ns =
121-
clockevent_delta2ns(0x7FFF, &pit_clockevent);
122-
pit_clockevent.min_delta_ns =
123-
clockevent_delta2ns(0xF, &pit_clockevent);
124-
clockevents_register_device(&pit_clockevent);
125-
126-
irq0.mask = cpumask_of_cpu(0);
121+
cd->cpumask = cpumask_of_cpu(cpu);
122+
clockevent_set_clock(cd, CLOCK_TICK_RATE);
123+
cd->max_delta_ns = clockevent_delta2ns(0x7FFF, cd);
124+
cd->min_delta_ns = clockevent_delta2ns(0xF, cd);
125+
clockevents_register_device(cd);
126+
127+
irq0.mask = cpumask_of_cpu(cpu);
127128
setup_irq(0, &irq0);
128129
}
129130

0 commit comments

Comments
 (0)