internals.h 3.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107
  1. /*
  2. * IRQ subsystem internal functions and variables:
  3. */
  4. extern int noirqdebug;
  5. #define irq_data_to_desc(data) container_of(data, struct irq_desc, irq_data)
  6. /* Set default functions for irq_chip structures: */
  7. extern void irq_chip_set_defaults(struct irq_chip *chip);
  8. /* Set default handler: */
  9. extern void compat_irq_chip_set_default_handler(struct irq_desc *desc);
  10. extern int __irq_set_trigger(struct irq_desc *desc, unsigned int irq,
  11. unsigned long flags);
  12. extern void __disable_irq(struct irq_desc *desc, unsigned int irq, bool susp);
  13. extern void __enable_irq(struct irq_desc *desc, unsigned int irq, bool resume);
  14. extern struct lock_class_key irq_desc_lock_class;
  15. extern void init_kstat_irqs(struct irq_desc *desc, int node, int nr);
  16. extern void clear_kstat_irqs(struct irq_desc *desc);
  17. extern raw_spinlock_t sparse_irq_lock;
  18. #ifdef CONFIG_SPARSE_IRQ
  19. void replace_irq_desc(unsigned int irq, struct irq_desc *desc);
  20. #endif
  21. #ifdef CONFIG_PROC_FS
  22. extern void register_irq_proc(unsigned int irq, struct irq_desc *desc);
  23. extern void register_handler_proc(unsigned int irq, struct irqaction *action);
  24. extern void unregister_handler_proc(unsigned int irq, struct irqaction *action);
  25. #else
  26. static inline void register_irq_proc(unsigned int irq, struct irq_desc *desc) { }
  27. static inline void register_handler_proc(unsigned int irq,
  28. struct irqaction *action) { }
  29. static inline void unregister_handler_proc(unsigned int irq,
  30. struct irqaction *action) { }
  31. #endif
  32. extern int irq_select_affinity_usr(unsigned int irq);
  33. extern void irq_set_thread_affinity(struct irq_desc *desc);
  34. #ifndef CONFIG_GENERIC_HARDIRQS_NO_DEPRECATED
  35. static inline void irq_end(unsigned int irq, struct irq_desc *desc)
  36. {
  37. if (desc->irq_data.chip && desc->irq_data.chip->end)
  38. desc->irq_data.chip->end(irq);
  39. }
  40. #else
  41. static inline void irq_end(unsigned int irq, struct irq_desc *desc) { }
  42. #endif
  43. /* Inline functions for support of irq chips on slow busses */
  44. static inline void chip_bus_lock(struct irq_desc *desc)
  45. {
  46. if (unlikely(desc->irq_data.chip->irq_bus_lock))
  47. desc->irq_data.chip->irq_bus_lock(&desc->irq_data);
  48. }
  49. static inline void chip_bus_sync_unlock(struct irq_desc *desc)
  50. {
  51. if (unlikely(desc->irq_data.chip->irq_bus_sync_unlock))
  52. desc->irq_data.chip->irq_bus_sync_unlock(&desc->irq_data);
  53. }
  54. /*
  55. * Debugging printout:
  56. */
  57. #include <linux/kallsyms.h>
  58. #define P(f) if (desc->status & f) printk("%14s set\n", #f)
  59. static inline void print_irq_desc(unsigned int irq, struct irq_desc *desc)
  60. {
  61. printk("irq %d, desc: %p, depth: %d, count: %d, unhandled: %d\n",
  62. irq, desc, desc->depth, desc->irq_count, desc->irqs_unhandled);
  63. printk("->handle_irq(): %p, ", desc->handle_irq);
  64. print_symbol("%s\n", (unsigned long)desc->handle_irq);
  65. printk("->irq_data.chip(): %p, ", desc->irq_data.chip);
  66. print_symbol("%s\n", (unsigned long)desc->irq_data.chip);
  67. printk("->action(): %p\n", desc->action);
  68. if (desc->action) {
  69. printk("->action->handler(): %p, ", desc->action->handler);
  70. print_symbol("%s\n", (unsigned long)desc->action->handler);
  71. }
  72. P(IRQ_INPROGRESS);
  73. P(IRQ_DISABLED);
  74. P(IRQ_PENDING);
  75. P(IRQ_REPLAY);
  76. P(IRQ_AUTODETECT);
  77. P(IRQ_WAITING);
  78. P(IRQ_LEVEL);
  79. P(IRQ_MASKED);
  80. #ifdef CONFIG_IRQ_PER_CPU
  81. P(IRQ_PER_CPU);
  82. #endif
  83. P(IRQ_NOPROBE);
  84. P(IRQ_NOREQUEST);
  85. P(IRQ_NOAUTOEN);
  86. }
  87. #undef P