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: <CAMuHMdUQbRqyv1FK5JTbL-XL_YPZx8Sf9tQfU-eCozCNyDXYBA@mail.gmail.com>
Date:   Tue, 7 Jan 2020 09:11:07 +0100
From:   Geert Uytterhoeven <geert@...ux-m68k.org>
To:     Frank Rowand <frowand.list@...il.com>
Cc:     Geert Uytterhoeven <geert+renesas@...der.be>,
        Linus Walleij <linus.walleij@...aro.org>,
        Bartosz Golaszewski <bgolaszewski@...libre.com>,
        Pantelis Antoniou <pantelis.antoniou@...sulko.com>,
        Rob Herring <robh+dt@...nel.org>,
        Peter Ujfalusi <peter.ujfalusi@...com>,
        Chris Brandt <chris.brandt@...esas.com>,
        "open list:GPIO SUBSYSTEM" <linux-gpio@...r.kernel.org>,
        "open list:OPEN FIRMWARE AND FLATTENED DEVICE TREE BINDINGS" 
        <devicetree@...r.kernel.org>,
        Linux-Renesas <linux-renesas-soc@...r.kernel.org>,
        Linux Kernel Mailing List <linux-kernel@...r.kernel.org>
Subject: Re: [PATCH/RFC 2/2] gpio: of: Add DT overlay support for GPIO hogs

Hi Frank,

On Tue, Jan 7, 2020 at 8:10 AM Frank Rowand <frowand.list@...il.com> wrote:
> On 1/6/20 5:34 PM, Frank Rowand wrote:
> > On 12/30/19 7:38 AM, Geert Uytterhoeven wrote:
> >> As GPIO hogs are configured at GPIO controller initialization time,
> >> adding/removing GPIO hogs in DT overlays does not work.
> >>
> >> Add support for GPIO hogs described in DT overlays by registering an OF
> >> reconfiguration notifier, to handle the addition and removal of GPIO hog
> >> subnodes to/from a GPIO controller device node.
> >>
> >> Note that when a GPIO hog device node is being removed, its "gpios"
> >> properties is no longer available, so we have to keep track of which
> >> node a hog belongs to, which is done by adding a pointer to the hog's
> >> device node to struct gpio_desc.
> >
> > If I have read the patches and the existing overlay source correctly,
> > then some observations:
> >
> > - A gpio hog node added in an overlay will be properly processed.
> >
> > - A gpio hog node already existing in the live devicetree, but with a
> >   non-active status will be properly processed if the status of the
> >   gpio hog node is changed to "ok" in the overlay.
> >
> > - If a gpio hog node already exists in the live devicetree with an
> >   active status, then any updated or added properties in that gpio
> >   hog node in the overlay will have no effect.
> >
> >   There is a scenario where the updated property would have an effect:
> >   apply a second overlay that sets the status to inactive, then apply
> >   a third overlay that sets the status back to active.  This is a
> >   rather contrived example and I think it should be documented as
> >   not supported and the result undefined.
>
> I went back and double checked the related code.  For gpio hog nodes
> that are in a non-overlay, the status property is checked because
> of_gpiochip_scan_gpios() uses for_each_available_child_of_node()
> to search for gpio hog nodes, and for_each_available_child_of_node()
> checks the status property.  But in the case of a gpio hog node
> added by an overlay, of_gpio_notify() does not check the status
> property in the gpio hog node.  The check for the status property
> should be added to of_gpio_notify().

Right.  of_device_is_available() should be called to check this.
Note that of_i2c_notify() and of_spi_notify() also lack such a check.
of_platform_notify() calls of_platform_device_create_pdata(), which does
have the check.

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