Re: [PATCH 02/36] pinctrl: provide new GPIO-to-pinctrl glue helpers

From: Andy Shevchenko
Date: Tue Oct 03 2023 - 11:08:55 EST


On Tue, Oct 3, 2023 at 5:51 PM Bartosz Golaszewski <brgl@xxxxxxxx> wrote:
>
> From: Bartosz Golaszewski <bartosz.golaszewski@xxxxxxxxxx>
>
> Currently the pinctrl GPIO helpers all take a number from the global
> GPIO numberspace - of which we're trying to get rid of as argument.
>
> These helpers are almost universally called from GPIOLIB driver
> callbacks which take a pointer to the backing gpio_chip and the
> controller-relative offset as arguments.
>
> Let's provide improved variants of these functions that match the
> GPIOLIB signatures as the first step in removing the older flavor.

...

> +#include <linux/gpio/driver.h>

+ blank line here

> #include <linux/pinctrl/consumer.h>
> #include <linux/pinctrl/devinfo.h>
> #include <linux/pinctrl/machine.h>

...

> EXPORT_SYMBOL_GPL(pinctrl_gpio_can_use_line);

> +/* This function is deprecated and will be removed. Don't use. */

Shouldn't the same / similar comment be added to
pinctrl_gpio_can_use_line() above?

...

> + * pinctrl_gpio_request_new() - request a single pin to be used as GPIO

"new" is too broad and too odd suffix, what I would see as a better
alternative(s) is (are):

pinctrl_gpiochip_request()
pinctrl_gpio_chip_request()
pinctrl_gc_request()

(sorted by personal preference from high to low).

The similar comment to all of them.

...

> * This function should *ONLY* be used from gpiolib-based GPIO drivers,
> - * as part of their gpio_free() semantics, platforms and individual drivers
> - * shall *NOT* request GPIO pins to be muxed out.
> + * as part of their gpio_request() semantics, platforms and individual drivers
> + * shall *NOT* request GPIO pins to be muxed in.

Hmm... This looks like a fix to the previous code that can even be backported.

> */

--
With Best Regards,
Andy Shevchenko