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