[PATCH v3 0/3] Add synchronous fake device creation utility for GPIO drivers

Koichiro Den posted 3 patches 10 months ago
drivers/gpio/Kconfig          |  5 ++
drivers/gpio/Makefile         |  3 ++
drivers/gpio/dev-sync-probe.c | 97 +++++++++++++++++++++++++++++++++++
drivers/gpio/dev-sync-probe.h | 25 +++++++++
drivers/gpio/gpio-sim.c       | 84 +++++-------------------------
drivers/gpio/gpio-virtuser.c  | 73 ++++----------------------
6 files changed, 152 insertions(+), 135 deletions(-)
create mode 100644 drivers/gpio/dev-sync-probe.c
create mode 100644 drivers/gpio/dev-sync-probe.h
[PATCH v3 0/3] Add synchronous fake device creation utility for GPIO drivers
Posted by Koichiro Den 10 months ago
This patch series introduces a utility for some GPIO devices to reduce
code duplication. There are no functional changes.

In this series, only gpio-sim and gpio-virtuser are updated to use
dev-sync-probe, as the current gpio-aggregator does not benefit from it at
all. A follow-up patch series that introduces a configfs interface for
gpio-aggregator will convert it to use dev-sync-probe as well.

This work originated from a suggestion by Bartosz:
https://lore.kernel.org/all/CAMRc=MfcooZXBqVpbQ0ak+8LGsPDzwKSN3Zfb0eZDx1Bx4duzQ@mail.gmail.com/

N.B. this submission is based on the same (gpio/for-next) commit as v2:
f04867a5d0d3 ("gpio: loongson-64bit: Remove unneeded ngpio assignment").


v2->v3 changes:
  - Fixed Kconfig (hide it from users with removing 'depends on', move it
    outside of 'if GPIOLIB ...').
  - Dropped an unnecessary comment, an unnecessary line break.
  - Fixed Copyright (Year 2025 -> 2021 for Bartosz, add mine) + add my
    MODULE_AUTHOR.
  - Renamed dev_sync_probe_data fields ('data' -> 'probe_data') for both
    gpio-virtuser and gpio-sim.

v1->v2 changes:
  - Renamed the files (gpio-pseudo.[ch] -> dev-sync-probe.[ch]).
  - Renamed the helper functions and a struct.
  - Fixed Kconfig (correcting bool to tristate, etc.).
  - Fixed Copyright.
  - Added some missing #include.

v2: https://lore.kernel.org/all/20250218160333.605829-1-koichiro.den@canonical.com/
v1: https://lore.kernel.org/all/20250217142758.540601-1-koichiro.den@canonical.com/


Koichiro Den (3):
  gpio: introduce utilities for synchronous fake device creation
  gpio: sim: convert to use dev-sync-probe utilities
  gpio: virtuser: convert to use dev-sync-probe utilities

 drivers/gpio/Kconfig          |  5 ++
 drivers/gpio/Makefile         |  3 ++
 drivers/gpio/dev-sync-probe.c | 97 +++++++++++++++++++++++++++++++++++
 drivers/gpio/dev-sync-probe.h | 25 +++++++++
 drivers/gpio/gpio-sim.c       | 84 +++++-------------------------
 drivers/gpio/gpio-virtuser.c  | 73 ++++----------------------
 6 files changed, 152 insertions(+), 135 deletions(-)
 create mode 100644 drivers/gpio/dev-sync-probe.c
 create mode 100644 drivers/gpio/dev-sync-probe.h

-- 
2.45.2
Re: [PATCH v3 0/3] Add synchronous fake device creation utility for GPIO drivers
Posted by Bartosz Golaszewski 9 months, 3 weeks ago
From: Bartosz Golaszewski <bartosz.golaszewski@linaro.org>


On Fri, 21 Feb 2025 22:34:58 +0900, Koichiro Den wrote:
> This patch series introduces a utility for some GPIO devices to reduce
> code duplication. There are no functional changes.
> 
> In this series, only gpio-sim and gpio-virtuser are updated to use
> dev-sync-probe, as the current gpio-aggregator does not benefit from it at
> all. A follow-up patch series that introduces a configfs interface for
> gpio-aggregator will convert it to use dev-sync-probe as well.
> 
> [...]

I don't see any further issues and it passes my libgpiod tests so I queued
this series for v6.15. You can now base your aggregator work on top of my
gpio/for-next branch. Thanks!

[1/3] gpio: introduce utilities for synchronous fake device creation
      commit: eb5ab6ffb4ca2d28121455dd7452061367ed5588
[2/3] gpio: sim: convert to use dev-sync-probe utilities
      commit: 2f41dbf9cb84349f510ebf2165c13102f79a550b
[3/3] gpio: virtuser: convert to use dev-sync-probe utilities
      commit: 45af02f06f6943d73cf9309fd2a63a908b587f57

Best regards,
-- 
Bartosz Golaszewski <bartosz.golaszewski@linaro.org>
Re: [PATCH v3 0/3] Add synchronous fake device creation utility for GPIO drivers
Posted by Koichiro Den 9 months, 3 weeks ago
On Mon, Feb 24, 2025 at 02:58:58PM GMT, Bartosz Golaszewski wrote:
> From: Bartosz Golaszewski <bartosz.golaszewski@linaro.org>
> 
> 
> On Fri, 21 Feb 2025 22:34:58 +0900, Koichiro Den wrote:
> > This patch series introduces a utility for some GPIO devices to reduce
> > code duplication. There are no functional changes.
> > 
> > In this series, only gpio-sim and gpio-virtuser are updated to use
> > dev-sync-probe, as the current gpio-aggregator does not benefit from it at
> > all. A follow-up patch series that introduces a configfs interface for
> > gpio-aggregator will convert it to use dev-sync-probe as well.
> > 
> > [...]
> 
> I don't see any further issues and it passes my libgpiod tests so I queued
> this series for v6.15. You can now base your aggregator work on top of my
> gpio/for-next branch. Thanks!

Thank you! I've just sent the aggregator work v5:
https://lore.kernel.org/all/20250224143134.3024598-1-koichiro.den@canonical.com/

Koichiro

> 
> [1/3] gpio: introduce utilities for synchronous fake device creation
>       commit: eb5ab6ffb4ca2d28121455dd7452061367ed5588
> [2/3] gpio: sim: convert to use dev-sync-probe utilities
>       commit: 2f41dbf9cb84349f510ebf2165c13102f79a550b
> [3/3] gpio: virtuser: convert to use dev-sync-probe utilities
>       commit: 45af02f06f6943d73cf9309fd2a63a908b587f57
> 
> Best regards,
> -- 
> Bartosz Golaszewski <bartosz.golaszewski@linaro.org>