Re: [PATCH v2 5/8] gpiolib: shrink further
From: Linus Walleij
Date: Tue Nov 09 2021 - 17:20:13 EST
On Tue, Nov 9, 2021 at 12:18 PM Arnd Bergmann <arnd@xxxxxxxxxx> wrote:
> Ideally we should only use linux/gpio/consumer.h, which is required for
> gpiod_set_debounce(). of_gpio.h is still needed for of_get_named_gpio()
> and should be taken out once we change this to gpiod_get(), while
> linux/gpio.h is still needed for gpio_is_valid()/gpio_get_value() and should
> be removed when those are changed to the gpiod_ versions.
>
> We could do an intermediate patch that converts one half of the
> interface, something like
When I convert stuff I try to go all the way when I can. It can
be a bit daring if no one is there to test changes.
The patch looks good though apart from:
> - ts->gpio_pendown = pdata->gpio_pendown;
> + ts->gpio_pendown = gpio_to_desc(pdata->gpio_pendown);
I usually even go into the defined platform data and try to convert
the boardfile to use a descriptor table so this is never needed.
(But, more work.)
Examples:
git log -p --author=Walleij arch/arm/mach-pxa/
> - pdata->gpio_pendown = of_get_named_gpio(dev->of_node,
> "pendown-gpio", 0);
> + ts->gpio_pendown = gpiod_get(dev, "pendown-gpio", GPIOD_IN);
Needs to be just gpiod_get(dev, "pendown", GPIOD_IN); the new
API tries the "-gpio[s]" suffixes when going into the device tree.
Yours,
Linus Walleij