interrupts.c 841 B

123456789101112131415161718192021222324252627282930313233343536373839404142
  1. // SPDX-License-Identifier: GPL-2.0
  2. #include <linux/fs.h>
  3. #include <linux/init.h>
  4. #include <linux/interrupt.h>
  5. #include <linux/irqnr.h>
  6. #include <linux/proc_fs.h>
  7. #include <linux/seq_file.h>
  8. /*
  9. * /proc/interrupts
  10. */
  11. static void *int_seq_start(struct seq_file *f, loff_t *pos)
  12. {
  13. return (*pos <= nr_irqs) ? pos : NULL;
  14. }
  15. static void *int_seq_next(struct seq_file *f, void *v, loff_t *pos)
  16. {
  17. (*pos)++;
  18. if (*pos > nr_irqs)
  19. return NULL;
  20. return pos;
  21. }
  22. static void int_seq_stop(struct seq_file *f, void *v)
  23. {
  24. /* Nothing to do */
  25. }
  26. static const struct seq_operations int_seq_ops = {
  27. .start = int_seq_start,
  28. .next = int_seq_next,
  29. .stop = int_seq_stop,
  30. .show = show_interrupts
  31. };
  32. static int __init proc_interrupts_init(void)
  33. {
  34. proc_create_seq("interrupts", 0, NULL, &int_seq_ops);
  35. return 0;
  36. }
  37. fs_initcall(proc_interrupts_init);