diff options
author | Dmitry Torokhov <dtor_core@ameritech.net> | 2006-04-02 00:08:05 -0500 |
---|---|---|
committer | Dmitry Torokhov <dtor_core@ameritech.net> | 2006-04-02 00:08:05 -0500 |
commit | 95d465fd750897ab32462a6702fbfe1b122cbbc0 (patch) | |
tree | 65c38b2f11c51bb6932e44dd6c92f15b0091abfe /arch/mips/kernel/time.c | |
parent | 642fde17dceceb56c7ba2762733ac688666ae657 (diff) | |
parent | 683aa4012f53b2ada0f430487e05d37b0d94e90a (diff) |
Manual merge with Linus.
Conflicts:
arch/powerpc/kernel/setup-common.c
drivers/input/keyboard/hil_kbd.c
drivers/input/mouse/hil_ptr.c
Diffstat (limited to 'arch/mips/kernel/time.c')
-rw-r--r-- | arch/mips/kernel/time.c | 28 |
1 files changed, 15 insertions, 13 deletions
diff --git a/arch/mips/kernel/time.c b/arch/mips/kernel/time.c index 42c94c771afb..5e51a2d8f3f0 100644 --- a/arch/mips/kernel/time.c +++ b/arch/mips/kernel/time.c | |||
@@ -65,9 +65,9 @@ static int null_rtc_set_time(unsigned long sec) | |||
65 | return 0; | 65 | return 0; |
66 | } | 66 | } |
67 | 67 | ||
68 | unsigned long (*rtc_get_time)(void) = null_rtc_get_time; | 68 | unsigned long (*rtc_mips_get_time)(void) = null_rtc_get_time; |
69 | int (*rtc_set_time)(unsigned long) = null_rtc_set_time; | 69 | int (*rtc_mips_set_time)(unsigned long) = null_rtc_set_time; |
70 | int (*rtc_set_mmss)(unsigned long); | 70 | int (*rtc_mips_set_mmss)(unsigned long); |
71 | 71 | ||
72 | 72 | ||
73 | /* usecs per counter cycle, shifted to left by 32 bits */ | 73 | /* usecs per counter cycle, shifted to left by 32 bits */ |
@@ -424,6 +424,8 @@ irqreturn_t timer_interrupt(int irq, void *dev_id, struct pt_regs *regs) | |||
424 | unsigned long j; | 424 | unsigned long j; |
425 | unsigned int count; | 425 | unsigned int count; |
426 | 426 | ||
427 | write_seqlock(&xtime_lock); | ||
428 | |||
427 | count = mips_hpt_read(); | 429 | count = mips_hpt_read(); |
428 | mips_timer_ack(); | 430 | mips_timer_ack(); |
429 | 431 | ||
@@ -438,22 +440,20 @@ irqreturn_t timer_interrupt(int irq, void *dev_id, struct pt_regs *regs) | |||
438 | 440 | ||
439 | /* | 441 | /* |
440 | * If we have an externally synchronized Linux clock, then update | 442 | * If we have an externally synchronized Linux clock, then update |
441 | * CMOS clock accordingly every ~11 minutes. rtc_set_time() has to be | 443 | * CMOS clock accordingly every ~11 minutes. rtc_mips_set_time() has to be |
442 | * called as close as possible to 500 ms before the new second starts. | 444 | * called as close as possible to 500 ms before the new second starts. |
443 | */ | 445 | */ |
444 | write_seqlock(&xtime_lock); | ||
445 | if (ntp_synced() && | 446 | if (ntp_synced() && |
446 | xtime.tv_sec > last_rtc_update + 660 && | 447 | xtime.tv_sec > last_rtc_update + 660 && |
447 | (xtime.tv_nsec / 1000) >= 500000 - ((unsigned) TICK_SIZE) / 2 && | 448 | (xtime.tv_nsec / 1000) >= 500000 - ((unsigned) TICK_SIZE) / 2 && |
448 | (xtime.tv_nsec / 1000) <= 500000 + ((unsigned) TICK_SIZE) / 2) { | 449 | (xtime.tv_nsec / 1000) <= 500000 + ((unsigned) TICK_SIZE) / 2) { |
449 | if (rtc_set_mmss(xtime.tv_sec) == 0) { | 450 | if (rtc_mips_set_mmss(xtime.tv_sec) == 0) { |
450 | last_rtc_update = xtime.tv_sec; | 451 | last_rtc_update = xtime.tv_sec; |
451 | } else { | 452 | } else { |
452 | /* do it again in 60 s */ | 453 | /* do it again in 60 s */ |
453 | last_rtc_update = xtime.tv_sec - 600; | 454 | last_rtc_update = xtime.tv_sec - 600; |
454 | } | 455 | } |
455 | } | 456 | } |
456 | write_sequnlock(&xtime_lock); | ||
457 | 457 | ||
458 | /* | 458 | /* |
459 | * If jiffies has overflown in this timer_interrupt, we must | 459 | * If jiffies has overflown in this timer_interrupt, we must |
@@ -496,6 +496,8 @@ irqreturn_t timer_interrupt(int irq, void *dev_id, struct pt_regs *regs) | |||
496 | } | 496 | } |
497 | } | 497 | } |
498 | 498 | ||
499 | write_sequnlock(&xtime_lock); | ||
500 | |||
499 | /* | 501 | /* |
500 | * In UP mode, we call local_timer_interrupt() to do profiling | 502 | * In UP mode, we call local_timer_interrupt() to do profiling |
501 | * and process accouting. | 503 | * and process accouting. |
@@ -563,7 +565,7 @@ asmlinkage void ll_local_timer_interrupt(int irq, struct pt_regs *regs) | |||
563 | * b) (optional) calibrate and set the mips_hpt_frequency | 565 | * b) (optional) calibrate and set the mips_hpt_frequency |
564 | * (only needed if you intended to use fixed_rate_gettimeoffset | 566 | * (only needed if you intended to use fixed_rate_gettimeoffset |
565 | * or use cpu counter as timer interrupt source) | 567 | * or use cpu counter as timer interrupt source) |
566 | * 2) setup xtime based on rtc_get_time(). | 568 | * 2) setup xtime based on rtc_mips_get_time(). |
567 | * 3) choose a appropriate gettimeoffset routine. | 569 | * 3) choose a appropriate gettimeoffset routine. |
568 | * 4) calculate a couple of cached variables for later usage | 570 | * 4) calculate a couple of cached variables for later usage |
569 | * 5) board_timer_setup() - | 571 | * 5) board_timer_setup() - |
@@ -631,10 +633,10 @@ void __init time_init(void) | |||
631 | if (board_time_init) | 633 | if (board_time_init) |
632 | board_time_init(); | 634 | board_time_init(); |
633 | 635 | ||
634 | if (!rtc_set_mmss) | 636 | if (!rtc_mips_set_mmss) |
635 | rtc_set_mmss = rtc_set_time; | 637 | rtc_mips_set_mmss = rtc_mips_set_time; |
636 | 638 | ||
637 | xtime.tv_sec = rtc_get_time(); | 639 | xtime.tv_sec = rtc_mips_get_time(); |
638 | xtime.tv_nsec = 0; | 640 | xtime.tv_nsec = 0; |
639 | 641 | ||
640 | set_normalized_timespec(&wall_to_monotonic, | 642 | set_normalized_timespec(&wall_to_monotonic, |
@@ -770,8 +772,8 @@ void to_tm(unsigned long tim, struct rtc_time *tm) | |||
770 | 772 | ||
771 | EXPORT_SYMBOL(rtc_lock); | 773 | EXPORT_SYMBOL(rtc_lock); |
772 | EXPORT_SYMBOL(to_tm); | 774 | EXPORT_SYMBOL(to_tm); |
773 | EXPORT_SYMBOL(rtc_set_time); | 775 | EXPORT_SYMBOL(rtc_mips_set_time); |
774 | EXPORT_SYMBOL(rtc_get_time); | 776 | EXPORT_SYMBOL(rtc_mips_get_time); |
775 | 777 | ||
776 | unsigned long long sched_clock(void) | 778 | unsigned long long sched_clock(void) |
777 | { | 779 | { |