Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1198671

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

From Linus Walleij <linus.walleij@linaro.org>
Newsgroups linux.kernel
Subject Re: [PATCH 2/2] gpio: etraxfs: add interrupt support
Date 2015-08-03 11:40 +0200
Message-ID <pTknT-7ws-5@gated-at.bofh.it> (permalink)
References <pShV7-5Ml-1@gated-at.bofh.it> <pShV8-5Ml-9@gated-at.bofh.it>
Organization linux.* mail to news gateway

Show all headers | View raw


On Fri, Jul 31, 2015 at 2:48 PM, Rabin Vincent <rabin@rab.in> 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@rab.in>

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@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Back to linux.kernel | Previous | NextNext in thread | Find similar | Unroll thread


Thread

Re: [PATCH 2/2] gpio: etraxfs: add interrupt support Linus Walleij <linus.walleij@linaro.org> - 2015-08-03 11:40 +0200
  Re: [PATCH 2/2] gpio: etraxfs: add interrupt support Rabin Vincent <rabin@rab.in> - 2015-08-03 19:40 +0200

csiph-web