]> git.karo-electronics.de Git - mv-sheeva.git/blob - kernel/irq/internals.h
Merge git://git.infradead.org/users/dwmw2/mtd-2.6.38
[mv-sheeva.git] / kernel / irq / internals.h
1 /*
2  * IRQ subsystem internal functions and variables:
3  */
4 #include <linux/irqdesc.h>
5
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
12 extern int noirqdebug;
13
14 #define irq_data_to_desc(data)  container_of(data, struct irq_desc, irq_data)
15
16 /* Set default functions for irq_chip structures: */
17 extern void irq_chip_set_defaults(struct irq_chip *chip);
18
19 /* Set default handler: */
20 extern void compat_irq_chip_set_default_handler(struct irq_desc *desc);
21
22 extern int __irq_set_trigger(struct irq_desc *desc, unsigned int irq,
23                 unsigned long flags);
24 extern void __disable_irq(struct irq_desc *desc, unsigned int irq, bool susp);
25 extern void __enable_irq(struct irq_desc *desc, unsigned int irq, bool resume);
26
27 extern void init_kstat_irqs(struct irq_desc *desc, int node, int nr);
28
29 /* Resending of interrupts :*/
30 void check_irq_resend(struct irq_desc *desc, unsigned int irq);
31
32 #ifdef CONFIG_PROC_FS
33 extern void register_irq_proc(unsigned int irq, struct irq_desc *desc);
34 extern void unregister_irq_proc(unsigned int irq, struct irq_desc *desc);
35 extern void register_handler_proc(unsigned int irq, struct irqaction *action);
36 extern void unregister_handler_proc(unsigned int irq, struct irqaction *action);
37 #else
38 static inline void register_irq_proc(unsigned int irq, struct irq_desc *desc) { }
39 static inline void unregister_irq_proc(unsigned int irq, struct irq_desc *desc) { }
40 static inline void register_handler_proc(unsigned int irq,
41                                          struct irqaction *action) { }
42 static inline void unregister_handler_proc(unsigned int irq,
43                                            struct irqaction *action) { }
44 #endif
45
46 extern int irq_select_affinity_usr(unsigned int irq);
47
48 extern void irq_set_thread_affinity(struct irq_desc *desc);
49
50 #ifndef CONFIG_GENERIC_HARDIRQS_NO_DEPRECATED
51 static inline void irq_end(unsigned int irq, struct irq_desc *desc)
52 {
53         if (desc->irq_data.chip && desc->irq_data.chip->end)
54                 desc->irq_data.chip->end(irq);
55 }
56 #else
57 static inline void irq_end(unsigned int irq, struct irq_desc *desc) { }
58 #endif
59
60 /* Inline functions for support of irq chips on slow busses */
61 static inline void chip_bus_lock(struct irq_desc *desc)
62 {
63         if (unlikely(desc->irq_data.chip->irq_bus_lock))
64                 desc->irq_data.chip->irq_bus_lock(&desc->irq_data);
65 }
66
67 static inline void chip_bus_sync_unlock(struct irq_desc *desc)
68 {
69         if (unlikely(desc->irq_data.chip->irq_bus_sync_unlock))
70                 desc->irq_data.chip->irq_bus_sync_unlock(&desc->irq_data);
71 }
72
73 /*
74  * Debugging printout:
75  */
76
77 #include <linux/kallsyms.h>
78
79 #define P(f) if (desc->status & f) printk("%14s set\n", #f)
80
81 static inline void print_irq_desc(unsigned int irq, struct irq_desc *desc)
82 {
83         printk("irq %d, desc: %p, depth: %d, count: %d, unhandled: %d\n",
84                 irq, desc, desc->depth, desc->irq_count, desc->irqs_unhandled);
85         printk("->handle_irq():  %p, ", desc->handle_irq);
86         print_symbol("%s\n", (unsigned long)desc->handle_irq);
87         printk("->irq_data.chip(): %p, ", desc->irq_data.chip);
88         print_symbol("%s\n", (unsigned long)desc->irq_data.chip);
89         printk("->action(): %p\n", desc->action);
90         if (desc->action) {
91                 printk("->action->handler(): %p, ", desc->action->handler);
92                 print_symbol("%s\n", (unsigned long)desc->action->handler);
93         }
94
95         P(IRQ_INPROGRESS);
96         P(IRQ_DISABLED);
97         P(IRQ_PENDING);
98         P(IRQ_REPLAY);
99         P(IRQ_AUTODETECT);
100         P(IRQ_WAITING);
101         P(IRQ_LEVEL);
102         P(IRQ_MASKED);
103 #ifdef CONFIG_IRQ_PER_CPU
104         P(IRQ_PER_CPU);
105 #endif
106         P(IRQ_NOPROBE);
107         P(IRQ_NOREQUEST);
108         P(IRQ_NOAUTOEN);
109 }
110
111 #undef P
112