Commit | Line | Data |
---|---|---|
c337ddc2 MD |
1 | /* |
2 | * Copyright (C) 2011 Mathieu Desnoyers (mathieu.desnoyers@efficios.com) | |
3 | * | |
4 | * wrapper around irq_to_desc. Using KALLSYMS to get its address when | |
5 | * available, else we need to have a kernel that exports this function to GPL | |
6 | * modules. | |
7 | * | |
8 | * Dual LGPL v2.1/GPL v2 license. | |
9 | */ | |
10 | ||
11 | #ifdef CONFIG_KALLSYMS | |
12 | ||
13 | #include <linux/kallsyms.h> | |
14 | #include <linux/interrupt.h> | |
15 | #include <linux/irqnr.h> | |
16 | #include "kallsyms.h" | |
17 | #include "irqdesc.h" | |
18 | ||
19 | static | |
20 | struct irq_desc *(*irq_to_desc_sym)(unsigned int irq); | |
21 | ||
22 | struct irq_desc *wrapper_irq_to_desc(unsigned int irq) | |
23 | { | |
24 | if (!irq_to_desc_sym) | |
25 | irq_to_desc_sym = (void *) kallsyms_lookup_funcptr("irq_to_desc"); | |
26 | if (irq_to_desc_sym) { | |
27 | return irq_to_desc_sym(irq); | |
28 | } else { | |
29 | printk(KERN_WARNING "LTTng: irq_to_desc symbol lookup failed.\n"); | |
30 | return NULL; | |
31 | } | |
32 | } | |
33 | ||
34 | #else | |
35 | ||
36 | #include <linux/interrupt.h> | |
37 | #include <linux/irqnr.h> | |
38 | ||
39 | struct irq_desc *wrapper_irq_to_desc(unsigned int irq) | |
40 | { | |
41 | return irq_to_desc(irq); | |
42 | } | |
43 | ||
44 | #endif |