aboutsummaryrefslogtreecommitdiffstats
path: root/arch/cris
diff options
context:
space:
mode:
authorDavid Howells <dhowells@redhat.com>2013-04-10 22:04:20 -0400
committerAl Viro <viro@zeniv.linux.org.uk>2013-04-29 15:41:59 -0400
commit1eb5b23ae72b2b858800c8eee6adeef7c098e767 (patch)
tree49d5b57230c63ac4f4034d2a55b4e6d5ec66cf51 /arch/cris
parent210b834a964c775387098bbc9e3836d3cd0e9b14 (diff)
cris: Don't use create_proc_read_entry()
Don't use create_proc_read_entry() as that is deprecated, but rather use proc_create_data() and seq_file instead. Signed-off-by: David Howells <dhowells@redhat.com> Acked-by: Jesper Nilsson <jesper.nilsson@axis.com> cc: Mikael Starvik <starvik@axis.com> cc: linux-cris-kernel@axis.com Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
Diffstat (limited to 'arch/cris')
-rw-r--r--arch/cris/arch-v10/kernel/fasttimer.c299
-rw-r--r--arch/cris/arch-v32/kernel/fasttimer.c296
2 files changed, 265 insertions, 330 deletions
diff --git a/arch/cris/arch-v10/kernel/fasttimer.c b/arch/cris/arch-v10/kernel/fasttimer.c
index 52bb9b5531e1..ce6f512968a4 100644
--- a/arch/cris/arch-v10/kernel/fasttimer.c
+++ b/arch/cris/arch-v10/kernel/fasttimer.c
@@ -25,6 +25,7 @@
25#include <arch/svinto.h> 25#include <arch/svinto.h>
26#include <asm/fasttimer.h> 26#include <asm/fasttimer.h>
27#include <linux/proc_fs.h> 27#include <linux/proc_fs.h>
28#include <linux/seq_file.h>
28 29
29 30
30#define DEBUG_LOG_INCLUDED 31#define DEBUG_LOG_INCLUDED
@@ -489,196 +490,162 @@ void schedule_usleep(unsigned long us)
489} 490}
490 491
491#ifdef CONFIG_PROC_FS 492#ifdef CONFIG_PROC_FS
492static int proc_fasttimer_read(char *buf, char **start, off_t offset, int len
493 ,int *eof, void *data_unused);
494#endif /* CONFIG_PROC_FS */
495
496#ifdef CONFIG_PROC_FS
497
498/* This value is very much based on testing */ 493/* This value is very much based on testing */
499#define BIG_BUF_SIZE (500 + NUM_TIMER_STATS * 300) 494#define BIG_BUF_SIZE (500 + NUM_TIMER_STATS * 300)
500 495
501static int proc_fasttimer_read(char *buf, char **start, off_t offset, int len 496static int proc_fasttimer_show(struct seq_file *m, void *v)
502 ,int *eof, void *data_unused)
503{ 497{
504 unsigned long flags; 498 unsigned long flags;
505 int i = 0; 499 int i = 0;
506 int num_to_show; 500 int num_to_show;
507 struct fasttime_t tv; 501 struct fasttime_t tv;
508 struct fast_timer *t, *nextt; 502 struct fast_timer *t, *nextt;
509 static char *bigbuf = NULL; 503
510 static unsigned long used; 504 do_gettimeofday_fast(&tv);
511 505
512 if (!bigbuf && !(bigbuf = vmalloc(BIG_BUF_SIZE))) 506 seq_printf(m, "Fast timers added: %i\n", fast_timers_added);
513 { 507 seq_printf(m, "Fast timers started: %i\n", fast_timers_started);
514 used = 0; 508 seq_printf(m, "Fast timer interrupts: %i\n", fast_timer_ints);
515 if (buf) 509 seq_printf(m, "Fast timers expired: %i\n", fast_timers_expired);
516 buf[0] = '\0'; 510 seq_printf(m, "Fast timers deleted: %i\n", fast_timers_deleted);
517 return 0; 511 seq_printf(m, "Fast timer running: %s\n",
518 } 512 fast_timer_running ? "yes" : "no");
519 513 seq_printf(m, "Current time: %lu.%06lu\n",
520 if (!offset || !used) 514 (unsigned long)tv.tv_jiff,
521 { 515 (unsigned long)tv.tv_usec);
522 do_gettimeofday_fast(&tv);
523
524 used = 0;
525 used += sprintf(bigbuf + used, "Fast timers added: %i\n",
526 fast_timers_added);
527 used += sprintf(bigbuf + used, "Fast timers started: %i\n",
528 fast_timers_started);
529 used += sprintf(bigbuf + used, "Fast timer interrupts: %i\n",
530 fast_timer_ints);
531 used += sprintf(bigbuf + used, "Fast timers expired: %i\n",
532 fast_timers_expired);
533 used += sprintf(bigbuf + used, "Fast timers deleted: %i\n",
534 fast_timers_deleted);
535 used += sprintf(bigbuf + used, "Fast timer running: %s\n",
536 fast_timer_running ? "yes" : "no");
537 used += sprintf(bigbuf + used, "Current time: %lu.%06lu\n",
538 (unsigned long)tv.tv_jiff,
539 (unsigned long)tv.tv_usec);
540#ifdef FAST_TIMER_SANITY_CHECKS 516#ifdef FAST_TIMER_SANITY_CHECKS
541 used += sprintf(bigbuf + used, "Sanity failed: %i\n", 517 seq_printf(m, "Sanity failed: %i\n", sanity_failed);
542 sanity_failed);
543#endif 518#endif
544 used += sprintf(bigbuf + used, "\n"); 519 seq_putc(m, '\n');
545 520
546#ifdef DEBUG_LOG_INCLUDED 521#ifdef DEBUG_LOG_INCLUDED
547 { 522 {
548 int end_i = debug_log_cnt; 523 int end_i = debug_log_cnt;
549 i = 0; 524 i = 0;
550 525
551 if (debug_log_cnt_wrapped) 526 if (debug_log_cnt_wrapped)
552 { 527 i = debug_log_cnt;
553 i = debug_log_cnt; 528
554 } 529 while (i != end_i || debug_log_cnt_wrapped) {
555 530 if (seq_printf(m, debug_log_string[i], debug_log_value[i]) < 0)
556 while ((i != end_i || (debug_log_cnt_wrapped && !used)) && 531 return 0;
557 used+100 < BIG_BUF_SIZE) 532 i = (i+1) % DEBUG_LOG_MAX;
558 { 533 }
559 used += sprintf(bigbuf + used, debug_log_string[i], 534 }
560 debug_log_value[i]); 535 seq_putc(m, '\n');
561 i = (i+1) % DEBUG_LOG_MAX;
562 }
563 }
564 used += sprintf(bigbuf + used, "\n");
565#endif 536#endif
566 537
567 num_to_show = (fast_timers_started < NUM_TIMER_STATS ? fast_timers_started: 538 num_to_show = (fast_timers_started < NUM_TIMER_STATS ? fast_timers_started:
568 NUM_TIMER_STATS); 539 NUM_TIMER_STATS);
569 used += sprintf(bigbuf + used, "Timers started: %i\n", fast_timers_started); 540 seq_printf(m, "Timers started: %i\n", fast_timers_started);
570 for (i = 0; i < num_to_show && (used+100 < BIG_BUF_SIZE) ; i++) 541 for (i = 0; i < num_to_show; i++) {
571 { 542 int cur = (fast_timers_started - i - 1) % NUM_TIMER_STATS;
572 int cur = (fast_timers_started - i - 1) % NUM_TIMER_STATS;
573 543
574#if 1 //ndef FAST_TIMER_LOG 544#if 1 //ndef FAST_TIMER_LOG
575 used += sprintf(bigbuf + used, "div: %i freq: %i delay: %i" 545 seq_printf(m, "div: %i freq: %i delay: %i"
576 "\n", 546 "\n",
577 timer_div_settings[cur], 547 timer_div_settings[cur],
578 timer_freq_settings[cur], 548 timer_freq_settings[cur],
579 timer_delay_settings[cur] 549 timer_delay_settings[cur]);
580 );
581#endif 550#endif
582#ifdef FAST_TIMER_LOG 551#ifdef FAST_TIMER_LOG
583 t = &timer_started_log[cur]; 552 t = &timer_started_log[cur];
584 used += sprintf(bigbuf + used, "%-14s s: %6lu.%06lu e: %6lu.%06lu " 553 if (seq_printf(m, "%-14s s: %6lu.%06lu e: %6lu.%06lu "
585 "d: %6li us data: 0x%08lX" 554 "d: %6li us data: 0x%08lX"
586 "\n", 555 "\n",
587 t->name, 556 t->name,
588 (unsigned long)t->tv_set.tv_jiff, 557 (unsigned long)t->tv_set.tv_jiff,
589 (unsigned long)t->tv_set.tv_usec, 558 (unsigned long)t->tv_set.tv_usec,
590 (unsigned long)t->tv_expires.tv_jiff, 559 (unsigned long)t->tv_expires.tv_jiff,
591 (unsigned long)t->tv_expires.tv_usec, 560 (unsigned long)t->tv_expires.tv_usec,
592 t->delay_us, 561 t->delay_us,
593 t->data 562 t->data) < 0)
594 ); 563 return 0;
595#endif 564#endif
596 } 565 }
597 used += sprintf(bigbuf + used, "\n"); 566 seq_putc(m, '\n');
598 567
599#ifdef FAST_TIMER_LOG 568#ifdef FAST_TIMER_LOG
600 num_to_show = (fast_timers_added < NUM_TIMER_STATS ? fast_timers_added: 569 num_to_show = (fast_timers_added < NUM_TIMER_STATS ? fast_timers_added:
601 NUM_TIMER_STATS); 570 NUM_TIMER_STATS);
602 used += sprintf(bigbuf + used, "Timers added: %i\n", fast_timers_added); 571 seq_printf(m, "Timers added: %i\n", fast_timers_added);
603 for (i = 0; i < num_to_show && (used+100 < BIG_BUF_SIZE); i++) 572 for (i = 0; i < num_to_show; i++) {
604 { 573 t = &timer_added_log[(fast_timers_added - i - 1) % NUM_TIMER_STATS];
605 t = &timer_added_log[(fast_timers_added - i - 1) % NUM_TIMER_STATS]; 574 if (seq_printf(m, "%-14s s: %6lu.%06lu e: %6lu.%06lu "
606 used += sprintf(bigbuf + used, "%-14s s: %6lu.%06lu e: %6lu.%06lu " 575 "d: %6li us data: 0x%08lX"
607 "d: %6li us data: 0x%08lX" 576 "\n",
608 "\n", 577 t->name,
609 t->name, 578 (unsigned long)t->tv_set.tv_jiff,
610 (unsigned long)t->tv_set.tv_jiff, 579 (unsigned long)t->tv_set.tv_usec,
611 (unsigned long)t->tv_set.tv_usec, 580 (unsigned long)t->tv_expires.tv_jiff,
612 (unsigned long)t->tv_expires.tv_jiff, 581 (unsigned long)t->tv_expires.tv_usec,
613 (unsigned long)t->tv_expires.tv_usec, 582 t->delay_us,
614 t->delay_us, 583 t->data) < 0)
615 t->data 584 return 0;
616 ); 585 }
617 } 586 seq_putc(m, '\n');
618 used += sprintf(bigbuf + used, "\n"); 587
619 588 num_to_show = (fast_timers_expired < NUM_TIMER_STATS ? fast_timers_expired:
620 num_to_show = (fast_timers_expired < NUM_TIMER_STATS ? fast_timers_expired: 589 NUM_TIMER_STATS);
621 NUM_TIMER_STATS); 590 seq_printf(m, "Timers expired: %i\n", fast_timers_expired);
622 used += sprintf(bigbuf + used, "Timers expired: %i\n", fast_timers_expired); 591 for (i = 0; i < num_to_show; i++) {
623 for (i = 0; i < num_to_show && (used+100 < BIG_BUF_SIZE); i++) 592 t = &timer_expired_log[(fast_timers_expired - i - 1) % NUM_TIMER_STATS];
624 { 593 if (seq_printf(m, "%-14s s: %6lu.%06lu e: %6lu.%06lu "
625 t = &timer_expired_log[(fast_timers_expired - i - 1) % NUM_TIMER_STATS]; 594 "d: %6li us data: 0x%08lX"
626 used += sprintf(bigbuf + used, "%-14s s: %6lu.%06lu e: %6lu.%06lu " 595 "\n",
627 "d: %6li us data: 0x%08lX" 596 t->name,
628 "\n", 597 (unsigned long)t->tv_set.tv_jiff,
629 t->name, 598 (unsigned long)t->tv_set.tv_usec,
630 (unsigned long)t->tv_set.tv_jiff, 599 (unsigned long)t->tv_expires.tv_jiff,
631 (unsigned long)t->tv_set.tv_usec, 600 (unsigned long)t->tv_expires.tv_usec,
632 (unsigned long)t->tv_expires.tv_jiff, 601 t->delay_us,
633 (unsigned long)t->tv_expires.tv_usec, 602 t->data) < 0)
634 t->delay_us, 603 return 0;
635 t->data 604 }
636 ); 605 seq_putc(m, '\n');
637 }
638 used += sprintf(bigbuf + used, "\n");
639#endif 606#endif
640 607
641 used += sprintf(bigbuf + used, "Active timers:\n"); 608 seq_puts(m, "Active timers:\n");
642 local_irq_save(flags); 609 local_irq_save(flags);
643 t = fast_timer_list; 610 t = fast_timer_list;
644 while (t != NULL && (used+100 < BIG_BUF_SIZE)) 611 while (t) {
645 { 612 nextt = t->next;
646 nextt = t->next; 613 local_irq_restore(flags);
647 local_irq_restore(flags); 614 if (seq_printf(m, "%-14s s: %6lu.%06lu e: %6lu.%06lu "
648 used += sprintf(bigbuf + used, "%-14s s: %6lu.%06lu e: %6lu.%06lu " 615 "d: %6li us data: 0x%08lX"
649 "d: %6li us data: 0x%08lX"
650/* " func: 0x%08lX" */ 616/* " func: 0x%08lX" */
651 "\n", 617 "\n",
652 t->name, 618 t->name,
653 (unsigned long)t->tv_set.tv_jiff, 619 (unsigned long)t->tv_set.tv_jiff,
654 (unsigned long)t->tv_set.tv_usec, 620 (unsigned long)t->tv_set.tv_usec,
655 (unsigned long)t->tv_expires.tv_jiff, 621 (unsigned long)t->tv_expires.tv_jiff,
656 (unsigned long)t->tv_expires.tv_usec, 622 (unsigned long)t->tv_expires.tv_usec,
657 t->delay_us, 623 t->delay_us,
658 t->data 624 t->data
659/* , t->function */ 625/* , t->function */
660 ); 626 ) < 0)
661 local_irq_save(flags); 627 return 0;
662 if (t->next != nextt) 628 local_irq_save(flags);
663 { 629 if (t->next != nextt)
664 printk(KERN_WARNING "timer removed!\n"); 630 printk(KERN_WARNING "timer removed!\n");
665 } 631 t = nextt;
666 t = nextt; 632 }
667 } 633 local_irq_restore(flags);
668 local_irq_restore(flags);
669 }
670
671 if (used - offset < len)
672 {
673 len = used - offset;
674 }
675 634
676 memcpy(buf, bigbuf + offset, len); 635 return 0;
677 *start = buf; 636}
678 *eof = 1;
679 637
680 return len; 638static int proc_fasttimer_open(struct inode *inode, struct file *file)
639{
640 return single_open_size(file, proc_fasttimer_show, PDE_DATA(inode), BIG_BUF_SIZE);
681} 641}
642
643static const struct file_operations proc_fasttimer_fops = {
644 .open = proc_fasttimer_open,
645 .read = seq_read,
646 .llseek = seq_lseek,
647 .release = seq_release,
648};
682#endif /* PROC_FS */ 649#endif /* PROC_FS */
683 650
684#ifdef FAST_TIMER_TEST 651#ifdef FAST_TIMER_TEST
@@ -856,7 +823,7 @@ int fast_timer_init(void)
856 } 823 }
857#endif 824#endif
858#ifdef CONFIG_PROC_FS 825#ifdef CONFIG_PROC_FS
859 create_proc_read_entry("fasttimer", 0, NULL, proc_fasttimer_read, NULL); 826 proc_create("fasttimer", 0, NULL, &proc_fasttimer_fops);
860#endif /* PROC_FS */ 827#endif /* PROC_FS */
861 if(request_irq(TIMER1_IRQ_NBR, timer1_handler, 0, 828 if(request_irq(TIMER1_IRQ_NBR, timer1_handler, 0,
862 "fast timer int", NULL)) 829 "fast timer int", NULL))
diff --git a/arch/cris/arch-v32/kernel/fasttimer.c b/arch/cris/arch-v32/kernel/fasttimer.c
index dd1c998070e9..e43dd70acd96 100644
--- a/arch/cris/arch-v32/kernel/fasttimer.c
+++ b/arch/cris/arch-v32/kernel/fasttimer.c
@@ -23,6 +23,7 @@
23#include <hwregs/timer_defs.h> 23#include <hwregs/timer_defs.h>
24#include <asm/fasttimer.h> 24#include <asm/fasttimer.h>
25#include <linux/proc_fs.h> 25#include <linux/proc_fs.h>
26#include <linux/seq_file.h>
26 27
27/* 28/*
28 * timer0 is running at 100MHz and generating jiffies timer ticks 29 * timer0 is running at 100MHz and generating jiffies timer ticks
@@ -463,194 +464,161 @@ void schedule_usleep(unsigned long us)
463} 464}
464 465
465#ifdef CONFIG_PROC_FS 466#ifdef CONFIG_PROC_FS
466static int proc_fasttimer_read(char *buf, char **start, off_t offset, int len
467 ,int *eof, void *data_unused);
468#endif /* CONFIG_PROC_FS */
469
470#ifdef CONFIG_PROC_FS
471
472/* This value is very much based on testing */ 467/* This value is very much based on testing */
473#define BIG_BUF_SIZE (500 + NUM_TIMER_STATS * 300) 468#define BIG_BUF_SIZE (500 + NUM_TIMER_STATS * 300)
474 469
475static int proc_fasttimer_read(char *buf, char **start, off_t offset, int len 470static int proc_fasttimer_show(struct seq_file *m, void *v)
476 ,int *eof, void *data_unused)
477{ 471{
478 unsigned long flags; 472 unsigned long flags;
479 int i = 0; 473 int i = 0;
480 int num_to_show; 474 int num_to_show;
481 struct fasttime_t tv; 475 struct fasttime_t tv;
482 struct fast_timer *t, *nextt; 476 struct fast_timer *t, *nextt;
483 static char *bigbuf = NULL; 477
484 static unsigned long used; 478 do_gettimeofday_fast(&tv);
485 479
486 if (!bigbuf) { 480 seq_printf(m, "Fast timers added: %i\n", fast_timers_added);
487 bigbuf = vmalloc(BIG_BUF_SIZE); 481 seq_printf(m, "Fast timers started: %i\n", fast_timers_started);
488 if (!bigbuf) { 482 seq_printf(m, "Fast timer interrupts: %i\n", fast_timer_ints);
489 used = 0; 483 seq_printf(m, "Fast timers expired: %i\n", fast_timers_expired);
490 if (buf) 484 seq_printf(m, "Fast timers deleted: %i\n", fast_timers_deleted);
491 buf[0] = '\0'; 485 seq_printf(m, "Fast timer running: %s\n",
492 return 0; 486 fast_timer_running ? "yes" : "no");
493 } 487 seq_printf(m, "Current time: %lu.%06lu\n",
494 } 488 (unsigned long)tv.tv_jiff,
495 489 (unsigned long)tv.tv_usec);
496 if (!offset || !used) {
497 do_gettimeofday_fast(&tv);
498
499 used = 0;
500 used += sprintf(bigbuf + used, "Fast timers added: %i\n",
501 fast_timers_added);
502 used += sprintf(bigbuf + used, "Fast timers started: %i\n",
503 fast_timers_started);
504 used += sprintf(bigbuf + used, "Fast timer interrupts: %i\n",
505 fast_timer_ints);
506 used += sprintf(bigbuf + used, "Fast timers expired: %i\n",
507 fast_timers_expired);
508 used += sprintf(bigbuf + used, "Fast timers deleted: %i\n",
509 fast_timers_deleted);
510 used += sprintf(bigbuf + used, "Fast timer running: %s\n",
511 fast_timer_running ? "yes" : "no");
512 used += sprintf(bigbuf + used, "Current time: %lu.%06lu\n",
513 (unsigned long)tv.tv_jiff,
514 (unsigned long)tv.tv_usec);
515#ifdef FAST_TIMER_SANITY_CHECKS 490#ifdef FAST_TIMER_SANITY_CHECKS
516 used += sprintf(bigbuf + used, "Sanity failed: %i\n", 491 seq_printf(m, "Sanity failed: %i\n", sanity_failed);
517 sanity_failed);
518#endif 492#endif
519 used += sprintf(bigbuf + used, "\n"); 493 seq_putc(m, '\n');
520 494
521#ifdef DEBUG_LOG_INCLUDED 495#ifdef DEBUG_LOG_INCLUDED
522 { 496 {
523 int end_i = debug_log_cnt; 497 int end_i = debug_log_cnt;
524 i = 0; 498 i = 0;
525 499
526 if (debug_log_cnt_wrapped) 500 if (debug_log_cnt_wrapped)
527 i = debug_log_cnt; 501 i = debug_log_cnt;
528 502
529 while ((i != end_i || (debug_log_cnt_wrapped && !used)) && 503 while ((i != end_i || debug_log_cnt_wrapped)) {
530 used+100 < BIG_BUF_SIZE) 504 if (seq_printf(m, debug_log_string[i], debug_log_value[i]) < 0)
531 { 505 return 0;
532 used += sprintf(bigbuf + used, debug_log_string[i], 506 i = (i+1) % DEBUG_LOG_MAX;
533 debug_log_value[i]); 507 }
534 i = (i+1) % DEBUG_LOG_MAX; 508 }
535 } 509 seq_putc(m, '\n');
536 }
537 used += sprintf(bigbuf + used, "\n");
538#endif 510#endif
539 511
540 num_to_show = (fast_timers_started < NUM_TIMER_STATS ? fast_timers_started: 512 num_to_show = (fast_timers_started < NUM_TIMER_STATS ? fast_timers_started:
541 NUM_TIMER_STATS); 513 NUM_TIMER_STATS);
542 used += sprintf(bigbuf + used, "Timers started: %i\n", fast_timers_started); 514 seq_printf(m, "Timers started: %i\n", fast_timers_started);
543 for (i = 0; i < num_to_show && (used+100 < BIG_BUF_SIZE) ; i++) 515 for (i = 0; i < num_to_show; i++) {
544 { 516 int cur = (fast_timers_started - i - 1) % NUM_TIMER_STATS;
545 int cur = (fast_timers_started - i - 1) % NUM_TIMER_STATS;
546 517
547#if 1 //ndef FAST_TIMER_LOG 518#if 1 //ndef FAST_TIMER_LOG
548 used += sprintf(bigbuf + used, "div: %i delay: %i" 519 seq_printf(m, "div: %i delay: %i"
549 "\n", 520 "\n",
550 timer_div_settings[cur], 521 timer_div_settings[cur],
551 timer_delay_settings[cur] 522 timer_delay_settings[cur]);
552 );
553#endif 523#endif
554#ifdef FAST_TIMER_LOG 524#ifdef FAST_TIMER_LOG
555 t = &timer_started_log[cur]; 525 t = &timer_started_log[cur];
556 used += sprintf(bigbuf + used, "%-14s s: %6lu.%06lu e: %6lu.%06lu " 526 if (seq_printf(m, "%-14s s: %6lu.%06lu e: %6lu.%06lu "
557 "d: %6li us data: 0x%08lX" 527 "d: %6li us data: 0x%08lX"
558 "\n", 528 "\n",
559 t->name, 529 t->name,
560 (unsigned long)t->tv_set.tv_jiff, 530 (unsigned long)t->tv_set.tv_jiff,
561 (unsigned long)t->tv_set.tv_usec, 531 (unsigned long)t->tv_set.tv_usec,
562 (unsigned long)t->tv_expires.tv_jiff, 532 (unsigned long)t->tv_expires.tv_jiff,
563 (unsigned long)t->tv_expires.tv_usec, 533 (unsigned long)t->tv_expires.tv_usec,
564 t->delay_us, 534 t->delay_us,
565 t->data 535 t->data) < 0)
566 ); 536 return 0;
567#endif 537#endif
568 } 538 }
569 used += sprintf(bigbuf + used, "\n"); 539 seq_putc(m, '\n');
570 540
571#ifdef FAST_TIMER_LOG 541#ifdef FAST_TIMER_LOG
572 num_to_show = (fast_timers_added < NUM_TIMER_STATS ? fast_timers_added: 542 num_to_show = (fast_timers_added < NUM_TIMER_STATS ? fast_timers_added:
573 NUM_TIMER_STATS); 543 NUM_TIMER_STATS);
574 used += sprintf(bigbuf + used, "Timers added: %i\n", fast_timers_added); 544 seq_printf(m, "Timers added: %i\n", fast_timers_added);
575 for (i = 0; i < num_to_show && (used+100 < BIG_BUF_SIZE); i++) 545 for (i = 0; i < num_to_show; i++) {
576 { 546 t = &timer_added_log[(fast_timers_added - i - 1) % NUM_TIMER_STATS];
577 t = &timer_added_log[(fast_timers_added - i - 1) % NUM_TIMER_STATS]; 547 if (seq_printf(m, "%-14s s: %6lu.%06lu e: %6lu.%06lu "
578 used += sprintf(bigbuf + used, "%-14s s: %6lu.%06lu e: %6lu.%06lu " 548 "d: %6li us data: 0x%08lX"
579 "d: %6li us data: 0x%08lX" 549 "\n",
580 "\n", 550 t->name,
581 t->name, 551 (unsigned long)t->tv_set.tv_jiff,
582 (unsigned long)t->tv_set.tv_jiff, 552 (unsigned long)t->tv_set.tv_usec,
583 (unsigned long)t->tv_set.tv_usec, 553 (unsigned long)t->tv_expires.tv_jiff,
584 (unsigned long)t->tv_expires.tv_jiff, 554 (unsigned long)t->tv_expires.tv_usec,
585 (unsigned long)t->tv_expires.tv_usec, 555 t->delay_us,
586 t->delay_us, 556 t->data) < 0)
587 t->data 557 return 0;
588 ); 558 }
589 } 559 seq_putc(m, '\n');
590 used += sprintf(bigbuf + used, "\n"); 560
591 561 num_to_show = (fast_timers_expired < NUM_TIMER_STATS ? fast_timers_expired:
592 num_to_show = (fast_timers_expired < NUM_TIMER_STATS ? fast_timers_expired: 562 NUM_TIMER_STATS);
593 NUM_TIMER_STATS); 563 seq_printf(m, "Timers expired: %i\n", fast_timers_expired);
594 used += sprintf(bigbuf + used, "Timers expired: %i\n", fast_timers_expired); 564 for (i = 0; i < num_to_show; i++){
595 for (i = 0; i < num_to_show && (used+100 < BIG_BUF_SIZE); i++) 565 t = &timer_expired_log[(fast_timers_expired - i - 1) % NUM_TIMER_STATS];
596 { 566 if (seq_printf(m, "%-14s s: %6lu.%06lu e: %6lu.%06lu "
597 t = &timer_expired_log[(fast_timers_expired - i - 1) % NUM_TIMER_STATS]; 567 "d: %6li us data: 0x%08lX"
598 used += sprintf(bigbuf + used, "%-14s s: %6lu.%06lu e: %6lu.%06lu " 568 "\n",
599 "d: %6li us data: 0x%08lX" 569 t->name,
600 "\n", 570 (unsigned long)t->tv_set.tv_jiff,
601 t->name, 571 (unsigned long)t->tv_set.tv_usec,
602 (unsigned long)t->tv_set.tv_jiff, 572 (unsigned long)t->tv_expires.tv_jiff,
603 (unsigned long)t->tv_set.tv_usec, 573 (unsigned long)t->tv_expires.tv_usec,
604 (unsigned long)t->tv_expires.tv_jiff, 574 t->delay_us,
605 (unsigned long)t->tv_expires.tv_usec, 575 t->data) < 0)
606 t->delay_us, 576 return 0;
607 t->data 577 }
608 ); 578 seq_putc(m, '\n');
609 }
610 used += sprintf(bigbuf + used, "\n");
611#endif 579#endif
612 580
613 used += sprintf(bigbuf + used, "Active timers:\n"); 581 seq_puts(m, "Active timers:\n");
614 local_irq_save(flags); 582 local_irq_save(flags);
615 t = fast_timer_list; 583 t = fast_timer_list;
616 while (t != NULL && (used+100 < BIG_BUF_SIZE)) 584 while (t != NULL){
617 { 585 nextt = t->next;
618 nextt = t->next; 586 local_irq_restore(flags);
619 local_irq_restore(flags); 587 if (seq_printf(m, "%-14s s: %6lu.%06lu e: %6lu.%06lu "
620 used += sprintf(bigbuf + used, "%-14s s: %6lu.%06lu e: %6lu.%06lu " 588 "d: %6li us data: 0x%08lX"
621 "d: %6li us data: 0x%08lX"
622/* " func: 0x%08lX" */ 589/* " func: 0x%08lX" */
623 "\n", 590 "\n",
624 t->name, 591 t->name,
625 (unsigned long)t->tv_set.tv_jiff, 592 (unsigned long)t->tv_set.tv_jiff,
626 (unsigned long)t->tv_set.tv_usec, 593 (unsigned long)t->tv_set.tv_usec,
627 (unsigned long)t->tv_expires.tv_jiff, 594 (unsigned long)t->tv_expires.tv_jiff,
628 (unsigned long)t->tv_expires.tv_usec, 595 (unsigned long)t->tv_expires.tv_usec,
629 t->delay_us, 596 t->delay_us,
630 t->data 597 t->data
631/* , t->function */ 598/* , t->function */
632 ); 599 ) < 0)
633 local_irq_save(flags); 600 return 0;
634 if (t->next != nextt) 601 local_irq_save(flags);
635 { 602 if (t->next != nextt)
636 printk("timer removed!\n"); 603 printk("timer removed!\n");
637 } 604 t = nextt;
638 t = nextt; 605 }
639 } 606 local_irq_restore(flags);
640 local_irq_restore(flags); 607 return 0;
641 } 608}
642 609
643 if (used - offset < len) 610static int proc_fasttimer_open(struct inode *inode, struct file *file)
644 { 611{
645 len = used - offset; 612 return single_open_size(file, proc_fasttimer_show, PDE_DATA(inode), BIG_BUF_SIZE);
646 } 613}
647 614
648 memcpy(buf, bigbuf + offset, len); 615static const struct file_operations proc_fasttimer_fops = {
649 *start = buf; 616 .open = proc_fasttimer_open,
650 *eof = 1; 617 .read = seq_read,
618 .llseek = seq_lseek,
619 .release = seq_release,
620};
651 621
652 return len;
653}
654#endif /* PROC_FS */ 622#endif /* PROC_FS */
655 623
656#ifdef FAST_TIMER_TEST 624#ifdef FAST_TIMER_TEST
@@ -815,7 +783,7 @@ int fast_timer_init(void)
815 printk("fast_timer_init()\n"); 783 printk("fast_timer_init()\n");
816 784
817#ifdef CONFIG_PROC_FS 785#ifdef CONFIG_PROC_FS
818 create_proc_read_entry("fasttimer", 0, NULL, proc_fasttimer_read, NULL); 786 proc_create("fasttimer", 0, NULL, &proc_fasttimer_fops);
819#endif /* PROC_FS */ 787#endif /* PROC_FS */
820 if (request_irq(TIMER0_INTR_VECT, timer_trig_interrupt, 788 if (request_irq(TIMER0_INTR_VECT, timer_trig_interrupt,
821 IRQF_SHARED | IRQF_DISABLED, 789 IRQF_SHARED | IRQF_DISABLED,