Re: [PATCH 2/2] gpio: etraxfs: add interrupt support

From: Linus Walleij
Date: Mon Aug 03 2015 - 04:58:44 EST


On Fri, Jul 31, 2015 at 2:48 PM, Rabin Vincent <rabin@xxxxxx> wrote:

> On ETRAX FS, all pins on the first port (and only the first port) have
> interrupt support.
>
> On ARTPEC-3, all pins on all ports have interrupt support. However,
> there are only eight interrupts. Each of the interrupts is associated
> with a group of pins and for each interrupt the one pin from the group
> which will trigger it can be selected.
>
> Signed-off-by: Rabin Vincent <rabin@xxxxxx>

Patch applied, kudos for using the IRQ helpers!

> +static int etraxfs_gpio_irq_request_resources(struct irq_data *d)
> +{
> + struct etraxfs_gpio_chip *chip = irq_data_get_irq_chip_data(d);
> + struct etraxfs_gpio_block *block = chip->block;
> + unsigned int grpirq = etraxfs_gpio_to_group_irq(d->hwirq);
> + int ret = -EBUSY;
> +
> + spin_lock(&block->lock);
> + if (block->group[grpirq])
> + goto out;
> +
> + ret = gpiochip_lock_as_irq(&chip->bgc.gc, d->hwirq);
> + if (ret)
> + goto out;

Some duplicate code for locking the irqs, so I'll see if I can
refactor something.

Yours,
Linus Walleij
--
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/