internals.h 2.9 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697
  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. /* Inline functions for support of irq chips on slow busses */
  35. static inline void chip_bus_lock(struct irq_desc *desc)
  36. {
  37. if (unlikely(desc->irq_data.chip->irq_bus_lock))
  38. desc->irq_data.chip->irq_bus_lock(&desc->irq_data);
  39. }
  40. static inline void chip_bus_sync_unlock(struct irq_desc *desc)
  41. {
  42. if (unlikely(desc->irq_data.chip->irq_bus_sync_unlock))
  43. desc->irq_data.chip->irq_bus_sync_unlock(&desc->irq_data);
  44. }
  45. /*
  46. * Debugging printout:
  47. */
  48. #include <linux/kallsyms.h>
  49. #define P(f) if (desc->status & f) printk("%14s set\n", #f)
  50. static inline void print_irq_desc(unsigned int irq, struct irq_desc *desc)
  51. {
  52. printk("irq %d, desc: %p, depth: %d, count: %d, unhandled: %d\n",
  53. irq, desc, desc->depth, desc->irq_count, desc->irqs_unhandled);
  54. printk("->handle_irq(): %p, ", desc->handle_irq);
  55. print_symbol("%s\n", (unsigned long)desc->handle_irq);
  56. printk("->irq_data.chip(): %p, ", desc->irq_data.chip);
  57. print_symbol("%s\n", (unsigned long)desc->irq_data.chip);
  58. printk("->action(): %p\n", desc->action);
  59. if (desc->action) {
  60. printk("->action->handler(): %p, ", desc->action->handler);
  61. print_symbol("%s\n", (unsigned long)desc->action->handler);
  62. }
  63. P(IRQ_INPROGRESS);
  64. P(IRQ_DISABLED);
  65. P(IRQ_PENDING);
  66. P(IRQ_REPLAY);
  67. P(IRQ_AUTODETECT);
  68. P(IRQ_WAITING);
  69. P(IRQ_LEVEL);
  70. P(IRQ_MASKED);
  71. #ifdef CONFIG_IRQ_PER_CPU
  72. P(IRQ_PER_CPU);
  73. #endif
  74. P(IRQ_NOPROBE);
  75. P(IRQ_NOREQUEST);
  76. P(IRQ_NOAUTOEN);
  77. }
  78. #undef P