Re: [PATCH] gpio: pca953x: Fix warning when HW interrupts are rescheduled by the softirq tasklet

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On 09/24/2014 02:17 PM, Linus Walleij wrote:
> 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()?

Yes. It can't - pca is i2c device.

> 
> Anyway I feel I should fix this as per above for all
> chips using that function, right?

Pls note, the gpiochip_irqchip_add() is called before
gpiochip_set_chained_irqchip() in all places now.

Also seems, we should assume that gpiochip_set_chained_irqchip() can be called 
few times and it could be unsafe to use it for storing parent_irq.

So maybe it would be enough to just adding field for parent_irq
in struct gpio_chip + fix for gpiochip_irq_map() to re-use it
(to fix simple cases :).

regards,
-grygorii
 
--
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




[Index of Archives]     [Linux SPI]     [Linux Kernel]     [Linux ARM (vger)]     [Linux ARM MSM]     [Linux Omap]     [Linux Arm]     [Linux Tegra]     [Fedora ARM]     [Linux for Samsung SOC]     [eCos]     [Linux Fastboot]     [Gcc Help]     [Git]     [DCCP]     [IETF Announce]     [Security]     [Linux MIPS]     [Yosemite Campsites]

  Powered by Linux