mirror of
https://github.com/BobTheBlinker/android_kernel_motorola_sm6375.git
synced 2026-10-28 02:32:09 -04:00
genirq: Provide irq_request/release_resources chip callbacks
For certain irq types, e.g. gpios, it's necessary to request resources before starting up the irq. This might fail so we cannot use the irq_startup() callback because we might call the irq_set_type() callback before that which does not make sense when the resource is not available. Calling irq_startup() before irq_set_type() can lead to spurious interrupts which is not desired either. Signed-off-by: Thomas Gleixner <[email protected]> Cc: Jean-Jacques Hiblot <[email protected]> Cc: Grant Likely <[email protected]> Cc: [email protected] Reviewed-by: Linus Walleij <[email protected]> Link: http://lkml.kernel.org/r/[email protected] Signed-off-by: Thomas Gleixner <[email protected]>
This commit is contained in:
parent
fa389e2202
commit
c1bacbae81
2 changed files with 33 additions and 1 deletions
|
|
@ -896,6 +896,23 @@ static void irq_setup_forced_threading(struct irqaction *new)
|
|||
}
|
||||
}
|
||||
|
||||
static int irq_request_resources(struct irq_desc *desc)
|
||||
{
|
||||
struct irq_data *d = &desc->irq_data;
|
||||
struct irq_chip *c = d->chip;
|
||||
|
||||
return c->irq_request_resources ? c->irq_request_resources(d) : 0;
|
||||
}
|
||||
|
||||
static void irq_release_resources(struct irq_desc *desc)
|
||||
{
|
||||
struct irq_data *d = &desc->irq_data;
|
||||
struct irq_chip *c = d->chip;
|
||||
|
||||
if (c->irq_release_resources)
|
||||
c->irq_release_resources(d);
|
||||
}
|
||||
|
||||
/*
|
||||
* Internal function to register an irqaction - typically used to
|
||||
* allocate special interrupts that are part of the architecture.
|
||||
|
|
@ -1091,6 +1108,13 @@ __setup_irq(unsigned int irq, struct irq_desc *desc, struct irqaction *new)
|
|||
}
|
||||
|
||||
if (!shared) {
|
||||
ret = irq_request_resources(desc);
|
||||
if (ret) {
|
||||
pr_err("Failed to request resources for %s (irq %d) on irqchip %s\n",
|
||||
new->name, irq, desc->irq_data.chip->name);
|
||||
goto out_mask;
|
||||
}
|
||||
|
||||
init_waitqueue_head(&desc->wait_for_threads);
|
||||
|
||||
/* Setup the type (level, edge polarity) if configured: */
|
||||
|
|
@ -1261,8 +1285,10 @@ static struct irqaction *__free_irq(unsigned int irq, void *dev_id)
|
|||
*action_ptr = action->next;
|
||||
|
||||
/* If this was the last handler, shut down the IRQ line: */
|
||||
if (!desc->action)
|
||||
if (!desc->action) {
|
||||
irq_shutdown(desc);
|
||||
irq_release_resources(desc);
|
||||
}
|
||||
|
||||
#ifdef CONFIG_SMP
|
||||
/* make sure affinity_hint is cleaned up */
|
||||
|
|
|
|||
Loading…
Reference in a new issue