diff options
Diffstat (limited to 'arch/cris/arch-v10/kernel/fasttimer.c')
-rw-r--r-- | arch/cris/arch-v10/kernel/fasttimer.c | 55 |
1 files changed, 29 insertions, 26 deletions
diff --git a/arch/cris/arch-v10/kernel/fasttimer.c b/arch/cris/arch-v10/kernel/fasttimer.c index 4717f7ae8e51..094ff45ae85b 100644 --- a/arch/cris/arch-v10/kernel/fasttimer.c +++ b/arch/cris/arch-v10/kernel/fasttimer.c | |||
@@ -1,10 +1,20 @@ | |||
1 | /* $Id: fasttimer.c,v 1.6 2004/05/14 10:18:39 starvik Exp $ | 1 | /* $Id: fasttimer.c,v 1.9 2005/03/04 08:16:16 starvik Exp $ |
2 | * linux/arch/cris/kernel/fasttimer.c | 2 | * linux/arch/cris/kernel/fasttimer.c |
3 | * | 3 | * |
4 | * Fast timers for ETRAX100/ETRAX100LX | 4 | * Fast timers for ETRAX100/ETRAX100LX |
5 | * This may be useful in other OS than Linux so use 2 space indentation... | 5 | * This may be useful in other OS than Linux so use 2 space indentation... |
6 | * | 6 | * |
7 | * $Log: fasttimer.c,v $ | 7 | * $Log: fasttimer.c,v $ |
8 | * Revision 1.9 2005/03/04 08:16:16 starvik | ||
9 | * Merge of Linux 2.6.11. | ||
10 | * | ||
11 | * Revision 1.8 2005/01/05 06:09:29 starvik | ||
12 | * cli()/sti() will be obsolete in 2.6.11. | ||
13 | * | ||
14 | * Revision 1.7 2005/01/03 13:35:46 starvik | ||
15 | * Removed obsolete stuff. | ||
16 | * Mark fast timer IRQ as not shared. | ||
17 | * | ||
8 | * Revision 1.6 2004/05/14 10:18:39 starvik | 18 | * Revision 1.6 2004/05/14 10:18:39 starvik |
9 | * Export fast_timer_list | 19 | * Export fast_timer_list |
10 | * | 20 | * |
@@ -148,8 +158,7 @@ static int debug_log_cnt_wrapped = 0; | |||
148 | #define DEBUG_LOG(string, value) \ | 158 | #define DEBUG_LOG(string, value) \ |
149 | { \ | 159 | { \ |
150 | unsigned long log_flags; \ | 160 | unsigned long log_flags; \ |
151 | save_flags(log_flags); \ | 161 | local_irq_save(log_flags); \ |
152 | cli(); \ | ||
153 | debug_log_string[debug_log_cnt] = (string); \ | 162 | debug_log_string[debug_log_cnt] = (string); \ |
154 | debug_log_value[debug_log_cnt] = (unsigned long)(value); \ | 163 | debug_log_value[debug_log_cnt] = (unsigned long)(value); \ |
155 | if (++debug_log_cnt >= DEBUG_LOG_MAX) \ | 164 | if (++debug_log_cnt >= DEBUG_LOG_MAX) \ |
@@ -157,7 +166,7 @@ static int debug_log_cnt_wrapped = 0; | |||
157 | debug_log_cnt = debug_log_cnt % DEBUG_LOG_MAX; \ | 166 | debug_log_cnt = debug_log_cnt % DEBUG_LOG_MAX; \ |
158 | debug_log_cnt_wrapped = 1; \ | 167 | debug_log_cnt_wrapped = 1; \ |
159 | } \ | 168 | } \ |
160 | restore_flags(log_flags); \ | 169 | local_irq_restore(log_flags); \ |
161 | } | 170 | } |
162 | #else | 171 | #else |
163 | #define DEBUG_LOG(string, value) | 172 | #define DEBUG_LOG(string, value) |
@@ -320,8 +329,7 @@ void start_one_shot_timer(struct fast_timer *t, | |||
320 | 329 | ||
321 | D1(printk("sft %s %d us\n", name, delay_us)); | 330 | D1(printk("sft %s %d us\n", name, delay_us)); |
322 | 331 | ||
323 | save_flags(flags); | 332 | local_irq_save(flags); |
324 | cli(); | ||
325 | 333 | ||
326 | do_gettimeofday_fast(&t->tv_set); | 334 | do_gettimeofday_fast(&t->tv_set); |
327 | tmp = fast_timer_list; | 335 | tmp = fast_timer_list; |
@@ -395,7 +403,7 @@ void start_one_shot_timer(struct fast_timer *t, | |||
395 | 403 | ||
396 | D2(printk("start_one_shot_timer: %d us done\n", delay_us)); | 404 | D2(printk("start_one_shot_timer: %d us done\n", delay_us)); |
397 | 405 | ||
398 | restore_flags(flags); | 406 | local_irq_restore(flags); |
399 | } /* start_one_shot_timer */ | 407 | } /* start_one_shot_timer */ |
400 | 408 | ||
401 | static inline int fast_timer_pending (const struct fast_timer * t) | 409 | static inline int fast_timer_pending (const struct fast_timer * t) |
@@ -425,11 +433,10 @@ int del_fast_timer(struct fast_timer * t) | |||
425 | unsigned long flags; | 433 | unsigned long flags; |
426 | int ret; | 434 | int ret; |
427 | 435 | ||
428 | save_flags(flags); | 436 | local_irq_save(flags); |
429 | cli(); | ||
430 | ret = detach_fast_timer(t); | 437 | ret = detach_fast_timer(t); |
431 | t->next = t->prev = NULL; | 438 | t->next = t->prev = NULL; |
432 | restore_flags(flags); | 439 | local_irq_restore(flags); |
433 | return ret; | 440 | return ret; |
434 | } /* del_fast_timer */ | 441 | } /* del_fast_timer */ |
435 | 442 | ||
@@ -444,8 +451,7 @@ timer1_handler(int irq, void *dev_id, struct pt_regs *regs) | |||
444 | struct fast_timer *t; | 451 | struct fast_timer *t; |
445 | unsigned long flags; | 452 | unsigned long flags; |
446 | 453 | ||
447 | save_flags(flags); | 454 | local_irq_save(flags); |
448 | cli(); | ||
449 | 455 | ||
450 | /* Clear timer1 irq */ | 456 | /* Clear timer1 irq */ |
451 | *R_IRQ_MASK0_CLR = IO_STATE(R_IRQ_MASK0_CLR, timer1, clr); | 457 | *R_IRQ_MASK0_CLR = IO_STATE(R_IRQ_MASK0_CLR, timer1, clr); |
@@ -462,7 +468,7 @@ timer1_handler(int irq, void *dev_id, struct pt_regs *regs) | |||
462 | fast_timer_running = 0; | 468 | fast_timer_running = 0; |
463 | fast_timer_ints++; | 469 | fast_timer_ints++; |
464 | 470 | ||
465 | restore_flags(flags); | 471 | local_irq_restore(flags); |
466 | 472 | ||
467 | t = fast_timer_list; | 473 | t = fast_timer_list; |
468 | while (t) | 474 | while (t) |
@@ -482,8 +488,7 @@ timer1_handler(int irq, void *dev_id, struct pt_regs *regs) | |||
482 | fast_timers_expired++; | 488 | fast_timers_expired++; |
483 | 489 | ||
484 | /* Remove this timer before call, since it may reuse the timer */ | 490 | /* Remove this timer before call, since it may reuse the timer */ |
485 | save_flags(flags); | 491 | local_irq_save(flags); |
486 | cli(); | ||
487 | if (t->prev) | 492 | if (t->prev) |
488 | { | 493 | { |
489 | t->prev->next = t->next; | 494 | t->prev->next = t->next; |
@@ -498,7 +503,7 @@ timer1_handler(int irq, void *dev_id, struct pt_regs *regs) | |||
498 | } | 503 | } |
499 | t->prev = NULL; | 504 | t->prev = NULL; |
500 | t->next = NULL; | 505 | t->next = NULL; |
501 | restore_flags(flags); | 506 | local_irq_restore(flags); |
502 | 507 | ||
503 | if (t->function != NULL) | 508 | if (t->function != NULL) |
504 | { | 509 | { |
@@ -515,8 +520,7 @@ timer1_handler(int irq, void *dev_id, struct pt_regs *regs) | |||
515 | D1(printk(".\n")); | 520 | D1(printk(".\n")); |
516 | } | 521 | } |
517 | 522 | ||
518 | save_flags(flags); | 523 | local_irq_save(flags); |
519 | cli(); | ||
520 | if ((t = fast_timer_list) != NULL) | 524 | if ((t = fast_timer_list) != NULL) |
521 | { | 525 | { |
522 | /* Start next timer.. */ | 526 | /* Start next timer.. */ |
@@ -535,7 +539,7 @@ timer1_handler(int irq, void *dev_id, struct pt_regs *regs) | |||
535 | #endif | 539 | #endif |
536 | start_timer1(us); | 540 | start_timer1(us); |
537 | } | 541 | } |
538 | restore_flags(flags); | 542 | local_irq_restore(flags); |
539 | break; | 543 | break; |
540 | } | 544 | } |
541 | else | 545 | else |
@@ -546,7 +550,7 @@ timer1_handler(int irq, void *dev_id, struct pt_regs *regs) | |||
546 | D1(printk("e! %d\n", us)); | 550 | D1(printk("e! %d\n", us)); |
547 | } | 551 | } |
548 | } | 552 | } |
549 | restore_flags(flags); | 553 | local_irq_restore(flags); |
550 | } | 554 | } |
551 | 555 | ||
552 | if (!t) | 556 | if (!t) |
@@ -748,13 +752,12 @@ static int proc_fasttimer_read(char *buf, char **start, off_t offset, int len | |||
748 | #endif | 752 | #endif |
749 | 753 | ||
750 | used += sprintf(bigbuf + used, "Active timers:\n"); | 754 | used += sprintf(bigbuf + used, "Active timers:\n"); |
751 | save_flags(flags); | 755 | local_irq_save(flags); |
752 | cli(); | ||
753 | t = fast_timer_list; | 756 | t = fast_timer_list; |
754 | while (t != NULL && (used+100 < BIG_BUF_SIZE)) | 757 | while (t != NULL && (used+100 < BIG_BUF_SIZE)) |
755 | { | 758 | { |
756 | nextt = t->next; | 759 | nextt = t->next; |
757 | restore_flags(flags); | 760 | local_irq_restore(flags); |
758 | used += sprintf(bigbuf + used, "%-14s s: %6lu.%06lu e: %6lu.%06lu " | 761 | used += sprintf(bigbuf + used, "%-14s s: %6lu.%06lu e: %6lu.%06lu " |
759 | "d: %6li us data: 0x%08lX" | 762 | "d: %6li us data: 0x%08lX" |
760 | /* " func: 0x%08lX" */ | 763 | /* " func: 0x%08lX" */ |
@@ -768,14 +771,14 @@ static int proc_fasttimer_read(char *buf, char **start, off_t offset, int len | |||
768 | t->data | 771 | t->data |
769 | /* , t->function */ | 772 | /* , t->function */ |
770 | ); | 773 | ); |
771 | cli(); | 774 | local_irq_disable(); |
772 | if (t->next != nextt) | 775 | if (t->next != nextt) |
773 | { | 776 | { |
774 | printk(KERN_WARNING "timer removed!\n"); | 777 | printk(KERN_WARNING "timer removed!\n"); |
775 | } | 778 | } |
776 | t = nextt; | 779 | t = nextt; |
777 | } | 780 | } |
778 | restore_flags(flags); | 781 | local_irq_restore(flags); |
779 | } | 782 | } |
780 | 783 | ||
781 | if (used - offset < len) | 784 | if (used - offset < len) |
@@ -963,7 +966,7 @@ void fast_timer_init(void) | |||
963 | if ((fasttimer_proc_entry = create_proc_entry( "fasttimer", 0, 0 ))) | 966 | if ((fasttimer_proc_entry = create_proc_entry( "fasttimer", 0, 0 ))) |
964 | fasttimer_proc_entry->read_proc = proc_fasttimer_read; | 967 | fasttimer_proc_entry->read_proc = proc_fasttimer_read; |
965 | #endif /* PROC_FS */ | 968 | #endif /* PROC_FS */ |
966 | if(request_irq(TIMER1_IRQ_NBR, timer1_handler, SA_SHIRQ, | 969 | if(request_irq(TIMER1_IRQ_NBR, timer1_handler, 0, |
967 | "fast timer int", NULL)) | 970 | "fast timer int", NULL)) |
968 | { | 971 | { |
969 | printk("err: timer1 irq\n"); | 972 | printk("err: timer1 irq\n"); |