Linux GPIO subsystem development
 help / color / mirror / Atom feed
* [PATCH v4 00/10] gpio: make gpiolib-shared more fwnode-centric
@ 2026-11-26  9:36 Bartosz Golaszewski
  2026-11-26  9:36 ` [PATCH v4 01/10] lib: string_helpers: export and rename struct strarray Bartosz Golaszewski
                   ` (9 more replies)
  0 siblings, 10 replies; 12+ messages in thread
From: Bartosz Golaszewski @ 2026-11-26  9:36 UTC (permalink / raw)
  To: Andy Shevchenko, Daniel Scally, Heikki Krogerus, Sakari Ailus,
	Bartosz Golaszewski, Greg Kroah-Hartman, Rafael J. Wysocki,
	Danilo Krummrich, Johan Hovold, Hans Verkuil, Laurent Pinchart,
	Kees Cook, Andy Shevchenko, Len Brown, Rob Herring,
	Saravana Kannan, Linus Walleij, Andrew Morton,
	Gustavo A. R. Silva
  Cc: linux-acpi, driver-core, linux-kernel, linux-hardening,
	devicetree, linux-gpio, Bartosz Golaszewski

Currently the code in gpiolib-shared.c only supports OF nodes and uses a
lot of OF-specific APIs. This series attempts to make the code more
generic, ahead of extending support for sharing GPIOs to other types of
firmware nodes, by defining two new fwnode operations, implementing them
for OF nodes and using them in GPIOLIB in order to limit the OF-specific
API usage to only a few places guarded by ifdefs.

The new fwnode APIs are:
a) property_get_names() - this closes the gap between OF nodes and
   fwnodes: OF nodes allow users to iterate over all properties while
   fwnodes don't advertise all properties in any way at the moment
b) count_references() - there's currently no way of counting references
   in an fwnode reliably: using fwnode_property_get_reference_args()
   does not work for empty references (e.g.: phandle = <0>, <&foo 1 2>;)

The first patch adds a CLASS() for string arrays. The following 6 define
and implement new fwnode operations. The final patch generalizes the code
in gpiolib-shared.c.

Merging strategy: patches 1-8 should go through the driver core tree and
be provided on an immutable branch to me so that I can pull it and queue
the final 2 patches via the GPIO tree.

This series depends on the series from Alejandro Colomar adding
strprefix() as indicated in the b4 tracking.

Signed-off-by: Bartosz Golaszewski <bartosz.golaszewski@oss.qualcomm.com>
---
Changes in v4:
- Rebase on a smaller bugfix subset of Alejandro's series and go back to
  using strends() instead of the proposed strsuffix() which doesn't
  cause problems ATM
- Pick up more R-b tags
- Link to v3: https://patch.msgid.link/20261120-fwnode-for-each-prop-v3-0-808e304dc73e@oss.qualcomm.com

Changes in v3:
- Rebase on top of v6 of the strprefix() series
- Initialize variables managed with __free() at declaration (Sashiko)
- Unuglyfy the usage of IS_ENABLED(CONFIG_OF) (Andy)
- Pick up tags
- Link to v2: https://patch.msgid.link/20261113-fwnode-for-each-prop-v2-0-4edc23d5cf50@oss.qualcomm.com

Changes in v2:
- Integrate the series from from Alejandro Colomar adding strprefix() into
  this series as a b4 dependency
- Reuse the existing struct strarray in the new CLASS() for string
  arrays
- Make sure that props != NULL in fwnode_property_get_names()
- Replace string.h with string_helpers.h instead of including both
- Tweak the kerneldocs (Andy)
- Use size_add() from overflow.h
- Mark gpio_shared_fwnode_traverse() as __maybe_unused for !CONFIG_OF
- Return early in the OF variant of fwnode_property_get_names() if no
  properties are defined
- Add commit removing unused leftover code
- Remove useless alias variables
- Link to v1: https://patch.msgid.link/20261104-fwnode-for-each-prop-v1-0-6e28fe1c72c4@oss.qualcomm.com

---
Bartosz Golaszewski (10):
      lib: string_helpers: export and rename struct strarray
      lib: string_helpers: implement a CLASS() for string arrays
      fwnode: define the property_get_names() operation
      device property: provide fwnode_property_get_names()
      of: property: implement the .property_get_names() fwnode operation
      fwnode: define the count_references() fwnode operation
      device property: provide fwnode_property_count_references()
      of: property: implement the count_references() fwnode operation
      gpio: shared: remove unused field from struct gpio_shared_entry
      gpio: shared: generalize most code to firmware nodes

 drivers/base/property.c        | 115 +++++++++++++++++++-
 drivers/gpio/gpiolib-shared.c  | 239 +++++++++++++++++++++--------------------
 drivers/of/property.c          |  41 ++++++-
 include/linux/fwnode.h         |  15 +++
 include/linux/property.h       |   4 +
 include/linux/string_helpers.h |  12 +++
 lib/string_helpers.c           |   9 +-
 7 files changed, 312 insertions(+), 123 deletions(-)
---
base-commit: 47588e4c16d8876d3058bcec030ed8a016794b9e
change-id: 20260916-fwnode-for-each-prop-d7a6f90e7338
prerequisite-message-id: <cover.1795639368.git.alx@kernel.org>
prerequisite-patch-id: 82777ef50a2bc99b1e6f163a2dfcb795093d391f
prerequisite-patch-id: f2667cbc4cf347427b2dccb23e19aefff373b3de
prerequisite-patch-id: 62b224f17ce0f2e68e8963de1180d9764dd24fe1
prerequisite-patch-id: 49110713d1b10ae2972ae738da383215d9be001b

Best regards,
-- 
Bartosz Golaszewski <bartosz.golaszewski@oss.qualcomm.com>


^ permalink raw reply	[flat|nested] 12+ messages in thread

end of thread, other threads:[~2026-11-26  9:47 UTC | newest]

Thread overview: 12+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-11-26  9:36 [PATCH v4 00/10] gpio: make gpiolib-shared more fwnode-centric Bartosz Golaszewski
2026-11-26  9:36 ` [PATCH v4 01/10] lib: string_helpers: export and rename struct strarray Bartosz Golaszewski
2026-11-26  9:36 ` [PATCH v4 02/10] lib: string_helpers: implement a CLASS() for string arrays Bartosz Golaszewski
2026-11-26  9:36 ` [PATCH v4 03/10] fwnode: define the property_get_names() operation Bartosz Golaszewski
2026-11-26  9:36 ` [PATCH v4 04/10] device property: provide fwnode_property_get_names() Bartosz Golaszewski
2026-11-26  9:36 ` [PATCH v4 05/10] of: property: implement the .property_get_names() fwnode operation Bartosz Golaszewski
2026-11-26  9:47   ` sashiko-bot
2026-11-26  9:36 ` [PATCH v4 06/10] fwnode: define the count_references() " Bartosz Golaszewski
2026-11-26  9:36 ` [PATCH v4 07/10] device property: provide fwnode_property_count_references() Bartosz Golaszewski
2026-11-26  9:36 ` [PATCH v4 08/10] of: property: implement the count_references() fwnode operation Bartosz Golaszewski
2026-11-26  9:36 ` [PATCH v4 09/10] gpio: shared: remove unused field from struct gpio_shared_entry Bartosz Golaszewski
2026-11-26  9:36 ` [PATCH v4 10/10] gpio: shared: generalize most code to firmware nodes Bartosz Golaszewski

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox