Re: [PATCH] gpiolib: Check gc->get_direction() before calling gpiod_get_direction()
From: Bartosz Golaszewski
Date: Fri Jul 31 2026 - 04:36:52 EST
On Wed, 29 Jul 2026 11:47:20 +0200, Christophe Leroy (CS GROUP) wrote:
> According to 'struct gpio_chip' documentation in linux/gpio/driver.h,
> implementing .get_direction() is recommended but not mandatory.
> Most places verify that gc->get_direction() exists before calling
> gpiod_get_direction(), but gpiolib_dbg_show() doesn't.
>
> Until commit 471e998c0e31 ("gpiolib: remove redundant callback check")
> it was also verified by gpiod_get_direction() itself so calling it at
> all time from gpiolib_dbg_show() was not an issue. But after the check
> in gpiod_get_direction() has been removed, calling it inconditionaly
> leads to a big fat warning in gpiochip_get_direction().
>
> [...]
Applied, thanks!
[1/1] gpiolib: Check gc->get_direction() before calling gpiod_get_direction()
https://git.kernel.org/brgl/c/d761c7e38a000603a9d16270a1af770a0e8efb5e
Best regards,
--
Bartosz Golaszewski <bartosz.golaszewski@xxxxxxxxxxxxxxxx>