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: <20210128135808.ttvd2xxjkmsqanr7@pengutronix.de>
Date:   Thu, 28 Jan 2021 14:58:08 +0100
From:   Oleksij Rempel <o.rempel@...gutronix.de>
To:     Linus Walleij <linus.walleij@...aro.org>
Cc:     "open list:OPEN FIRMWARE AND FLATTENED DEVICE TREE BINDINGS" 
        <devicetree@...r.kernel.org>,
        Ahmad Fatoum <a.fatoum@...gutronix.de>,
        linux-iio <linux-iio@...r.kernel.org>,
        Robin van der Gracht <robin@...tonic.nl>,
        William Breathitt Gray <vilhelm.gray@...il.com>,
        "linux-kernel@...r.kernel.org" <linux-kernel@...r.kernel.org>,
        Rob Herring <robh+dt@...nel.org>,
        Pengutronix Kernel Team <kernel@...gutronix.de>,
        David Jander <david@...tonic.nl>
Subject: Re: [PATCH v4 2/2] counter: add IRQ or GPIO based pulse counter

On Thu, Jan 28, 2021 at 09:24:08AM +0100, Linus Walleij wrote:
> Hi Oleksij,
> 
> thanks for your patch!
> 
> On Tue, Jan 26, 2021 at 2:15 PM Oleksij Rempel <o.rempel@...gutronix.de> wrote:
> 
> > +       priv->irq = platform_get_irq(pdev,  0);
> > +       if (priv->irq < 0) {
> > +               dev_err(dev, "failed to map GPIO to IRQ: %d\n", priv->irq);
> > +               return priv->irq;
> > +       }
> > +
> > +       priv->gpio = devm_gpiod_get_optional(dev, NULL, GPIOD_IN);
> > +       if (IS_ERR(priv->gpio))
> > +               return dev_err_probe(dev, PTR_ERR(priv->gpio), "failed to get gpio\n");
> 
> I would attempt to get the IRQ from the GPIO if not defined explicitly
> in the device tree.
> 
> priv->gpio = devm_gpiod_get_optional(...)
> if (priv->gpio) {
>     /* Attempt to look up IRQ */
>     irq = gpiod_to_irq(priv->irq);
> }
> priv->irq = platfform_get_irq(...)
> if (priv->irq < 0 && irq > 0) {
>     /* Use the GPIO-related IRQ */
>     priv->irq = irq;
> } else if (priv->irq < 0) {
>    /* Error */
> }
> 
> This way the example in the device tree binding which only defines
> a GPIO and no interrupt will work if the GPIO chip provides an
> IRQ mapping.
> 

Ok, thx!
I'll send updated version after dt-binding discussion

Regards,
Oleksij
-- 
Pengutronix e.K.                           |                             |
Steuerwalder Str. 21                       | http://www.pengutronix.de/  |
31137 Hildesheim, Germany                  | Phone: +49-5121-206917-0    |
Amtsgericht Hildesheim, HRA 2686           | Fax:   +49-5121-206917-5555 |

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ