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/arch-v10 | |
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/arch-v10')
-rw-r--r-- | arch/cris/arch-v10/kernel/fasttimer.c | 301 |
1 files changed, 133 insertions, 168 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)) |