Re: [PATCH 2/2] gpio: etraxfs: add interrupt support
From: Linus Walleij
Date: Mon Aug 03 2015 - 05:34:40 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>
Hm wait now I get confused ... probably tripping over my own shoelaces
as usual but help me here:
> +static void etraxfs_gpio_irq_ack(struct irq_data *d)
> +{
> + struct etraxfs_gpio_chip *chip = irq_data_get_irq_chip_data(d);
I don't see how this works in the irqchip functions.
Usually the chip data is the struct gpio_chip when using the
GPIOLIB_IRQCHIP, then we use some container_of to boil
out the containing struct, like:
static inline struct extraxfs_gpio_chip *to_etraxfs(struct gpio_chip *chip)
{
return container_of(chip, struct etraxfs_gpio_chip, bgc.gc);
}
So it would be:
struct gpio_chip *gc = irq_data_get_irq_chip_data(d);
struct etraxfs_gpio_chip *chip = to_etraxfs(gc);
so how did you manage to replace that pointer with a pointer
to your struct etraxfs_gpio_chip?
> + ret = gpiochip_irqchip_add(&bgc->gc, &etraxfs_gpio_irq_chip, 0,
> + handle_level_irq, IRQ_TYPE_NONE);
Because this sets the irqdomain host_data to gc, then the
irqdomain .map function sets the chip data to the same.
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/