diff options
author | Linus Torvalds <torvalds@linux-foundation.org> | 2013-05-01 20:51:54 -0400 |
---|---|---|
committer | Linus Torvalds <torvalds@linux-foundation.org> | 2013-05-01 20:51:54 -0400 |
commit | 20b4fb485227404329e41ad15588afad3df23050 (patch) | |
tree | f3e099f0ab3da8a93b447203e294d2bb22f6dc05 /arch/cris | |
parent | b9394d8a657cd3c064fa432aa0905c1b58b38fe9 (diff) | |
parent | ac3e3c5b1164397656df81b9e9ab4991184d3236 (diff) |
Merge branch 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/viro/vfs
Pull VFS updates from Al Viro,
Misc cleanups all over the place, mainly wrt /proc interfaces (switch
create_proc_entry to proc_create(), get rid of the deprecated
create_proc_read_entry() in favor of using proc_create_data() and
seq_file etc).
7kloc removed.
* 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/viro/vfs: (204 commits)
don't bother with deferred freeing of fdtables
proc: Move non-public stuff from linux/proc_fs.h to fs/proc/internal.h
proc: Make the PROC_I() and PDE() macros internal to procfs
proc: Supply a function to remove a proc entry by PDE
take cgroup_open() and cpuset_open() to fs/proc/base.c
ppc: Clean up scanlog
ppc: Clean up rtas_flash driver somewhat
hostap: proc: Use remove_proc_subtree()
drm: proc: Use remove_proc_subtree()
drm: proc: Use minor->index to label things, not PDE->name
drm: Constify drm_proc_list[]
zoran: Don't print proc_dir_entry data in debug
reiserfs: Don't access the proc_dir_entry in r_open(), r_start() r_show()
proc: Supply an accessor for getting the data from a PDE's parent
airo: Use remove_proc_subtree()
rtl8192u: Don't need to save device proc dir PDE
rtl8187se: Use a dir under /proc/net/r8180/
proc: Add proc_mkdir_data()
proc: Move some bits from linux/proc_fs.h to linux/{of.h,signal.h,tty.h}
proc: Move PDE_NET() to fs/proc/proc_net.c
...
Diffstat (limited to 'arch/cris')
-rw-r--r-- | arch/cris/arch-v10/kernel/fasttimer.c | 301 | ||||
-rw-r--r-- | arch/cris/arch-v32/kernel/fasttimer.c | 299 |
2 files changed, 265 insertions, 335 deletions
diff --git a/arch/cris/arch-v10/kernel/fasttimer.c b/arch/cris/arch-v10/kernel/fasttimer.c index 082f1890bacb..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,197 +490,162 @@ void schedule_usleep(unsigned long us) | |||
489 | } | 490 | } |
490 | 491 | ||
491 | #ifdef CONFIG_PROC_FS | 492 | #ifdef CONFIG_PROC_FS |
492 | static int proc_fasttimer_read(char *buf, char **start, off_t offset, int len | ||
493 | ,int *eof, void *data_unused); | ||
494 | static struct proc_dir_entry *fasttimer_proc_entry; | ||
495 | #endif /* CONFIG_PROC_FS */ | ||
496 | |||
497 | #ifdef CONFIG_PROC_FS | ||
498 | |||
499 | /* This value is very much based on testing */ | 493 | /* This value is very much based on testing */ |
500 | #define BIG_BUF_SIZE (500 + NUM_TIMER_STATS * 300) | 494 | #define BIG_BUF_SIZE (500 + NUM_TIMER_STATS * 300) |
501 | 495 | ||
502 | static int proc_fasttimer_read(char *buf, char **start, off_t offset, int len | 496 | static int proc_fasttimer_show(struct seq_file *m, void *v) |
503 | ,int *eof, void *data_unused) | ||
504 | { | 497 | { |
505 | unsigned long flags; | 498 | unsigned long flags; |
506 | int i = 0; | 499 | int i = 0; |
507 | int num_to_show; | 500 | int num_to_show; |
508 | struct fasttime_t tv; | 501 | struct fasttime_t tv; |
509 | struct fast_timer *t, *nextt; | 502 | struct fast_timer *t, *nextt; |
510 | static char *bigbuf = NULL; | 503 | |
511 | static unsigned long used; | 504 | do_gettimeofday_fast(&tv); |
512 | 505 | ||
513 | if (!bigbuf && !(bigbuf = vmalloc(BIG_BUF_SIZE))) | 506 | seq_printf(m, "Fast timers added: %i\n", fast_timers_added); |
514 | { | 507 | seq_printf(m, "Fast timers started: %i\n", fast_timers_started); |
515 | used = 0; | 508 | seq_printf(m, "Fast timer interrupts: %i\n", fast_timer_ints); |
516 | if (buf) | 509 | seq_printf(m, "Fast timers expired: %i\n", fast_timers_expired); |
517 | buf[0] = '\0'; | 510 | seq_printf(m, "Fast timers deleted: %i\n", fast_timers_deleted); |
518 | return 0; | 511 | seq_printf(m, "Fast timer running: %s\n", |
519 | } | 512 | fast_timer_running ? "yes" : "no"); |
520 | 513 | seq_printf(m, "Current time: %lu.%06lu\n", | |
521 | if (!offset || !used) | 514 | (unsigned long)tv.tv_jiff, |
522 | { | 515 | (unsigned long)tv.tv_usec); |
523 | do_gettimeofday_fast(&tv); | ||
524 | |||
525 | used = 0; | ||
526 | used += sprintf(bigbuf + used, "Fast timers added: %i\n", | ||
527 | fast_timers_added); | ||
528 | used += sprintf(bigbuf + used, "Fast timers started: %i\n", | ||
529 | fast_timers_started); | ||
530 | used += sprintf(bigbuf + used, "Fast timer interrupts: %i\n", | ||
531 | fast_timer_ints); | ||
532 | used += sprintf(bigbuf + used, "Fast timers expired: %i\n", | ||
533 | fast_timers_expired); | ||
534 | used += sprintf(bigbuf + used, "Fast timers deleted: %i\n", | ||
535 | fast_timers_deleted); | ||
536 | used += sprintf(bigbuf + used, "Fast timer running: %s\n", | ||
537 | fast_timer_running ? "yes" : "no"); | ||
538 | used += sprintf(bigbuf + used, "Current time: %lu.%06lu\n", | ||
539 | (unsigned long)tv.tv_jiff, | ||
540 | (unsigned long)tv.tv_usec); | ||
541 | #ifdef FAST_TIMER_SANITY_CHECKS | 516 | #ifdef FAST_TIMER_SANITY_CHECKS |
542 | used += sprintf(bigbuf + used, "Sanity failed: %i\n", | 517 | seq_printf(m, "Sanity failed: %i\n", sanity_failed); |
543 | sanity_failed); | ||
544 | #endif | 518 | #endif |
545 | used += sprintf(bigbuf + used, "\n"); | 519 | seq_putc(m, '\n'); |
546 | 520 | ||
547 | #ifdef DEBUG_LOG_INCLUDED | 521 | #ifdef DEBUG_LOG_INCLUDED |
548 | { | 522 | { |
549 | int end_i = debug_log_cnt; | 523 | int end_i = debug_log_cnt; |
550 | i = 0; | 524 | i = 0; |
551 | 525 | ||
552 | if (debug_log_cnt_wrapped) | 526 | if (debug_log_cnt_wrapped) |
553 | { | 527 | i = debug_log_cnt; |
554 | i = debug_log_cnt; | 528 | |
555 | } | 529 | while (i != end_i || debug_log_cnt_wrapped) { |
556 | 530 | if (seq_printf(m, debug_log_string[i], debug_log_value[i]) < 0) | |
557 | while ((i != end_i || (debug_log_cnt_wrapped && !used)) && | 531 | return 0; |
558 | used+100 < BIG_BUF_SIZE) | 532 | i = (i+1) % DEBUG_LOG_MAX; |
559 | { | 533 | } |
560 | used += sprintf(bigbuf + used, debug_log_string[i], | 534 | } |
561 | debug_log_value[i]); | 535 | seq_putc(m, '\n'); |
562 | i = (i+1) % DEBUG_LOG_MAX; | ||
563 | } | ||
564 | } | ||
565 | used += sprintf(bigbuf + used, "\n"); | ||
566 | #endif | 536 | #endif |
567 | 537 | ||
568 | 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: |
569 | NUM_TIMER_STATS); | 539 | NUM_TIMER_STATS); |
570 | used += sprintf(bigbuf + used, "Timers started: %i\n", fast_timers_started); | 540 | seq_printf(m, "Timers started: %i\n", fast_timers_started); |
571 | for (i = 0; i < num_to_show && (used+100 < BIG_BUF_SIZE) ; i++) | 541 | for (i = 0; i < num_to_show; i++) { |
572 | { | 542 | int cur = (fast_timers_started - i - 1) % NUM_TIMER_STATS; |
573 | int cur = (fast_timers_started - i - 1) % NUM_TIMER_STATS; | ||
574 | 543 | ||
575 | #if 1 //ndef FAST_TIMER_LOG | 544 | #if 1 //ndef FAST_TIMER_LOG |
576 | used += sprintf(bigbuf + used, "div: %i freq: %i delay: %i" | 545 | seq_printf(m, "div: %i freq: %i delay: %i" |
577 | "\n", | 546 | "\n", |
578 | timer_div_settings[cur], | 547 | timer_div_settings[cur], |
579 | timer_freq_settings[cur], | 548 | timer_freq_settings[cur], |
580 | timer_delay_settings[cur] | 549 | timer_delay_settings[cur]); |
581 | ); | ||
582 | #endif | 550 | #endif |
583 | #ifdef FAST_TIMER_LOG | 551 | #ifdef FAST_TIMER_LOG |
584 | t = &timer_started_log[cur]; | 552 | t = &timer_started_log[cur]; |
585 | used += sprintf(bigbuf + used, "%-14s s: %6lu.%06lu e: %6lu.%06lu " | 553 | if (seq_printf(m, "%-14s s: %6lu.%06lu e: %6lu.%06lu " |
586 | "d: %6li us data: 0x%08lX" | 554 | "d: %6li us data: 0x%08lX" |
587 | "\n", | 555 | "\n", |
588 | t->name, | 556 | t->name, |
589 | (unsigned long)t->tv_set.tv_jiff, | 557 | (unsigned long)t->tv_set.tv_jiff, |
590 | (unsigned long)t->tv_set.tv_usec, | 558 | (unsigned long)t->tv_set.tv_usec, |
591 | (unsigned long)t->tv_expires.tv_jiff, | 559 | (unsigned long)t->tv_expires.tv_jiff, |
592 | (unsigned long)t->tv_expires.tv_usec, | 560 | (unsigned long)t->tv_expires.tv_usec, |
593 | t->delay_us, | 561 | t->delay_us, |
594 | t->data | 562 | t->data) < 0) |
595 | ); | 563 | return 0; |
596 | #endif | 564 | #endif |
597 | } | 565 | } |
598 | used += sprintf(bigbuf + used, "\n"); | 566 | seq_putc(m, '\n'); |
599 | 567 | ||
600 | #ifdef FAST_TIMER_LOG | 568 | #ifdef FAST_TIMER_LOG |
601 | 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: |
602 | NUM_TIMER_STATS); | 570 | NUM_TIMER_STATS); |
603 | used += sprintf(bigbuf + used, "Timers added: %i\n", fast_timers_added); | 571 | seq_printf(m, "Timers added: %i\n", fast_timers_added); |
604 | for (i = 0; i < num_to_show && (used+100 < BIG_BUF_SIZE); i++) | 572 | for (i = 0; i < num_to_show; i++) { |
605 | { | 573 | t = &timer_added_log[(fast_timers_added - i - 1) % NUM_TIMER_STATS]; |
606 | t = &timer_added_log[(fast_timers_added - i - 1) % NUM_TIMER_STATS]; | 574 | if (seq_printf(m, "%-14s s: %6lu.%06lu e: %6lu.%06lu " |
607 | used += sprintf(bigbuf + used, "%-14s s: %6lu.%06lu e: %6lu.%06lu " | 575 | "d: %6li us data: 0x%08lX" |
608 | "d: %6li us data: 0x%08lX" | 576 | "\n", |
609 | "\n", | 577 | t->name, |
610 | t->name, | 578 | (unsigned long)t->tv_set.tv_jiff, |
611 | (unsigned long)t->tv_set.tv_jiff, | 579 | (unsigned long)t->tv_set.tv_usec, |
612 | (unsigned long)t->tv_set.tv_usec, | 580 | (unsigned long)t->tv_expires.tv_jiff, |
613 | (unsigned long)t->tv_expires.tv_jiff, | 581 | (unsigned long)t->tv_expires.tv_usec, |
614 | (unsigned long)t->tv_expires.tv_usec, | 582 | t->delay_us, |
615 | t->delay_us, | 583 | t->data) < 0) |
616 | t->data | 584 | return 0; |
617 | ); | 585 | } |
618 | } | 586 | seq_putc(m, '\n'); |
619 | used += sprintf(bigbuf + used, "\n"); | 587 | |
620 | 588 | num_to_show = (fast_timers_expired < NUM_TIMER_STATS ? fast_timers_expired: | |
621 | num_to_show = (fast_timers_expired < NUM_TIMER_STATS ? fast_timers_expired: | 589 | NUM_TIMER_STATS); |
622 | NUM_TIMER_STATS); | 590 | seq_printf(m, "Timers expired: %i\n", fast_timers_expired); |
623 | used += sprintf(bigbuf + used, "Timers expired: %i\n", fast_timers_expired); | 591 | for (i = 0; i < num_to_show; i++) { |
624 | 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]; |
625 | { | 593 | if (seq_printf(m, "%-14s s: %6lu.%06lu e: %6lu.%06lu " |
626 | t = &timer_expired_log[(fast_timers_expired - i - 1) % NUM_TIMER_STATS]; | 594 | "d: %6li us data: 0x%08lX" |
627 | used += sprintf(bigbuf + used, "%-14s s: %6lu.%06lu e: %6lu.%06lu " | 595 | "\n", |
628 | "d: %6li us data: 0x%08lX" | 596 | t->name, |
629 | "\n", | 597 | (unsigned long)t->tv_set.tv_jiff, |
630 | t->name, | 598 | (unsigned long)t->tv_set.tv_usec, |
631 | (unsigned long)t->tv_set.tv_jiff, | 599 | (unsigned long)t->tv_expires.tv_jiff, |
632 | (unsigned long)t->tv_set.tv_usec, | 600 | (unsigned long)t->tv_expires.tv_usec, |
633 | (unsigned long)t->tv_expires.tv_jiff, | 601 | t->delay_us, |
634 | (unsigned long)t->tv_expires.tv_usec, | 602 | t->data) < 0) |
635 | t->delay_us, | 603 | return 0; |
636 | t->data | 604 | } |
637 | ); | 605 | seq_putc(m, '\n'); |
638 | } | ||
639 | used += sprintf(bigbuf + used, "\n"); | ||
640 | #endif | 606 | #endif |
641 | 607 | ||
642 | used += sprintf(bigbuf + used, "Active timers:\n"); | 608 | seq_puts(m, "Active timers:\n"); |
643 | local_irq_save(flags); | 609 | local_irq_save(flags); |
644 | t = fast_timer_list; | 610 | t = fast_timer_list; |
645 | while (t != NULL && (used+100 < BIG_BUF_SIZE)) | 611 | while (t) { |
646 | { | 612 | nextt = t->next; |
647 | nextt = t->next; | 613 | local_irq_restore(flags); |
648 | local_irq_restore(flags); | 614 | if (seq_printf(m, "%-14s s: %6lu.%06lu e: %6lu.%06lu " |
649 | used += sprintf(bigbuf + used, "%-14s s: %6lu.%06lu e: %6lu.%06lu " | 615 | "d: %6li us data: 0x%08lX" |
650 | "d: %6li us data: 0x%08lX" | ||
651 | /* " func: 0x%08lX" */ | 616 | /* " func: 0x%08lX" */ |
652 | "\n", | 617 | "\n", |
653 | t->name, | 618 | t->name, |
654 | (unsigned long)t->tv_set.tv_jiff, | 619 | (unsigned long)t->tv_set.tv_jiff, |
655 | (unsigned long)t->tv_set.tv_usec, | 620 | (unsigned long)t->tv_set.tv_usec, |
656 | (unsigned long)t->tv_expires.tv_jiff, | 621 | (unsigned long)t->tv_expires.tv_jiff, |
657 | (unsigned long)t->tv_expires.tv_usec, | 622 | (unsigned long)t->tv_expires.tv_usec, |
658 | t->delay_us, | 623 | t->delay_us, |
659 | t->data | 624 | t->data |
660 | /* , t->function */ | 625 | /* , t->function */ |
661 | ); | 626 | ) < 0) |
662 | local_irq_save(flags); | 627 | return 0; |
663 | if (t->next != nextt) | 628 | local_irq_save(flags); |
664 | { | 629 | if (t->next != nextt) |
665 | printk(KERN_WARNING "timer removed!\n"); | 630 | printk(KERN_WARNING "timer removed!\n"); |
666 | } | 631 | t = nextt; |
667 | t = nextt; | 632 | } |
668 | } | 633 | local_irq_restore(flags); |
669 | local_irq_restore(flags); | ||
670 | } | ||
671 | |||
672 | if (used - offset < len) | ||
673 | { | ||
674 | len = used - offset; | ||
675 | } | ||
676 | 634 | ||
677 | memcpy(buf, bigbuf + offset, len); | 635 | return 0; |
678 | *start = buf; | 636 | } |
679 | *eof = 1; | ||
680 | 637 | ||
681 | return len; | 638 | static 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); | ||
682 | } | 641 | } |
642 | |||
643 | static 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 | }; | ||
683 | #endif /* PROC_FS */ | 649 | #endif /* PROC_FS */ |
684 | 650 | ||
685 | #ifdef FAST_TIMER_TEST | 651 | #ifdef FAST_TIMER_TEST |
@@ -857,8 +823,7 @@ int fast_timer_init(void) | |||
857 | } | 823 | } |
858 | #endif | 824 | #endif |
859 | #ifdef CONFIG_PROC_FS | 825 | #ifdef CONFIG_PROC_FS |
860 | if ((fasttimer_proc_entry = create_proc_entry( "fasttimer", 0, 0 ))) | 826 | proc_create("fasttimer", 0, NULL, &proc_fasttimer_fops); |
861 | fasttimer_proc_entry->read_proc = proc_fasttimer_read; | ||
862 | #endif /* PROC_FS */ | 827 | #endif /* PROC_FS */ |
863 | if(request_irq(TIMER1_IRQ_NBR, timer1_handler, 0, | 828 | if(request_irq(TIMER1_IRQ_NBR, timer1_handler, 0, |
864 | "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 ab1551ee43c5..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,195 +464,161 @@ void schedule_usleep(unsigned long us) | |||
463 | } | 464 | } |
464 | 465 | ||
465 | #ifdef CONFIG_PROC_FS | 466 | #ifdef CONFIG_PROC_FS |
466 | static int proc_fasttimer_read(char *buf, char **start, off_t offset, int len | ||
467 | ,int *eof, void *data_unused); | ||
468 | static struct proc_dir_entry *fasttimer_proc_entry; | ||
469 | #endif /* CONFIG_PROC_FS */ | ||
470 | |||
471 | #ifdef CONFIG_PROC_FS | ||
472 | |||
473 | /* This value is very much based on testing */ | 467 | /* This value is very much based on testing */ |
474 | #define BIG_BUF_SIZE (500 + NUM_TIMER_STATS * 300) | 468 | #define BIG_BUF_SIZE (500 + NUM_TIMER_STATS * 300) |
475 | 469 | ||
476 | static int proc_fasttimer_read(char *buf, char **start, off_t offset, int len | 470 | static int proc_fasttimer_show(struct seq_file *m, void *v) |
477 | ,int *eof, void *data_unused) | ||
478 | { | 471 | { |
479 | unsigned long flags; | 472 | unsigned long flags; |
480 | int i = 0; | 473 | int i = 0; |
481 | int num_to_show; | 474 | int num_to_show; |
482 | struct fasttime_t tv; | 475 | struct fasttime_t tv; |
483 | struct fast_timer *t, *nextt; | 476 | struct fast_timer *t, *nextt; |
484 | static char *bigbuf = NULL; | 477 | |
485 | static unsigned long used; | 478 | do_gettimeofday_fast(&tv); |
486 | 479 | ||
487 | if (!bigbuf) { | 480 | seq_printf(m, "Fast timers added: %i\n", fast_timers_added); |
488 | bigbuf = vmalloc(BIG_BUF_SIZE); | 481 | seq_printf(m, "Fast timers started: %i\n", fast_timers_started); |
489 | if (!bigbuf) { | 482 | seq_printf(m, "Fast timer interrupts: %i\n", fast_timer_ints); |
490 | used = 0; | 483 | seq_printf(m, "Fast timers expired: %i\n", fast_timers_expired); |
491 | if (buf) | 484 | seq_printf(m, "Fast timers deleted: %i\n", fast_timers_deleted); |
492 | buf[0] = '\0'; | 485 | seq_printf(m, "Fast timer running: %s\n", |
493 | return 0; | 486 | fast_timer_running ? "yes" : "no"); |
494 | } | 487 | seq_printf(m, "Current time: %lu.%06lu\n", |
495 | } | 488 | (unsigned long)tv.tv_jiff, |
496 | 489 | (unsigned long)tv.tv_usec); | |
497 | if (!offset || !used) { | ||
498 | do_gettimeofday_fast(&tv); | ||
499 | |||
500 | used = 0; | ||
501 | used += sprintf(bigbuf + used, "Fast timers added: %i\n", | ||
502 | fast_timers_added); | ||
503 | used += sprintf(bigbuf + used, "Fast timers started: %i\n", | ||
504 | fast_timers_started); | ||
505 | used += sprintf(bigbuf + used, "Fast timer interrupts: %i\n", | ||
506 | fast_timer_ints); | ||
507 | used += sprintf(bigbuf + used, "Fast timers expired: %i\n", | ||
508 | fast_timers_expired); | ||
509 | used += sprintf(bigbuf + used, "Fast timers deleted: %i\n", | ||
510 | fast_timers_deleted); | ||
511 | used += sprintf(bigbuf + used, "Fast timer running: %s\n", | ||
512 | fast_timer_running ? "yes" : "no"); | ||
513 | used += sprintf(bigbuf + used, "Current time: %lu.%06lu\n", | ||
514 | (unsigned long)tv.tv_jiff, | ||
515 | (unsigned long)tv.tv_usec); | ||
516 | #ifdef FAST_TIMER_SANITY_CHECKS | 490 | #ifdef FAST_TIMER_SANITY_CHECKS |
517 | used += sprintf(bigbuf + used, "Sanity failed: %i\n", | 491 | seq_printf(m, "Sanity failed: %i\n", sanity_failed); |
518 | sanity_failed); | ||
519 | #endif | 492 | #endif |
520 | used += sprintf(bigbuf + used, "\n"); | 493 | seq_putc(m, '\n'); |
521 | 494 | ||
522 | #ifdef DEBUG_LOG_INCLUDED | 495 | #ifdef DEBUG_LOG_INCLUDED |
523 | { | 496 | { |
524 | int end_i = debug_log_cnt; | 497 | int end_i = debug_log_cnt; |
525 | i = 0; | 498 | i = 0; |
526 | 499 | ||
527 | if (debug_log_cnt_wrapped) | 500 | if (debug_log_cnt_wrapped) |
528 | i = debug_log_cnt; | 501 | i = debug_log_cnt; |
529 | 502 | ||
530 | while ((i != end_i || (debug_log_cnt_wrapped && !used)) && | 503 | while ((i != end_i || debug_log_cnt_wrapped)) { |
531 | used+100 < BIG_BUF_SIZE) | 504 | if (seq_printf(m, debug_log_string[i], debug_log_value[i]) < 0) |
532 | { | 505 | return 0; |
533 | used += sprintf(bigbuf + used, debug_log_string[i], | 506 | i = (i+1) % DEBUG_LOG_MAX; |
534 | debug_log_value[i]); | 507 | } |
535 | i = (i+1) % DEBUG_LOG_MAX; | 508 | } |
536 | } | 509 | seq_putc(m, '\n'); |
537 | } | ||
538 | used += sprintf(bigbuf + used, "\n"); | ||
539 | #endif | 510 | #endif |
540 | 511 | ||
541 | 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: |
542 | NUM_TIMER_STATS); | 513 | NUM_TIMER_STATS); |
543 | used += sprintf(bigbuf + used, "Timers started: %i\n", fast_timers_started); | 514 | seq_printf(m, "Timers started: %i\n", fast_timers_started); |
544 | for (i = 0; i < num_to_show && (used+100 < BIG_BUF_SIZE) ; i++) | 515 | for (i = 0; i < num_to_show; i++) { |
545 | { | 516 | int cur = (fast_timers_started - i - 1) % NUM_TIMER_STATS; |
546 | int cur = (fast_timers_started - i - 1) % NUM_TIMER_STATS; | ||
547 | 517 | ||
548 | #if 1 //ndef FAST_TIMER_LOG | 518 | #if 1 //ndef FAST_TIMER_LOG |
549 | used += sprintf(bigbuf + used, "div: %i delay: %i" | 519 | seq_printf(m, "div: %i delay: %i" |
550 | "\n", | 520 | "\n", |
551 | timer_div_settings[cur], | 521 | timer_div_settings[cur], |
552 | timer_delay_settings[cur] | 522 | timer_delay_settings[cur]); |
553 | ); | ||
554 | #endif | 523 | #endif |
555 | #ifdef FAST_TIMER_LOG | 524 | #ifdef FAST_TIMER_LOG |
556 | t = &timer_started_log[cur]; | 525 | t = &timer_started_log[cur]; |
557 | used += sprintf(bigbuf + used, "%-14s s: %6lu.%06lu e: %6lu.%06lu " | 526 | if (seq_printf(m, "%-14s s: %6lu.%06lu e: %6lu.%06lu " |
558 | "d: %6li us data: 0x%08lX" | 527 | "d: %6li us data: 0x%08lX" |
559 | "\n", | 528 | "\n", |
560 | t->name, | 529 | t->name, |
561 | (unsigned long)t->tv_set.tv_jiff, | 530 | (unsigned long)t->tv_set.tv_jiff, |
562 | (unsigned long)t->tv_set.tv_usec, | 531 | (unsigned long)t->tv_set.tv_usec, |
563 | (unsigned long)t->tv_expires.tv_jiff, | 532 | (unsigned long)t->tv_expires.tv_jiff, |
564 | (unsigned long)t->tv_expires.tv_usec, | 533 | (unsigned long)t->tv_expires.tv_usec, |
565 | t->delay_us, | 534 | t->delay_us, |
566 | t->data | 535 | t->data) < 0) |
567 | ); | 536 | return 0; |
568 | #endif | 537 | #endif |
569 | } | 538 | } |
570 | used += sprintf(bigbuf + used, "\n"); | 539 | seq_putc(m, '\n'); |
571 | 540 | ||
572 | #ifdef FAST_TIMER_LOG | 541 | #ifdef FAST_TIMER_LOG |
573 | 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: |
574 | NUM_TIMER_STATS); | 543 | NUM_TIMER_STATS); |
575 | used += sprintf(bigbuf + used, "Timers added: %i\n", fast_timers_added); | 544 | seq_printf(m, "Timers added: %i\n", fast_timers_added); |
576 | for (i = 0; i < num_to_show && (used+100 < BIG_BUF_SIZE); i++) | 545 | for (i = 0; i < num_to_show; i++) { |
577 | { | 546 | t = &timer_added_log[(fast_timers_added - i - 1) % NUM_TIMER_STATS]; |
578 | t = &timer_added_log[(fast_timers_added - i - 1) % NUM_TIMER_STATS]; | 547 | if (seq_printf(m, "%-14s s: %6lu.%06lu e: %6lu.%06lu " |
579 | used += sprintf(bigbuf + used, "%-14s s: %6lu.%06lu e: %6lu.%06lu " | 548 | "d: %6li us data: 0x%08lX" |
580 | "d: %6li us data: 0x%08lX" | 549 | "\n", |
581 | "\n", | 550 | t->name, |
582 | t->name, | 551 | (unsigned long)t->tv_set.tv_jiff, |
583 | (unsigned long)t->tv_set.tv_jiff, | 552 | (unsigned long)t->tv_set.tv_usec, |
584 | (unsigned long)t->tv_set.tv_usec, | 553 | (unsigned long)t->tv_expires.tv_jiff, |
585 | (unsigned long)t->tv_expires.tv_jiff, | 554 | (unsigned long)t->tv_expires.tv_usec, |
586 | (unsigned long)t->tv_expires.tv_usec, | 555 | t->delay_us, |
587 | t->delay_us, | 556 | t->data) < 0) |
588 | t->data | 557 | return 0; |
589 | ); | 558 | } |
590 | } | 559 | seq_putc(m, '\n'); |
591 | used += sprintf(bigbuf + used, "\n"); | 560 | |
592 | 561 | num_to_show = (fast_timers_expired < NUM_TIMER_STATS ? fast_timers_expired: | |
593 | num_to_show = (fast_timers_expired < NUM_TIMER_STATS ? fast_timers_expired: | 562 | NUM_TIMER_STATS); |
594 | NUM_TIMER_STATS); | 563 | seq_printf(m, "Timers expired: %i\n", fast_timers_expired); |
595 | used += sprintf(bigbuf + used, "Timers expired: %i\n", fast_timers_expired); | 564 | for (i = 0; i < num_to_show; i++){ |
596 | 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]; |
597 | { | 566 | if (seq_printf(m, "%-14s s: %6lu.%06lu e: %6lu.%06lu " |
598 | t = &timer_expired_log[(fast_timers_expired - i - 1) % NUM_TIMER_STATS]; | 567 | "d: %6li us data: 0x%08lX" |
599 | used += sprintf(bigbuf + used, "%-14s s: %6lu.%06lu e: %6lu.%06lu " | 568 | "\n", |
600 | "d: %6li us data: 0x%08lX" | 569 | t->name, |
601 | "\n", | 570 | (unsigned long)t->tv_set.tv_jiff, |
602 | t->name, | 571 | (unsigned long)t->tv_set.tv_usec, |
603 | (unsigned long)t->tv_set.tv_jiff, | 572 | (unsigned long)t->tv_expires.tv_jiff, |
604 | (unsigned long)t->tv_set.tv_usec, | 573 | (unsigned long)t->tv_expires.tv_usec, |
605 | (unsigned long)t->tv_expires.tv_jiff, | 574 | t->delay_us, |
606 | (unsigned long)t->tv_expires.tv_usec, | 575 | t->data) < 0) |
607 | t->delay_us, | 576 | return 0; |
608 | t->data | 577 | } |
609 | ); | 578 | seq_putc(m, '\n'); |
610 | } | ||
611 | used += sprintf(bigbuf + used, "\n"); | ||
612 | #endif | 579 | #endif |
613 | 580 | ||
614 | used += sprintf(bigbuf + used, "Active timers:\n"); | 581 | seq_puts(m, "Active timers:\n"); |
615 | local_irq_save(flags); | 582 | local_irq_save(flags); |
616 | t = fast_timer_list; | 583 | t = fast_timer_list; |
617 | while (t != NULL && (used+100 < BIG_BUF_SIZE)) | 584 | while (t != NULL){ |
618 | { | 585 | nextt = t->next; |
619 | nextt = t->next; | 586 | local_irq_restore(flags); |
620 | local_irq_restore(flags); | 587 | if (seq_printf(m, "%-14s s: %6lu.%06lu e: %6lu.%06lu " |
621 | used += sprintf(bigbuf + used, "%-14s s: %6lu.%06lu e: %6lu.%06lu " | 588 | "d: %6li us data: 0x%08lX" |
622 | "d: %6li us data: 0x%08lX" | ||
623 | /* " func: 0x%08lX" */ | 589 | /* " func: 0x%08lX" */ |
624 | "\n", | 590 | "\n", |
625 | t->name, | 591 | t->name, |
626 | (unsigned long)t->tv_set.tv_jiff, | 592 | (unsigned long)t->tv_set.tv_jiff, |
627 | (unsigned long)t->tv_set.tv_usec, | 593 | (unsigned long)t->tv_set.tv_usec, |
628 | (unsigned long)t->tv_expires.tv_jiff, | 594 | (unsigned long)t->tv_expires.tv_jiff, |
629 | (unsigned long)t->tv_expires.tv_usec, | 595 | (unsigned long)t->tv_expires.tv_usec, |
630 | t->delay_us, | 596 | t->delay_us, |
631 | t->data | 597 | t->data |
632 | /* , t->function */ | 598 | /* , t->function */ |
633 | ); | 599 | ) < 0) |
634 | local_irq_save(flags); | 600 | return 0; |
635 | if (t->next != nextt) | 601 | local_irq_save(flags); |
636 | { | 602 | if (t->next != nextt) |
637 | printk("timer removed!\n"); | 603 | printk("timer removed!\n"); |
638 | } | 604 | t = nextt; |
639 | t = nextt; | 605 | } |
640 | } | 606 | local_irq_restore(flags); |
641 | local_irq_restore(flags); | 607 | return 0; |
642 | } | 608 | } |
643 | 609 | ||
644 | if (used - offset < len) | 610 | static int proc_fasttimer_open(struct inode *inode, struct file *file) |
645 | { | 611 | { |
646 | len = used - offset; | 612 | return single_open_size(file, proc_fasttimer_show, PDE_DATA(inode), BIG_BUF_SIZE); |
647 | } | 613 | } |
648 | 614 | ||
649 | memcpy(buf, bigbuf + offset, len); | 615 | static const struct file_operations proc_fasttimer_fops = { |
650 | *start = buf; | 616 | .open = proc_fasttimer_open, |
651 | *eof = 1; | 617 | .read = seq_read, |
618 | .llseek = seq_lseek, | ||
619 | .release = seq_release, | ||
620 | }; | ||
652 | 621 | ||
653 | return len; | ||
654 | } | ||
655 | #endif /* PROC_FS */ | 622 | #endif /* PROC_FS */ |
656 | 623 | ||
657 | #ifdef FAST_TIMER_TEST | 624 | #ifdef FAST_TIMER_TEST |
@@ -816,9 +783,7 @@ int fast_timer_init(void) | |||
816 | printk("fast_timer_init()\n"); | 783 | printk("fast_timer_init()\n"); |
817 | 784 | ||
818 | #ifdef CONFIG_PROC_FS | 785 | #ifdef CONFIG_PROC_FS |
819 | fasttimer_proc_entry = create_proc_entry("fasttimer", 0, 0); | 786 | proc_create("fasttimer", 0, NULL, &proc_fasttimer_fops); |
820 | if (fasttimer_proc_entry) | ||
821 | fasttimer_proc_entry->read_proc = proc_fasttimer_read; | ||
822 | #endif /* PROC_FS */ | 787 | #endif /* PROC_FS */ |
823 | if (request_irq(TIMER0_INTR_VECT, timer_trig_interrupt, | 788 | if (request_irq(TIMER0_INTR_VECT, timer_trig_interrupt, |
824 | IRQF_SHARED | IRQF_DISABLED, | 789 | IRQF_SHARED | IRQF_DISABLED, |