diff options
author | Sebastian Frias <sf84@laposte.net> | 2016-08-01 16:27:38 +0200 |
---|---|---|
committer | Ben Hutchings <ben@decadent.org.uk> | 2017-02-23 03:53:57 +0000 |
commit | f88b9b4d7d379e37640ec75b9c84fc50cc4975d5 (patch) | |
tree | 8a54449a21b74e83570dad9ac9f5d3482251b6f4 | |
parent | 59dd50d101b7049255199bef62568750eb25a739 (diff) | |
download | linux-stable-f88b9b4d7d379e37640ec75b9c84fc50cc4975d5.tar.gz linux-stable-f88b9b4d7d379e37640ec75b9c84fc50cc4975d5.tar.bz2 linux-stable-f88b9b4d7d379e37640ec75b9c84fc50cc4975d5.zip |
genirq/generic_chip: Add irq_unmap callback
commit ee26c013cdee0b947e29d6cadfb9ff3341c69ff9 upstream.
Without this patch irq_domain_disassociate() cannot properly release the
interrupt. In fact, irq_map_generic_chip() checks a bit on 'gc->installed'
but said bit is never cleared, only set.
Commit 088f40b7b027 ("genirq: Generic chip: Add linear irq domain support")
added irq_map_generic_chip() function and also stated "This lacks a removal
function for now".
This commit provides an implementation of an unmap function that can be
called by irq_domain_disassociate().
[ tglx: Made the function static and removed the export as we have neither
a prototype nor a modular user. ]
Fixes: 088f40b7b027 ("genirq: Generic chip: Add linear irq domain support")
Signed-off-by: Sebastian Frias <sf84@laposte.net>
Cc: Marc Zyngier <marc.zyngier@arm.com>
Cc: Mason <slash.tmp@free.fr>
Cc: Jason Cooper <jason@lakedaemon.net>
Link: http://lkml.kernel.org/r/579F5C5A.2070507@laposte.net
Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
[bwh: Backported to 3.16: open-code irq_domain_get_irq_data(),
irq_domain_set_info()]
Signed-off-by: Ben Hutchings <ben@decadent.org.uk>
-rw-r--r-- | kernel/irq/generic-chip.c | 22 |
1 files changed, 22 insertions, 0 deletions
diff --git a/kernel/irq/generic-chip.c b/kernel/irq/generic-chip.c index 452d6f2ba21d..0e8e3dc7a289 100644 --- a/kernel/irq/generic-chip.c +++ b/kernel/irq/generic-chip.c @@ -395,8 +395,30 @@ static int irq_map_generic_chip(struct irq_domain *d, unsigned int virq, return 0; } +static void irq_unmap_generic_chip(struct irq_domain *d, unsigned int virq) +{ + struct irq_data *data = irq_get_irq_data(virq); + struct irq_domain_chip_generic *dgc = d->gc; + unsigned int hw_irq = data->hwirq; + struct irq_chip_generic *gc; + int irq_idx; + + gc = irq_get_domain_generic_chip(d, hw_irq); + if (!gc) + return; + + irq_idx = hw_irq % dgc->irqs_per_chip; + + clear_bit(irq_idx, &gc->installed); + data->chip = &no_irq_chip; + data->chip_data = NULL; + __irq_set_handler(virq, NULL, 0, NULL); + irq_set_handler_data(virq, NULL); +} + struct irq_domain_ops irq_generic_chip_ops = { .map = irq_map_generic_chip, + .unmap = irq_unmap_generic_chip, .xlate = irq_domain_xlate_onetwocell, }; EXPORT_SYMBOL_GPL(irq_generic_chip_ops); |