Commit | Line | Data |
---|---|---|
c337ddc2 | 1 | /* |
886d51a3 | 2 | * wrapper/irqdesc.c |
c337ddc2 MD |
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 | * | |
886d51a3 MD |
8 | * Copyright (C) 2011-2012 Mathieu Desnoyers <mathieu.desnoyers@efficios.com> |
9 | * | |
10 | * This library is free software; you can redistribute it and/or | |
11 | * modify it under the terms of the GNU Lesser General Public | |
12 | * License as published by the Free Software Foundation; only | |
13 | * version 2.1 of the License. | |
14 | * | |
15 | * This library is distributed in the hope that it will be useful, | |
16 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | |
17 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | |
18 | * Lesser General Public License for more details. | |
19 | * | |
20 | * You should have received a copy of the GNU Lesser General Public | |
21 | * License along with this library; if not, write to the Free Software | |
22 | * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA | |
c337ddc2 MD |
23 | */ |
24 | ||
25 | #ifdef CONFIG_KALLSYMS | |
26 | ||
27 | #include <linux/kallsyms.h> | |
28 | #include <linux/interrupt.h> | |
29 | #include <linux/irqnr.h> | |
30 | #include "kallsyms.h" | |
31 | #include "irqdesc.h" | |
32 | ||
33 | static | |
34 | struct irq_desc *(*irq_to_desc_sym)(unsigned int irq); | |
35 | ||
36 | struct irq_desc *wrapper_irq_to_desc(unsigned int irq) | |
37 | { | |
38 | if (!irq_to_desc_sym) | |
39 | irq_to_desc_sym = (void *) kallsyms_lookup_funcptr("irq_to_desc"); | |
40 | if (irq_to_desc_sym) { | |
41 | return irq_to_desc_sym(irq); | |
42 | } else { | |
43 | printk(KERN_WARNING "LTTng: irq_to_desc symbol lookup failed.\n"); | |
44 | return NULL; | |
45 | } | |
46 | } | |
47 | ||
48 | #else | |
49 | ||
50 | #include <linux/interrupt.h> | |
51 | #include <linux/irqnr.h> | |
52 | ||
53 | struct irq_desc *wrapper_irq_to_desc(unsigned int irq) | |
54 | { | |
55 | return irq_to_desc(irq); | |
56 | } | |
57 | ||
58 | #endif |