virq-debugfs.c 1.5 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465
  1. /*
  2. * Support for virtual IRQ subgroups debugfs mapping.
  3. *
  4. * Copyright (C) 2010 Paul Mundt
  5. *
  6. * Modelled after arch/powerpc/kernel/irq.c.
  7. *
  8. * This file is subject to the terms and conditions of the GNU General Public
  9. * License. See the file "COPYING" in the main directory of this archive
  10. * for more details.
  11. */
  12. #include <linux/seq_file.h>
  13. #include <linux/fs.h>
  14. #include <linux/init.h>
  15. #include <linux/irq.h>
  16. #include <linux/debugfs.h>
  17. #include "internals.h"
  18. static int intc_irq_xlate_debug(struct seq_file *m, void *priv)
  19. {
  20. int i;
  21. seq_printf(m, "%-5s %-7s %-15s\n", "irq", "enum", "chip name");
  22. for (i = 1; i < nr_irqs; i++) {
  23. struct intc_map_entry *entry = intc_irq_xlate_get(i);
  24. struct intc_desc_int *desc = entry->desc;
  25. if (!desc)
  26. continue;
  27. seq_printf(m, "%5d ", i);
  28. seq_printf(m, "0x%05x ", entry->enum_id);
  29. seq_printf(m, "%-15s\n", desc->chip.name);
  30. }
  31. return 0;
  32. }
  33. static int intc_irq_xlate_open(struct inode *inode, struct file *file)
  34. {
  35. return single_open(file, intc_irq_xlate_debug, inode->i_private);
  36. }
  37. static const struct file_operations intc_irq_xlate_fops = {
  38. .open = intc_irq_xlate_open,
  39. .read = seq_read,
  40. .llseek = seq_lseek,
  41. .release = single_release,
  42. };
  43. static int __init intc_irq_xlate_init(void)
  44. {
  45. /*
  46. * XXX.. use arch_debugfs_dir here when all of the intc users are
  47. * converted.
  48. */
  49. if (debugfs_create_file("intc_irq_xlate", S_IRUGO, NULL, NULL,
  50. &intc_irq_xlate_fops) == NULL)
  51. return -ENOMEM;
  52. return 0;
  53. }
  54. fs_initcall(intc_irq_xlate_init);