diff options
author | Sebastian Frias <sf84@laposte.net> | 2016-08-01 10:27:38 -0400 |
---|---|---|
committer | Thomas Gleixner <tglx@linutronix.de> | 2016-09-02 12:06:49 -0400 |
commit | ee26c013cdee0b947e29d6cadfb9ff3341c69ff9 (patch) | |
tree | 10aaaa54fca3628ddfcad783261eafdb8b831302 | |
parent | f0c450eaa364cb77c778f2a46ee2aa3ff464b332 (diff) |
genirq/generic_chip: Add irq_unmap callback
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>
-rw-r--r-- | kernel/irq/generic-chip.c | 21 |
1 files changed, 21 insertions, 0 deletions
diff --git a/kernel/irq/generic-chip.c b/kernel/irq/generic-chip.c index 11ad73b39d2e..a3a392097804 100644 --- a/kernel/irq/generic-chip.c +++ b/kernel/irq/generic-chip.c | |||
@@ -414,8 +414,29 @@ int irq_map_generic_chip(struct irq_domain *d, unsigned int virq, | |||
414 | return 0; | 414 | return 0; |
415 | } | 415 | } |
416 | 416 | ||
417 | static void irq_unmap_generic_chip(struct irq_domain *d, unsigned int virq) | ||
418 | { | ||
419 | struct irq_data *data = irq_domain_get_irq_data(d, virq); | ||
420 | struct irq_domain_chip_generic *dgc = d->gc; | ||
421 | unsigned int hw_irq = data->hwirq; | ||
422 | struct irq_chip_generic *gc; | ||
423 | int irq_idx; | ||
424 | |||
425 | gc = irq_get_domain_generic_chip(d, hw_irq); | ||
426 | if (!gc) | ||
427 | return; | ||
428 | |||
429 | irq_idx = hw_irq % dgc->irqs_per_chip; | ||
430 | |||
431 | clear_bit(irq_idx, &gc->installed); | ||
432 | irq_domain_set_info(d, virq, hw_irq, &no_irq_chip, NULL, NULL, NULL, | ||
433 | NULL); | ||
434 | |||
435 | } | ||
436 | |||
417 | struct irq_domain_ops irq_generic_chip_ops = { | 437 | struct irq_domain_ops irq_generic_chip_ops = { |
418 | .map = irq_map_generic_chip, | 438 | .map = irq_map_generic_chip, |
439 | .unmap = irq_unmap_generic_chip, | ||
419 | .xlate = irq_domain_xlate_onetwocell, | 440 | .xlate = irq_domain_xlate_onetwocell, |
420 | }; | 441 | }; |
421 | EXPORT_SYMBOL_GPL(irq_generic_chip_ops); | 442 | EXPORT_SYMBOL_GPL(irq_generic_chip_ops); |