[PATCH v2 00/10] Introduce configfs-based interface for gpio-aggregator

Koichiro Den posted 10 patches 1 year ago
There is a newer version of this series
.../admin-guide/gpio/gpio-aggregator.rst      |   93 ++
drivers/gpio/gpio-aggregator.c                | 1194 ++++++++++++++---
2 files changed, 1103 insertions(+), 184 deletions(-)
[PATCH v2 00/10] Introduce configfs-based interface for gpio-aggregator
Posted by Koichiro Den 1 year ago
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:

  #1. No way to determine when GPIO aggregator creation is complete.
  #2. No way to retrieve errors when creating a GPIO aggregator.
  #3. No way to trace a GPIO line of an aggregator back to its
      corresponding physical device.
  #4. The 'new_device' echo does not indicate which virtual gpiochip<N>
      was created.
  #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 v2 patch series includes 10 patches:

  Patch#1:   Preparation for Patch#2.
  Patch#2:   Introduce minimal configfs interface.
             Addresses Issue#1 to Issue#3.
  Patch#3:   Addresses Issue#4.
  Patch#4:   Preparation for Patch#5.
  Patch#5:   Addresses Issue#5.
  Patch#6-7: Prepare for Patch#8.
  Patch#8:   Expose devices create with sysfs to configfs.
  Patch#9:   Suppress deferred probe for purely configfs-based aggregators.
  Patch#10:  Documentation.

Changes for v2:
  - 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.

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

Koichiro Den (10):
  gpio: aggregator: reorder functions to prepare for configfs
    introduction
  gpio: aggregator: introduce basic configfs interface
  gpio: aggregator: add read-only 'dev_name' configfs attribute
  gpio: aggregator: add read-write 'name' attribute
  gpio: aggregator: expose custom line names to forwarder gpio_chip
  gpio: aggregator: rename 'name' to 'key' in aggr_parse()
  gpio: aggregator: clean up gpio_aggregator_free()
  gpio: aggregator: expoose 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      |   93 ++
 drivers/gpio/gpio-aggregator.c                | 1194 ++++++++++++++---
 2 files changed, 1103 insertions(+), 184 deletions(-)

-- 
2.45.2
Re: [PATCH v2 00/10] Introduce configfs-based interface for gpio-aggregator
Posted by Geert Uytterhoeven 12 months ago
Hi Den-san,

On Mon, 3 Feb 2025 at 04:12, Koichiro Den <koichiro.den@canonical.com> wrote:
> 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:
>
>   #1. No way to determine when GPIO aggregator creation is complete.
>   #2. No way to retrieve errors when creating a GPIO aggregator.
>   #3. No way to trace a GPIO line of an aggregator back to its
>       corresponding physical device.
>   #4. The 'new_device' echo does not indicate which virtual gpiochip<N>
>       was created.
>   #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.

Thanks for your series!

I gave it a try using all three ways of configuration (sysfs, configs,
DT), and it works fine!

Tested-by: Geert Uytterhoeven <geert+renesas@glider.be>

Gr{oetje,eeting}s,

                        Geert

-- 
Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- geert@linux-m68k.org

In personal conversations with technical people, I call myself a hacker. But
when I'm talking to journalists I just say "programmer" or something like that.
                                -- Linus Torvalds
Re: [PATCH v2 00/10] Introduce configfs-based interface for gpio-aggregator
Posted by Koichiro Den 11 months, 4 weeks ago
On Wed, Feb 12, 2025 at 02:14:23PM GMT, Geert Uytterhoeven wrote:
> Hi Den-san,
> 
> On Mon, 3 Feb 2025 at 04:12, Koichiro Den <koichiro.den@canonical.com> wrote:
> > 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:
> >
> >   #1. No way to determine when GPIO aggregator creation is complete.
> >   #2. No way to retrieve errors when creating a GPIO aggregator.
> >   #3. No way to trace a GPIO line of an aggregator back to its
> >       corresponding physical device.
> >   #4. The 'new_device' echo does not indicate which virtual gpiochip<N>
> >       was created.
> >   #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.
> 
> Thanks for your series!
> 
> I gave it a try using all three ways of configuration (sysfs, configs,
> DT), and it works fine!
> 
> Tested-by: Geert Uytterhoeven <geert+renesas@glider.be>
> 
> Gr{oetje,eeting}s,

Thank you very much for the through review! I'll reply to each of your comment.

Koichiro

> 
>                         Geert
> 
> -- 
> Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- geert@linux-m68k.org
> 
> In personal conversations with technical people, I call myself a hacker. But
> when I'm talking to journalists I just say "programmer" or something like that.
>                                 -- Linus Torvalds