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: <CAHp75Vdm-um7Ep=kfjEnDotJrbXi1vtfPUVJgcogou8Gr9+MQQ@mail.gmail.com>
Date:   Sat, 7 Oct 2023 10:03:45 +0300
From:   Andy Shevchenko <andy.shevchenko@...il.com>
To:     Linus Walleij <linus.walleij@...aro.org>
Cc:     Bartosz Golaszewski <brgl@...ev.pl>,
        Andy Shevchenko <andy@...nel.org>, linux-gpio@...r.kernel.org,
        linux-kernel@...r.kernel.org, Dipen Patel <dipenp@...dia.com>,
        Bartosz Golaszewski <bartosz.golaszewski@...aro.org>
Subject: Re: [RFC/RFT PATCH] gpiolib: reverse-assign the fwnode to struct gpio_chip

On Sat, Oct 7, 2023 at 1:14 AM Linus Walleij <linus.walleij@...aro.org> wrote:
> On Fri, Oct 6, 2023 at 1:51 PM Bartosz Golaszewski <brgl@...ev.pl> wrote:
>
> > struct gpio_chip is not only used to carry the information needed to
> > set-up a GPIO device but is also used in all GPIOLIB callbacks and is
> > passed to the matching functions of lookup helpers.
> >
> > In that last case, it is currently impossible to match a GPIO device by
> > fwnode unless it was explicitly assigned to the chip in the provider
> > code. If the fwnode is taken from the parent device, the pointer in
> > struct gpio_chip will remain NULL.
> >
> > If we have a parent device but gc->fwnode was not assigned by the
> > provider, let's assign it ourselves so that lookup by fwnode can work in
> > all cases.
> >
> > Signed-off-by: Bartosz Golaszewski <bartosz.golaszewski@...aro.org>
>
> Acked-by: Linus Walleij <linus.walleij@...aro.org>
>
> because we want the code to work (rough consensus and running code)
>

> The core of the crux is that we have
> information duplication with a reference to the fwnode in two
> places. One in gdev->dev and one in gc->fwnode.

No, we don't. We have plenty of drivers that have gc->fwnode == NULL,
which means that it is shared with the parent device.


...

> A gdev is created for each gpio_chip so in my naive brain we could
> get rid of gc->fwnode and only have the one inside gdev->dev?
> +/- some helpful getters/setters if need be.
>
> Or what am I thinking wrong here?

That would work I think. But I'm definitely against this change. It is
the way to nowhere. We should really be quite strict about fwnode and
do NOT assign the gc one behind the provider's back. If something is
not working in this scenario, that should be fixed and not with a hack
like this.

-- 
With Best Regards,
Andy Shevchenko

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ