Re: [PATCH v2 1/5] gpio: add support to get local gpio number
From: Linus Walleij
Date: Fri Nov 29 2019 - 04:33:07 EST
Hi Marco,
thanks for your patch!
On Wed, Nov 27, 2019 at 2:59 PM Marco Felsch <m.felsch@xxxxxxxxxxxxxx> wrote:
> Sometimes consumers needs to know the gpio-chip local gpio number of a
> 'struct gpio_desc' for further configuration. This is often the case for
> mfd devices.
>
> Signed-off-by: Marco Felsch <m.felsch@xxxxxxxxxxxxxx>
(...)
> +int gpiod_to_offset(struct gpio_desc *desc)
> +{
> + return gpio_chip_hwgpio(desc);
> +}
> +EXPORT_SYMBOL_GPL(gpiod_to_offset);
That seems like an unnecessary wrapper.
What about renaming gpio_chip_hwgpio() everywhere
to gpiod_to_offet(), remove it from drivers/gpio/gpiolib.h
and export it in <linux/gpio/consumer.h> instead?
I suppose this is what Bartosz is indicating, not sure though.
Indeed it is a bit of a worrysome thing to export and we need
to be very specific about its usecase, so I'd also like some
nice to-the-point kerneldoc on the export site so that it is
clear what corner cases this function is for. (Like in this
specific driver.)
Yours,
Linus Walleij