Re: [PATCH 1/4] mfd: arizona: Add additional dummy IRQ callbacks

From: Lee Jones
Date: Thu Aug 21 2014 - 07:56:40 EST


On Tue, 12 Aug 2014, Charles Keepax wrote:

> We use a dummy IRQ chip to dispatch interrupts to the two seperate IRQ
> domains on the Arizona devices. Currently only the enable and disable
> callbacks are defined however, there are some situations where additional
> callbacks will be used from the IRQ core, which currently results in an
> NULL pointer deference. Add handlers for more of the IRQ callbacks and
> combine these into a single function since they are all identical.
>
> Signed-off-by: Charles Keepax <ckeepax@xxxxxxxxxxxxxxxxxxxxxxxxxxx>
> ---
> drivers/mfd/arizona-irq.c | 13 ++++++-------
> 1 files changed, 6 insertions(+), 7 deletions(-)
>
> diff --git a/drivers/mfd/arizona-irq.c b/drivers/mfd/arizona-irq.c
> index d420dbc..71e8f06 100644
> --- a/drivers/mfd/arizona-irq.c
> +++ b/drivers/mfd/arizona-irq.c
> @@ -144,18 +144,17 @@ static irqreturn_t arizona_irq_thread(int irq, void *data)
> return IRQ_HANDLED;
> }
>
> -static void arizona_irq_enable(struct irq_data *data)
> -{
> -}
> -
> -static void arizona_irq_disable(struct irq_data *data)
> +static void arizona_irq_dummy(struct irq_data *data)
> {
> }
>
> static struct irq_chip arizona_irq_chip = {
> .name = "arizona",
> - .irq_disable = arizona_irq_disable,
> - .irq_enable = arizona_irq_enable,
> + .irq_disable = arizona_irq_dummy,
> + .irq_enable = arizona_irq_dummy,
> + .irq_ack = arizona_irq_dummy,
> + .irq_mask = arizona_irq_dummy,
> + .irq_unmask = arizona_irq_dummy,

If you provide .irq_enable(), then .irq_unmask becomes redundant
and/or is checked for before invoking. There is a chance of
.irq_mask() being called, but if this is a problem, it should be fixed
in the IRQ Chip code. There is also one unprotected invocation of
.irq_ack(), but I think this should be fixed rather than forcing each
user of IRQ Chip to provide all of these call-backs.

> };
>
> static int arizona_irq_map(struct irq_domain *h, unsigned int virq,

--
Lee Jones
Linaro STMicroelectronics Landing Team Lead
Linaro.org â Open source software for ARM SoCs
Follow Linaro: Facebook | Twitter | Blog
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/