lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <5422B8F0.9060803@ti.com>
Date:	Wed, 24 Sep 2014 15:28:32 +0300
From:	Grygorii Strashko <grygorii.strashko@...com>
To:	Linus Walleij <linus.walleij@...aro.org>
CC:	Lothar Waßmann <LW@...o-electronics.de>,
	"linux-gpio@...r.kernel.org" <linux-gpio@...r.kernel.org>,
	"linux-kernel@...r.kernel.org" <linux-kernel@...r.kernel.org>,
	Alexandre Courbot <gnurou@...il.com>
Subject: Re: [PATCH] gpio: pca953x: Fix warning when HW interrupts are rescheduled
 by the softirq tasklet

On 09/24/2014 02:17 PM, Linus Walleij wrote:
> On Tue, Sep 23, 2014 at 2:26 PM, Grygorii Strashko
> <grygorii.strashko@...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@...o-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-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ