diff options
author | Grant Likely <grant.likely@secretlab.ca> | 2010-06-18 13:09:59 -0400 |
---|---|---|
committer | Grant Likely <grant.likely@secretlab.ca> | 2010-06-28 15:41:33 -0400 |
commit | e3873444990dd6f8a095d1f72b5ad45192f8c506 (patch) | |
tree | 9e9fbc43fd4ffde3ac7d41827e0ab9c5f98363f0 /drivers/of/irq.c | |
parent | b505ff5e7291cca6379549297e3852ce3622d550 (diff) |
of/irq: Move irq_of_parse_and_map() to common code
Merge common code between PowerPC and Microblaze. SPARC implements
irq_of_parse_and_map(), but the implementation is different, so it
does not use this code.
Signed-off-by: Grant Likely <grant.likely@secretlab.ca>
Acked-by: Benjamin Herrenschmidt <benh@kernel.crashing.org>
Cc: Michal Simek <monstr@monstr.eu>
Cc: "David S. Miller" <davem@davemloft.net>
Cc: Stephen Rothwell <sfr@canb.auug.org.au>
Cc: Jeremy Kerr <jeremy.kerr@canonical.com>
Diffstat (limited to 'drivers/of/irq.c')
-rw-r--r-- | drivers/of/irq.c | 45 |
1 files changed, 45 insertions, 0 deletions
diff --git a/drivers/of/irq.c b/drivers/of/irq.c new file mode 100644 index 000000000000..9b3397c27096 --- /dev/null +++ b/drivers/of/irq.c | |||
@@ -0,0 +1,45 @@ | |||
1 | /* | ||
2 | * Derived from arch/i386/kernel/irq.c | ||
3 | * Copyright (C) 1992 Linus Torvalds | ||
4 | * Adapted from arch/i386 by Gary Thomas | ||
5 | * Copyright (C) 1995-1996 Gary Thomas (gdt@linuxppc.org) | ||
6 | * Updated and modified by Cort Dougan <cort@fsmlabs.com> | ||
7 | * Copyright (C) 1996-2001 Cort Dougan | ||
8 | * Adapted for Power Macintosh by Paul Mackerras | ||
9 | * Copyright (C) 1996 Paul Mackerras (paulus@cs.anu.edu.au) | ||
10 | * | ||
11 | * This program is free software; you can redistribute it and/or | ||
12 | * modify it under the terms of the GNU General Public License | ||
13 | * as published by the Free Software Foundation; either version | ||
14 | * 2 of the License, or (at your option) any later version. | ||
15 | * | ||
16 | * This file contains the code used to make IRQ descriptions in the | ||
17 | * device tree to actual irq numbers on an interrupt controller | ||
18 | * driver. | ||
19 | */ | ||
20 | |||
21 | #include <linux/errno.h> | ||
22 | #include <linux/module.h> | ||
23 | #include <linux/of.h> | ||
24 | #include <linux/of_irq.h> | ||
25 | #include <linux/string.h> | ||
26 | |||
27 | /** | ||
28 | * irq_of_parse_and_map - Parse and map an interrupt into linux virq space | ||
29 | * @device: Device node of the device whose interrupt is to be mapped | ||
30 | * @index: Index of the interrupt to map | ||
31 | * | ||
32 | * This function is a wrapper that chains of_irq_map_one() and | ||
33 | * irq_create_of_mapping() to make things easier to callers | ||
34 | */ | ||
35 | unsigned int irq_of_parse_and_map(struct device_node *dev, int index) | ||
36 | { | ||
37 | struct of_irq oirq; | ||
38 | |||
39 | if (of_irq_map_one(dev, index, &oirq)) | ||
40 | return NO_IRQ; | ||
41 | |||
42 | return irq_create_of_mapping(oirq.controller, oirq.specifier, | ||
43 | oirq.size); | ||
44 | } | ||
45 | EXPORT_SYMBOL_GPL(irq_of_parse_and_map); | ||