All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH v3 00/13] Introduce configfs-based interface for gpio-aggregator
@ 2025-02-16 12:58 Koichiro Den
  2025-02-16 12:58 ` [PATCH v3 01/13] gpio: aggregator: reorder functions to prepare for configfs introduction Koichiro Den
                   ` (13 more replies)
  0 siblings, 14 replies; 24+ messages in thread
From: Koichiro Den @ 2025-02-16 12:58 UTC (permalink / raw)
  To: linux-gpio
  Cc: brgl, geert+renesas, linus.walleij, maciej.borzecki, linux-kernel

This patch series introduces a configfs-based interface to gpio-aggregator
to address limitations in the existing 'new_device' interface.

The existing 'new_device' interface has several limitations:

  Issue#1. No way to determine when GPIO aggregator creation is complete.
  Issue#2. No way to retrieve errors when creating a GPIO aggregator.
  Issue#3. No way to trace a GPIO line of an aggregator back to its
           corresponding physical device.
  Issue#4. The 'new_device' echo does not indicate which virtual
           gpiochip<N> was created.
  Issue#5. No way to assign names to GPIO lines exported through an
           aggregator.

Although Issue#1 to #3 could technically be resolved easily without
configfs, using configfs offers a streamlined, modern, and extensible
approach, especially since gpio-sim and gpio-virtuser already utilize
configfs.

This v3 patch series includes 13 patches:

  Patch#1-7: Prepare for Patch#8
             * #1: Prepare for the following patches.
             * #2: Fix an issue that was spotted during v3 preparation.
             * #3: Add gpio-pseudo.[ch] to reduce code duplications.
             * #4: Update gpio-sim to use gpio-pseudo.[ch].
             * #5: Update gpio-virtuser to use gpio-pseudo.[ch].
             * #6: Update gpio-aggregator to use gpio-pseudo.[ch].
             * #7: Add aggr_alloc() to reduce code duplication.
  Patch#8:   Introduce basic configfs interface. Address Issue#1 to #4.
  Patch#9:   Address Issue#5.
  Patch#10:  Prepare for Patch#11.
  Patch#11:  Expose devices created with sysfs to configfs.
  Patch#12:  Suppress deferred probe for purely configfs-based aggregators.
  Patch#13:  Documentation for the new configfs interface.

N.B. v3 developed based on the latest gpio/for-next as of this writing:
c88aa6829739 ("phy: mapphone-mdm6600: use gpiod_multi_set_value_cansleep")


v2->v3 changes:
  - Addressed feedback from Bartosz:
    * Factored out the common mechanism for synchronizing platform device
      probe by adding gpio-pseudo.[ch].
    * Renamed "_auto." prefix to "_sysfs." for auto-generated
      configfs entries corresponding to sysfs-created devices.
    * Squashed v2 Patch#3 into its predecessor.
  - Addressed feedback from Geert:
    * Factored out duplicate code in struct gpio_aggregator initialization
      by adding gpio_alloc()/gpio_free() functions. Note that v2 Patch#7
      was dropped for other reasons as mentioned below, so aggr_free() in
      v3 is unrelated to the same-named function in v2.
    * Removed redundant parsing of gpio-line-names and unnecessary
      chip->names assignments; squashed v2 Patch#4 + v2 Patch#5 into v3
      Patch#9.
    * Updated to use sysfs_emit().
    * Updated Kconfig (select CONFIGFS_FS).
    * Fixed typos, coding style issues, missing const qualifiers, and other
      minor issues.
  - Resolved an issue that was spotted during v3 preparation. See Patch#2.
  - Reordered resource initialization order in gpio_aggregator_init() to
    both eliminate a potential race condition (as noted in the source code
    comment) and simplify the code. See Patch#8. This enabled:
    * Removal of v2 Patch#7.
    * Merging of aggr_unregister_lines() and aggr_free_lines() into a
      unified function.
  - Disabled 'delete_device' functionality for devices created via configfs
    for simplicity. It was mistakenly allowed in v2 and proved buggy. See
    Patch #8.

RFC->v2 changes:
  - Addressed feedback from Bartosz:
    * Expose devices created with sysfs to configfs.
    * Drop 'num_lines' attribute.
    * Fix bugs and crashes.
    * Organize internal symbol prefixes more cleanly.
  - Split diffs for improved reviewability.
  - Update kernel doc to reflect the changes.

v2: https://lore.kernel.org/all/20250203031213.399914-1-koichiro.den@canonical.com/
RFC (v1): https://lore.kernel.org/linux-gpio/20250129155525.663780-1-koichiro.den@canonical.com/T/#u


Koichiro Den (13):
  gpio: aggregator: reorder functions to prepare for configfs
    introduction
  gpio: aggregator: protect driver attr handlers against module unload
  gpio: pseudo: common helper functions for pseudo gpio devices
  gpio: sim: convert to use gpio-pseudo utilities
  gpio: virtuser: convert to use gpio-pseudo utilities
  gpio: aggregator: convert to use gpio-pseudo utilities
  gpio: aggregator: add aggr_alloc()/aggr_free()
  gpio: aggregator: introduce basic configfs interface
  gpio: aggregator: add 'name' attribute for custom GPIO line names
  gpio: aggregator: rename 'name' to 'key' in aggr_parse()
  gpio: aggregator: expose aggregator created via legacy sysfs to
    configfs
  gpio: aggregator: cancel deferred probe for devices created via
    configfs
  Documentation: gpio: document configfs interface for gpio-aggregator

 .../admin-guide/gpio/gpio-aggregator.rst      |  107 ++
 drivers/gpio/Kconfig                          |    8 +
 drivers/gpio/Makefile                         |    1 +
 drivers/gpio/gpio-aggregator.c                | 1129 ++++++++++++++---
 drivers/gpio/gpio-pseudo.c                    |   86 ++
 drivers/gpio/gpio-pseudo.h                    |   24 +
 drivers/gpio/gpio-sim.c                       |   84 +-
 drivers/gpio/gpio-virtuser.c                  |   73 +-
 8 files changed, 1189 insertions(+), 323 deletions(-)
 create mode 100644 drivers/gpio/gpio-pseudo.c
 create mode 100644 drivers/gpio/gpio-pseudo.h

-- 
2.45.2


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

end of thread, other threads:[~2025-02-17 14:34 UTC | newest]

Thread overview: 24+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-02-16 12:58 [PATCH v3 00/13] Introduce configfs-based interface for gpio-aggregator Koichiro Den
2025-02-16 12:58 ` [PATCH v3 01/13] gpio: aggregator: reorder functions to prepare for configfs introduction Koichiro Den
2025-02-17 13:07   ` Geert Uytterhoeven
2025-02-17 14:34     ` Koichiro Den
2025-02-16 12:58 ` [PATCH v3 02/13] gpio: aggregator: protect driver attr handlers against module unload Koichiro Den
2025-02-16 12:58 ` [PATCH v3 03/13] gpio: pseudo: common helper functions for pseudo gpio devices Koichiro Den
2025-02-16 12:58 ` [PATCH v3 04/13] gpio: sim: convert to use gpio-pseudo utilities Koichiro Den
2025-02-16 12:58 ` [PATCH v3 05/13] gpio: virtuser: " Koichiro Den
2025-02-16 15:32   ` kernel test robot
2025-02-16 16:25   ` kernel test robot
2025-02-16 12:58 ` [PATCH v3 06/13] gpio: aggregator: " Koichiro Den
2025-02-16 12:58 ` [PATCH v3 07/13] gpio: aggregator: add aggr_alloc()/aggr_free() Koichiro Den
2025-02-16 12:58 ` [PATCH v3 08/13] gpio: aggregator: introduce basic configfs interface Koichiro Den
2025-02-16 12:58 ` [PATCH v3 09/13] gpio: aggregator: add 'name' attribute for custom GPIO line names Koichiro Den
2025-02-16 12:58 ` [PATCH v3 10/13] gpio: aggregator: rename 'name' to 'key' in aggr_parse() Koichiro Den
2025-02-17 13:08   ` Geert Uytterhoeven
2025-02-16 12:58 ` [PATCH v3 11/13] gpio: aggregator: expose aggregator created via legacy sysfs to configfs Koichiro Den
2025-02-16 12:58 ` [PATCH v3 12/13] gpio: aggregator: cancel deferred probe for devices created via configfs Koichiro Den
2025-02-16 12:58 ` [PATCH v3 13/13] Documentation: gpio: document configfs interface for gpio-aggregator Koichiro Den
2025-02-16 15:56 ` [PATCH v3 00/13] Introduce configfs-based " Bartosz Golaszewski
2025-02-17  1:07   ` Koichiro Den
2025-02-17  1:17     ` Koichiro Den
2025-02-17  8:12       ` Bartosz Golaszewski
2025-02-17 12:42         ` Koichiro Den

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.