diff options
author | Srikant Patnaik | 2015-01-11 12:28:04 +0530 |
---|---|---|
committer | Srikant Patnaik | 2015-01-11 12:28:04 +0530 |
commit | 871480933a1c28f8a9fed4c4d34d06c439a7a422 (patch) | |
tree | 8718f573808810c2a1e8cb8fb6ac469093ca2784 /drivers/sh/intc/dynamic.c | |
parent | 9d40ac5867b9aefe0722bc1f110b965ff294d30d (diff) | |
download | FOSSEE-netbook-kernel-source-871480933a1c28f8a9fed4c4d34d06c439a7a422.tar.gz FOSSEE-netbook-kernel-source-871480933a1c28f8a9fed4c4d34d06c439a7a422.tar.bz2 FOSSEE-netbook-kernel-source-871480933a1c28f8a9fed4c4d34d06c439a7a422.zip |
Moved, renamed, and deleted files
The original directory structure was scattered and unorganized.
Changes are basically to make it look like kernel structure.
Diffstat (limited to 'drivers/sh/intc/dynamic.c')
-rw-r--r-- | drivers/sh/intc/dynamic.c | 65 |
1 files changed, 65 insertions, 0 deletions
diff --git a/drivers/sh/intc/dynamic.c b/drivers/sh/intc/dynamic.c new file mode 100644 index 00000000..5fea1ee8 --- /dev/null +++ b/drivers/sh/intc/dynamic.c @@ -0,0 +1,65 @@ +/* + * Dynamic IRQ management + * + * Copyright (C) 2010 Paul Mundt + * + * Modelled after arch/x86/kernel/apic/io_apic.c + * + * This file is subject to the terms and conditions of the GNU General Public + * License. See the file "COPYING" in the main directory of this archive + * for more details. + */ +#define pr_fmt(fmt) "intc: " fmt + +#include <linux/irq.h> +#include <linux/bitmap.h> +#include <linux/spinlock.h> +#include <linux/module.h> +#include "internals.h" /* only for activate_irq() damage.. */ + +/* + * The IRQ bitmap provides a global map of bound IRQ vectors for a + * given platform. Allocation of IRQs are either static through the CPU + * vector map, or dynamic in the case of board mux vectors or MSI. + * + * As this is a central point for all IRQ controllers on the system, + * each of the available sources are mapped out here. This combined with + * sparseirq makes it quite trivial to keep the vector map tightly packed + * when dynamically creating IRQs, as well as tying in to otherwise + * unused irq_desc positions in the sparse array. + */ + +/* + * Dynamic IRQ allocation and deallocation + */ +unsigned int create_irq_nr(unsigned int irq_want, int node) +{ + int irq = irq_alloc_desc_at(irq_want, node); + if (irq < 0) + return 0; + + activate_irq(irq); + return irq; +} + +int create_irq(void) +{ + int irq = irq_alloc_desc(numa_node_id()); + if (irq >= 0) + activate_irq(irq); + + return irq; +} + +void destroy_irq(unsigned int irq) +{ + irq_free_desc(irq); +} + +void reserve_intc_vectors(struct intc_vect *vectors, unsigned int nr_vecs) +{ + int i; + + for (i = 0; i < nr_vecs; i++) + irq_reserve_irq(evt2irq(vectors[i].vect)); +} |