Re: [PATCH 2/2] gpiolib: rename gpio_chip_hwgpio() for consistency

From: Linus Walleij
Date: Wed Sep 06 2023 - 17:39:58 EST


On Tue, Sep 5, 2023 at 10:37 AM Bartosz Golaszewski <brgl@xxxxxxxx> wrote:

> gpio_chip_hwgpio() is a
> terrible name and if I didn't know, I couldn't tell you what it does
> just from looking at the name.

Probably my fault.

"For the chip containing this desc obtain the corresponding
hardware GPIO number/offset" is what I would put in kerneldoc.
(Which is by the way also horrible.)

Let's rename it to something that says clearly what it does.
(Rusty Russell's API design hierarchy.)

I guess I would just name it something like *_get_chip_hw_offset()
or *_get_chip_hwgpio_offset() but it gets a bit long, maybe it is a bit
talkative but easy to understand. (I stay off the prefix discussion.)

Yours,
Linus Walleij