Devicetree
 help / color / mirror / Atom feed
* [PATCH v2 00/10] gpio: make gpiolib-shared more fwnode-centric
@ 2026-11-13 15:47 Bartosz Golaszewski
  2026-11-13 15:47 ` [PATCH v2 01/10] lib: string_helpers: export and rename struct strarray Bartosz Golaszewski
                   ` (9 more replies)
  0 siblings, 10 replies; 18+ messages in thread
From: Bartosz Golaszewski @ 2026-11-13 15:47 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 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: removed 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  | 242 ++++++++++++++++++++++-------------------
 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, 315 insertions(+), 123 deletions(-)
---
base-commit: 161837d37055642b03475137461d4438c65dbddf
change-id: 20260916-fwnode-for-each-prop-d7a6f90e7338
prerequisite-message-id: <cover.1794574496.git.alx@kernel.org>
prerequisite-patch-id: 6c8ea11afdfadea1c72457e460596f9140195f8a
prerequisite-patch-id: 81834766a605fc75e62501a8459944c87aa7848e
prerequisite-patch-id: 49110713d1b10ae2972ae738da383215d9be001b
prerequisite-patch-id: 97bf1ce8e594218715d5df30711d0523c7f07bc5
prerequisite-patch-id: c94cdf0377763fbdcb942add8a058161503f9024
prerequisite-patch-id: d0e6af689d680619ee07aabb50635328052bc9af
prerequisite-patch-id: 1006c25c87a8e46129fdba68822b9592c3f5e0e9

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


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

end of thread, other threads:[~2026-11-13 16:19 UTC | newest]

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

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