From: Grygorii Strashko <grygorii.strashko@ti.com>
To: Linus Walleij <linus.walleij@linaro.org>
Cc: "Lothar Waßmann" <LW@karo-electronics.de>,
"linux-gpio@vger.kernel.org" <linux-gpio@vger.kernel.org>,
"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>,
"Alexandre Courbot" <gnurou@gmail.com>
Subject: Re: [PATCH] gpio: pca953x: Fix warning when HW interrupts are rescheduled by the softirq tasklet
Date: Wed, 24 Sep 2014 15:28:32 +0300 [thread overview]
Message-ID: <5422B8F0.9060803@ti.com> (raw)
In-Reply-To: <CACRpkdYCsdMcJY7Y0gK4_zPxiWRFKkzi2TaZUi1Vn7Kp0Cbgzg@mail.gmail.com>
On 09/24/2014 02:17 PM, Linus Walleij wrote:
> On Tue, Sep 23, 2014 at 2:26 PM, Grygorii Strashko
> <grygorii.strashko@ti.com> wrote:
>> On 09/23/2014 03:04 PM, Linus Walleij wrote:
>>> On Tue, Sep 9, 2014 at 10:32 AM, Lothar Waßmann <LW@karo-electronics.de> 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@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
WARNING: multiple messages have this Message-ID (diff)
From: Grygorii Strashko <grygorii.strashko@ti.com>
To: Linus Walleij <linus.walleij@linaro.org>
Cc: "Lothar Waßmann" <LW@karo-electronics.de>,
"linux-gpio@vger.kernel.org" <linux-gpio@vger.kernel.org>,
"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>,
"Alexandre Courbot" <gnurou@gmail.com>
Subject: Re: [PATCH] gpio: pca953x: Fix warning when HW interrupts are rescheduled by the softirq tasklet
Date: Wed, 24 Sep 2014 15:28:32 +0300 [thread overview]
Message-ID: <5422B8F0.9060803@ti.com> (raw)
In-Reply-To: <CACRpkdYCsdMcJY7Y0gK4_zPxiWRFKkzi2TaZUi1Vn7Kp0Cbgzg@mail.gmail.com>
On 09/24/2014 02:17 PM, Linus Walleij wrote:
> On Tue, Sep 23, 2014 at 2:26 PM, Grygorii Strashko
> <grygorii.strashko@ti.com> wrote:
>> On 09/23/2014 03:04 PM, Linus Walleij wrote:
>>> On Tue, Sep 9, 2014 at 10:32 AM, Lothar Waßmann <LW@karo-electronics.de> 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
next prev parent reply other threads:[~2014-09-24 12:28 UTC|newest]
Thread overview: 16+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-09-09 8:32 [PATCH] gpio: pca953x: Fix warning when HW interrupts are rescheduled by the softirq tasklet Lothar Waßmann
2014-09-09 8:32 ` Lothar Waßmann
2014-09-23 12:04 ` Linus Walleij
2014-09-23 12:26 ` Grygorii Strashko
2014-09-23 12:26 ` Grygorii Strashko
2014-09-24 11:17 ` Linus Walleij
2014-09-24 11:17 ` Linus Walleij
2014-09-24 12:28 ` Grygorii Strashko [this message]
2014-09-24 12:28 ` Grygorii Strashko
2014-09-25 8:07 ` Linus Walleij
2014-09-25 16:26 ` Grygorii Strashko
2014-09-26 9:07 ` Linus Walleij
2015-07-07 6:29 ` Christian Gmeiner
2015-07-07 10:00 ` Grygorii Strashko
2015-07-07 12:37 ` Christian Gmeiner
2015-07-16 12:39 ` Linus Walleij
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=5422B8F0.9060803@ti.com \
--to=grygorii.strashko@ti.com \
--cc=LW@karo-electronics.de \
--cc=gnurou@gmail.com \
--cc=linus.walleij@linaro.org \
--cc=linux-gpio@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.