diff options
Diffstat (limited to 'fs/proc/proc_misc.c')
-rw-r--r-- | fs/proc/proc_misc.c | 28 |
1 files changed, 24 insertions, 4 deletions
diff --git a/fs/proc/proc_misc.c b/fs/proc/proc_misc.c index c3cbabe8b38e..72dd739a7f8a 100644 --- a/fs/proc/proc_misc.c +++ b/fs/proc/proc_misc.c | |||
@@ -645,15 +645,36 @@ static const struct file_operations proc_stat_operations = { | |||
645 | */ | 645 | */ |
646 | static void *int_seq_start(struct seq_file *f, loff_t *pos) | 646 | static void *int_seq_start(struct seq_file *f, loff_t *pos) |
647 | { | 647 | { |
648 | #ifdef CONFIG_HAVE_SPARSE_IRQ | ||
649 | struct irq_desc *desc; | ||
650 | int irq; | ||
651 | int count = *pos; | ||
652 | |||
653 | for_each_irq_desc(irq, desc) { | ||
654 | if (count-- == 0) | ||
655 | return desc; | ||
656 | } | ||
657 | |||
658 | return NULL; | ||
659 | #else | ||
648 | return (*pos <= nr_irqs) ? pos : NULL; | 660 | return (*pos <= nr_irqs) ? pos : NULL; |
661 | #endif | ||
649 | } | 662 | } |
650 | 663 | ||
664 | |||
651 | static void *int_seq_next(struct seq_file *f, void *v, loff_t *pos) | 665 | static void *int_seq_next(struct seq_file *f, void *v, loff_t *pos) |
652 | { | 666 | { |
667 | #ifdef CONFIG_HAVE_SPARSE_IRQ | ||
668 | struct irq_desc *desc; | ||
669 | |||
670 | desc = ((struct irq_desc *)v)->next; | ||
653 | (*pos)++; | 671 | (*pos)++; |
654 | if (*pos > nr_irqs) | 672 | |
655 | return NULL; | 673 | return desc; |
656 | return pos; | 674 | #else |
675 | (*pos)++; | ||
676 | return (*pos <= nr_irqs) ? pos : NULL; | ||
677 | #endif | ||
657 | } | 678 | } |
658 | 679 | ||
659 | static void int_seq_stop(struct seq_file *f, void *v) | 680 | static void int_seq_stop(struct seq_file *f, void *v) |
@@ -661,7 +682,6 @@ static void int_seq_stop(struct seq_file *f, void *v) | |||
661 | /* Nothing to do */ | 682 | /* Nothing to do */ |
662 | } | 683 | } |
663 | 684 | ||
664 | |||
665 | static const struct seq_operations int_seq_ops = { | 685 | static const struct seq_operations int_seq_ops = { |
666 | .start = int_seq_start, | 686 | .start = int_seq_start, |
667 | .next = int_seq_next, | 687 | .next = int_seq_next, |