[PATCH 02/21] gpiolib: provide gpio_device_find()

Linus Walleij linus.walleij at linaro.org
Thu Sep 7 00:05:22 PDT 2023


On Tue, Sep 5, 2023 at 8:53 PM Bartosz Golaszewski <brgl at bgdev.pl> wrote:

> From: Bartosz Golaszewski <bartosz.golaszewski at linaro.org>
>
> gpiochip_find() is wrong and its kernel doc is misleading as the
> function doesn't return a reference to the gpio_chip but just a raw
> pointer. The chip itself is not guaranteed to stay alive, in fact it can
> be deleted at any point. Also: other than GPIO drivers themselves,
> nobody else has any business accessing gpio_chip structs.
>
> Provide a new gpio_device_find() function that returns a real reference
> to the opaque gpio_device structure that is guaranteed to stay alive for
> as long as there are active users of it.
>
> Signed-off-by: Bartosz Golaszewski <bartosz.golaszewski at linaro.org>


Reviewed-by: Linus Walleij <linus.walleij at linaro.org>

Yours,
Linus Walleij



More information about the linux-arm-kernel mailing list