[PATCH 0/3] gpio: uclass enhancements for DM_GPIO drivers

Samuel Holland samuel at sholland.org
Sun Sep 12 00:05:50 CEST 2021


This series makes a couple of enhancements to the generic GPIO code that
simplified updating some DM_GPIO drivers.

Patches 1-2 add bounds checking when looking up GPIOs by name and from
the device tree. After this, all functions that fill out a gpio_desc
ensure the offset field is in bounds, so each driver doesn't need
separate bounds checking in its ops functions.

Patch 3 allows the GPIO flag translation code to be shared by drivers
that use the same flags, but cannot use gpio_xlate_offs_flags directly.
For example, the sunxi GPIO binding has 3 cells because it separates the
bank and pin numbers.


Samuel Holland (3):
  gpio: Verify validity of pin offsets when looking up names
  gpio: Verify validity of pin offsets from device trees
  gpio: Factor out DT flag translation

 drivers/gpio/gpio-uclass.c | 55 +++++++++++++++++++++++---------------
 include/asm-generic/gpio.h |  8 ++++++
 2 files changed, 42 insertions(+), 21 deletions(-)

-- 
2.31.1



More information about the U-Boot mailing list