Re: [PATCH v2 6/8] gpiolib: remove legacy gpio_export

From: Arnd Bergmann
Date: Tue Nov 09 2021 - 17:48:01 EST


On Tue, Nov 9, 2021 at 9:42 PM Linus Walleij <linus.walleij@xxxxxxxxxx> wrote:
> On Tue, Nov 9, 2021 at 11:50 AM Arnd Bergmann <arnd@xxxxxxxxxx> wrote:
>
> > I think the TODO list is in Linus' head,
>
> Oh no, drivers/gpio/TODO
>
> > but it would include all the files
> > that use one of the interfaces in linux/gpio.h. I found about 350 of them,
> > so there is little point in listing them one at a time. IIRC Linus is going
> > through those one subsystem at a time.
>
> Yeah but if it's just me I doubt that I will manage to do it by the
> time I retire in 2037 or so... So the TODO is there to inspire others
> to step in and help out.

I think at the current rate, it should only take about another ten years: ;-)

$ for i in v3.18 v4.1 v4.4 v4.9 v4.14 v4.19 v5.4 v5.10 v5.15 ; do echo
-n $i\ ; git grep -wl
'\<\(gpio_direction_input\|gpio_direction_output\|gpio_get_value_cansleep\|gpio_set_value_cansleep\|gpio_get_value\|gpio_set_value\|gpio_to_irq\|gpio_request\|gpio_request_one\|gpio_request_array\)\>\|\<\(ARCH_NR_GPIOS\|GPIOF_DIR_\|GPIOF_INIT\|GPIOF_EXPORT\|GPIOF_OPEN\|GPIOF_IN\|GPIOF_OUT\|gpio_is_valid\\|gpio_free\|devm_gpio_\)'
$i | wc -l ; done
v3.18 676
v4.1 669
v4.4 646
v4.9 639
v4.14 614
v4.19 553
v5.4 465
v5.10 381
v5.15 354

I'm a fan of deconstruction interfaces one function call at a time, which
is different from your one-subsystem at a time approach, but these can
obviously be done at the same time. This 8-patch series is hopefully a good
step in that direction, removing some of the more obscure interfaces
and making the rest a little more obvious.

I've also started a patch series to remove some of the less common
of_gpio portions, which gets rid of of_get_gpio(), of_get_gpio_flags()
and of_get_named_gpio_flags() but leaves of_get_named_gpio() in
place for now. I'm much less confident about that work though, so I
haven't posted that. I think killing off the of_gpio consumer-side
interfaces entirely would likely make the biggest impact, as those
appear to still be used a lot in relatively modern drivers, while the
traditional gpio_request() interfaces are mainly used in drivers for
legacy boards that don't have a long future ahead of them unless
they get converted to DT.

Arnd