genirq: Mark polled irqs and defer the real handler
[linux-block.git] / kernel / irq / internals.h
CommitLineData
1da177e4
LT
1/*
2 * IRQ subsystem internal functions and variables:
3 */
e144710b 4#include <linux/irqdesc.h>
1da177e4 5
c1ee6264
TG
6#ifdef CONFIG_SPARSE_IRQ
7# define IRQ_BITMAP_BITS (NR_IRQS + 8196)
8#else
9# define IRQ_BITMAP_BITS NR_IRQS
10#endif
11
1da177e4
LT
12extern int noirqdebug;
13
a77c4635
TG
14#define irq_data_to_desc(data) container_of(data, struct irq_desc, irq_data)
15
6a6de9ef
TG
16/* Set default functions for irq_chip structures: */
17extern void irq_chip_set_defaults(struct irq_chip *chip);
18
19/* Set default handler: */
20extern void compat_irq_chip_set_default_handler(struct irq_desc *desc);
21
0c5d1eb7
DB
22extern int __irq_set_trigger(struct irq_desc *desc, unsigned int irq,
23 unsigned long flags);
0a0c5168
RW
24extern void __disable_irq(struct irq_desc *desc, unsigned int irq, bool susp);
25extern void __enable_irq(struct irq_desc *desc, unsigned int irq, bool resume);
0c5d1eb7 26
85ac16d0 27extern void init_kstat_irqs(struct irq_desc *desc, int node, int nr);
0fa0ebbf 28
e144710b
TG
29/* Resending of interrupts :*/
30void check_irq_resend(struct irq_desc *desc, unsigned int irq);
fe200ae4 31bool irq_wait_for_poll(struct irq_desc *desc);
e144710b 32
1da177e4 33#ifdef CONFIG_PROC_FS
2c6927a3 34extern void register_irq_proc(unsigned int irq, struct irq_desc *desc);
13bfe99e 35extern void unregister_irq_proc(unsigned int irq, struct irq_desc *desc);
1da177e4
LT
36extern void register_handler_proc(unsigned int irq, struct irqaction *action);
37extern void unregister_handler_proc(unsigned int irq, struct irqaction *action);
38#else
2c6927a3 39static inline void register_irq_proc(unsigned int irq, struct irq_desc *desc) { }
13bfe99e 40static inline void unregister_irq_proc(unsigned int irq, struct irq_desc *desc) { }
1da177e4
LT
41static inline void register_handler_proc(unsigned int irq,
42 struct irqaction *action) { }
43static inline void unregister_handler_proc(unsigned int irq,
44 struct irqaction *action) { }
45#endif
46
3b8249e7 47extern int irq_select_affinity_usr(unsigned int irq, struct cpumask *mask);
f6d87f4b 48
591d2fb0 49extern void irq_set_thread_affinity(struct irq_desc *desc);
57b150cc 50
70aedd24 51/* Inline functions for support of irq chips on slow busses */
3876ec9e 52static inline void chip_bus_lock(struct irq_desc *desc)
70aedd24 53{
3876ec9e
TG
54 if (unlikely(desc->irq_data.chip->irq_bus_lock))
55 desc->irq_data.chip->irq_bus_lock(&desc->irq_data);
70aedd24
TG
56}
57
3876ec9e 58static inline void chip_bus_sync_unlock(struct irq_desc *desc)
70aedd24 59{
3876ec9e
TG
60 if (unlikely(desc->irq_data.chip->irq_bus_sync_unlock))
61 desc->irq_data.chip->irq_bus_sync_unlock(&desc->irq_data);
70aedd24
TG
62}
63
43f77759
IM
64/*
65 * Debugging printout:
66 */
67
68#include <linux/kallsyms.h>
69
70#define P(f) if (desc->status & f) printk("%14s set\n", #f)
71
72static inline void print_irq_desc(unsigned int irq, struct irq_desc *desc)
73{
74 printk("irq %d, desc: %p, depth: %d, count: %d, unhandled: %d\n",
75 irq, desc, desc->depth, desc->irq_count, desc->irqs_unhandled);
76 printk("->handle_irq(): %p, ", desc->handle_irq);
77 print_symbol("%s\n", (unsigned long)desc->handle_irq);
6b8ff312
TG
78 printk("->irq_data.chip(): %p, ", desc->irq_data.chip);
79 print_symbol("%s\n", (unsigned long)desc->irq_data.chip);
43f77759
IM
80 printk("->action(): %p\n", desc->action);
81 if (desc->action) {
82 printk("->action->handler(): %p, ", desc->action->handler);
83 print_symbol("%s\n", (unsigned long)desc->action->handler);
84 }
85
86 P(IRQ_INPROGRESS);
87 P(IRQ_DISABLED);
88 P(IRQ_PENDING);
89 P(IRQ_REPLAY);
90 P(IRQ_AUTODETECT);
91 P(IRQ_WAITING);
92 P(IRQ_LEVEL);
93 P(IRQ_MASKED);
94#ifdef CONFIG_IRQ_PER_CPU
95 P(IRQ_PER_CPU);
96#endif
97 P(IRQ_NOPROBE);
98 P(IRQ_NOREQUEST);
99 P(IRQ_NOAUTOEN);
100}
101
102#undef P
103