[RFT PATCH v2] spi: bcm2835: reduce the abuse of the GPIO API

Mark Brown broonie at kernel.org
Fri Sep 1 05:57:54 PDT 2023


On Fri, Sep 01, 2023 at 02:33:03PM +0200, Bartosz Golaszewski wrote:
> On Fri, Sep 1, 2023 at 2:31 PM Mark Brown <broonie at kernel.org> wrote:
> > On Fri, Sep 01, 2023 at 02:15:39PM +0200, Linus Walleij wrote:
> > > On Fri, Sep 1, 2023 at 1:15 PM Bartosz Golaszewski <brgl at bgdev.pl> wrote:

> > > > +       struct gpiod_lookup_table *lookup __free(kfree) = NULL;

> > > This is really neat.
> > > As noted, it will confuse static checkers at no end, but they just have
> > > to adopt. (CC to Dan C if he now runs into this.)

> > It also doesn't look amazing for humans, it's very not C like...

> Once it's widely adopted, you'll see how much clearer and less prone
> to bugs in error paths the code becomes with autopointers. It's 2023
> dammit, if we can't have flying cars, let's at least get some RAII
> into the kernel. :)

I use RAII extensively with other languages, I also know that with C you
have to be careful and look to make sure everything is freed.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 488 bytes
Desc: not available
URL: <http://lists.infradead.org/pipermail/linux-arm-kernel/attachments/20230901/aec6451f/attachment.sig>


More information about the linux-arm-kernel mailing list