Skip to content

gpiolib: some fixup patches

Alexandre Courbot lkml 1 version Applied

Status from this message: Applied, thanks.

Get series with b4
b4 am [email protected]

Versions newest first

  1. v2 Latest4 patches 10 repliesApplied

Changes in v2 from the cover letter

- as suggested by Ryan Mallon, add a dedicated control flow for signaling invalid GPIOs to avoid meaningless error messages and ugly ternary operators
- use pr_warn instead of pr_debug to signal invalid GPIOs
- do descriptors validity check before acquiring any lock

Patches in v2 Applied

#Subject and filesSizeRepliesApplied
1/4gpiolib: check descriptors validity before usedrivers/gpio/gpiolib.c+65 -471 reply
2/4gpiolib: use const parameters when possibledrivers/gpio/gpiolib.c+16 -131 reply
3/4gpiolib: move comment to right functiondrivers/gpio/gpiolib.c+1 -10 replies
4/4gpiolib: rename local offset variables to "hwgpio"drivers/gpio/gpiolib.c+35 -351 reply

Reviews trailers per patch

No Reviewed-by, Acked-by or Tested-by trailers for v2 yet.

Read the v2 thread

Cover letter [PATCH v2 0/4] gpiolib: some fixup patches

This short series is a fixup to patch 6/9 of my previous series ("gpiolib: use descriptors internally"), which mainly addresses issues raised by Linus W. in this patch and a few other minor ones caught while proof-reading gpiolib.

First patch is the most significant. It mostly avoids oopses when passing an invalid GPIO to some functions. Also gpio_get/set_value*() now return 0 when given an invalid GPIO number instead of oopsing. I tend to think that's an improvement, but if it's not please let me know.

Ideally these patches should be melded into the above-mentioned patch since they were intended to become a new revision, but I leave that decision to Grant's discretion.

This patchset has been tested on Tegra 2/Ventana with a GPIO backlight driver and the sysfs interface.

Changes from v1:
- as suggested by Ryan Mallon, add a dedicated control flow for signaling invalid GPIOs to avoid meaningless error messages and ugly ternary operators
- use pr_warn instead of pr_debug to signal invalid GPIOs
- do descriptors validity check before acquiring any lock

Alexandre Courbot (4):
gpiolib: check descriptors validity before use
gpiolib: use const parameters when possible
gpiolib: move comment to right function
gpiolib: rename local offset variables to "hwgpio"

 drivers/gpio/gpiolib.c | 213 +++++++++++++++++++++++++++----------------------
 1 file changed, 117 insertions(+), 96 deletions(-)
Signature · 1 line
1.8.1.3