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: <CAMuHMdWctqTZRzrHfTsxnK0JNDa1k0o8SNcGMCG1DejoZM70yw@mail.gmail.com>
Date:   Mon, 4 Oct 2021 17:13:54 +0200
From:   Geert Uytterhoeven <geert@...ux-m68k.org>
To:     Andy Shevchenko <andy.shevchenko@...il.com>
Cc:     Linus Walleij <linus.walleij@...aro.org>,
        Bartosz Golaszewski <bgolaszewski@...libre.com>,
        Viresh Kumar <viresh.kumar@...aro.org>,
        metux IT consult <lkml@...ux.net>,
        Andy Shevchenko <andriy.shevchenko@...ux.intel.com>,
        Arnd Bergmann <arnd@...nel.org>,
        "open list:GPIO SUBSYSTEM" <linux-gpio@...r.kernel.org>,
        Linux-Renesas <linux-renesas-soc@...r.kernel.org>,
        Linux Kernel Mailing List <linux-kernel@...r.kernel.org>,
        virtualization@...ts.linux-foundation.org,
        stratos-dev@...lists.linaro.org
Subject: Re: [PATCH] gpio: aggregator: Add interrupt support

Hi Andy,

On Mon, Oct 4, 2021 at 3:21 PM Andy Shevchenko
<andy.shevchenko@...il.com> wrote:
> On Mon, Oct 4, 2021 at 3:45 PM Geert Uytterhoeven
> <geert+renesas@...der.be> wrote:
> > Currently the GPIO Aggregator does not support interrupts.  This means
> > that kernel drivers going from a GPIO to an IRQ using gpiod_to_irq(),
> > and userspace applications using line events do not work.
> >
> > Add interrupt support by providing a gpio_chip.to_irq() callback, which
> > just calls into the parent GPIO controller.
> >
> > Note that this does not implement full interrupt controller (irq_chip)
> > support, so using e.g. gpio-keys with "interrupts" instead of "gpios"
> > still does not work.
>
> ...
>
> > @@ -414,7 +421,8 @@ static struct gpiochip_fwd *gpiochip_fwd_create(struct device *dev,
> >         for (i = 0; i < ngpios; i++) {
> >                 struct gpio_chip *parent = gpiod_to_chip(descs[i]);
> >
> > -               dev_dbg(dev, "%u => gpio-%d\n", i, desc_to_gpio(descs[i]));
> > +               dev_dbg(dev, "%u => gpio %d irq %d\n", i,
> > +                       desc_to_gpio(descs[i]), gpiod_to_irq(descs[i]));
>
> This is an unconditional call that will allocate the IRQ descriptor

If DEBUG and CONFIG_DYNAMIC_DEBUG* are not enabled, it's a no-op
(protected by if (0) { ... }).
If CONFIG_DYNAMIC_DEBUG is enabled, the operation is a no-op if not
enabled dynamically (if (dynamic_checl) { ... }).
If DEBUG (CONFIG_DEBUG_GPIO) is enabled, the output is wanted.

(yes, I've just checked the preprocessor and assembler output ;-).

> even if we don't use it. Correct?

It calls .to_irq() of the parent GPIO controller, which is usually
just doing some offset addition.  But that's driver-dependent.

> If so, I don't like this.

No worries, desc_to_gpio() and gpiod_to_irq() are only evaluated when
the debug output is wanted.

Gr{oetje,eeting}s,

                        Geert


--
Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- geert@...ux-m68k.org

In personal conversations with technical people, I call myself a hacker. But
when I'm talking to journalists I just say "programmer" or something like that.
                                -- Linus Torvalds

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ