On Tue, Sep 23, 2014 at 2:26 PM, Grygorii Strashko <grygorii.strashko@xxxxxx> wrote: > On 09/23/2014 03:04 PM, Linus Walleij wrote: >> On Tue, Sep 9, 2014 at 10:32 AM, Lothar Waßmann <LW@xxxxxxxxxxxxxxxxxxx> wrote: >>> @@ -567,6 +568,17 @@ static int pca953x_irq_setup(struct pca953x_chip *chip, >>> "could not connect irqchip to gpiochip\n"); >>> return ret; >>> } >>> + >>> + for (i = 0; i < NBANK(chip); i++) { >>> + int j; >>> + >>> + for (j = 0; j < BANK_SZ; j++) { >>> + int gpio = gpio_chip->base + i * BANK_SZ + j; >>> + int irq = gpio_to_irq(gpio); >>> + >>> + irq_set_parent(irq, client->irq); >>> + } >>> + } >> >> While this is fixing the problem, but isn't the right fix to patch >> the function gpiochip_irq_map() in gpiolib.c to call >> irq_set_parent() for each IRQ as it gets mapped? >> >> This driver is using the gpiolib irqchip helpers... >> >> Then you fix not just this driver but all drivers, plus the complex >> loop and calls to gpio_to_irq() etc goes away. > > The problem here is that: > - we don't know parent IRQ number inside gpiolib irqchip; > - there can be more then one Parent IRQ per GPIO chip We could for the simple case: void gpiochip_set_chained_irqchip(struct gpio_chip *gpiochip, struct irq_chip *irqchip, int parent_irq, irq_flow_handler_t parent_handler) Note parent_irq. Just add a field for parent_irq in struct gpio_chip so the mapping function has this around. But the second case with multiple parents is a valid counterargument, gpiolib irqchip helpers is just for the simple case of a cascaded IRQ off a single parent, not for complex scenarios. So PCA cannot use gpiochip_set_chained_irqchip()? Anyway I feel I should fix this as per above for all chips using that function, right? Yours, Linus Walleij -- To unsubscribe from this list: send the line "unsubscribe linux-gpio" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html