Message ID | 20250218160333.605829-1-koichiro.den@canonical.com |
---|---|
Headers | show |
Series | Add synchronous fake device creation utility for GPIO drivers | expand |
On Tue, Feb 18, 2025 at 5:04 PM Koichiro Den <koichiro.den@canonical.com> wrote: > > Update gpio-sim to use the new dev-sync-probe helper functions for > synchronized platform device creation, reducing code duplication. > > No functional change. > > Signed-off-by: Koichiro Den <koichiro.den@canonical.com> > --- > drivers/gpio/Kconfig | 2 + > drivers/gpio/gpio-sim.c | 84 ++++++----------------------------------- > 2 files changed, 14 insertions(+), 72 deletions(-) > > diff --git a/drivers/gpio/Kconfig b/drivers/gpio/Kconfig > index 2e4c5f0a94f7..ba06f052b9ea 100644 > --- a/drivers/gpio/Kconfig > +++ b/drivers/gpio/Kconfig > @@ -1866,6 +1866,7 @@ endmenu > # This symbol is selected by drivers that need synchronous fake device creation > config DEV_SYNC_PROBE > tristate "Utilities for synchronous fake device creation" > + depends on GPIO_SIM No, it does not. Please drop this. > help > Common helper functions for drivers that need synchronous fake > device creation. > @@ -1916,6 +1917,7 @@ config GPIO_SIM > tristate "GPIO Simulator Module" > select IRQ_SIM > select CONFIGFS_FS > + select DEV_SYNC_PROBE > help > This enables the GPIO simulator - a configfs-based GPIO testing > driver. > diff --git a/drivers/gpio/gpio-sim.c b/drivers/gpio/gpio-sim.c > index a086087ada17..d1cdea450937 100644 > --- a/drivers/gpio/gpio-sim.c > +++ b/drivers/gpio/gpio-sim.c > @@ -10,7 +10,6 @@ > #include <linux/array_size.h> > #include <linux/bitmap.h> > #include <linux/cleanup.h> > -#include <linux/completion.h> > #include <linux/configfs.h> > #include <linux/device.h> > #include <linux/err.h> > @@ -37,6 +36,8 @@ > #include <linux/sysfs.h> > #include <linux/types.h> > > +#include "dev-sync-probe.h" > + > #define GPIO_SIM_NGPIO_MAX 1024 > #define GPIO_SIM_PROP_MAX 4 /* Max 3 properties + sentinel. */ > #define GPIO_SIM_NUM_ATTRS 3 /* value, pull and sentinel */ > @@ -541,14 +542,9 @@ static struct platform_driver gpio_sim_driver = { > }; > > struct gpio_sim_device { > + struct dev_sync_probe_data data; Maybe something more indicative of the purpose? probe_data? sync_probe_data? Bart
On Thu, Feb 20, 2025 at 12:08:18PM GMT, Bartosz Golaszewski wrote: > On Tue, Feb 18, 2025 at 5:04 PM Koichiro Den <koichiro.den@canonical.com> wrote: > > > > Update gpio-sim to use the new dev-sync-probe helper functions for > > synchronized platform device creation, reducing code duplication. > > > > No functional change. > > > > Signed-off-by: Koichiro Den <koichiro.den@canonical.com> > > --- > > drivers/gpio/Kconfig | 2 + > > drivers/gpio/gpio-sim.c | 84 ++++++----------------------------------- > > 2 files changed, 14 insertions(+), 72 deletions(-) > > > > diff --git a/drivers/gpio/Kconfig b/drivers/gpio/Kconfig > > index 2e4c5f0a94f7..ba06f052b9ea 100644 > > --- a/drivers/gpio/Kconfig > > +++ b/drivers/gpio/Kconfig > > @@ -1866,6 +1866,7 @@ endmenu > > # This symbol is selected by drivers that need synchronous fake device creation > > config DEV_SYNC_PROBE > > tristate "Utilities for synchronous fake device creation" > > + depends on GPIO_SIM > > No, it does not. Please drop this. I'll hide the config as you pointed out, and drop this while at it. Thanks. > > > help > > Common helper functions for drivers that need synchronous fake > > device creation. > > @@ -1916,6 +1917,7 @@ config GPIO_SIM > > tristate "GPIO Simulator Module" > > select IRQ_SIM > > select CONFIGFS_FS > > + select DEV_SYNC_PROBE > > help > > This enables the GPIO simulator - a configfs-based GPIO testing > > driver. > > diff --git a/drivers/gpio/gpio-sim.c b/drivers/gpio/gpio-sim.c > > index a086087ada17..d1cdea450937 100644 > > --- a/drivers/gpio/gpio-sim.c > > +++ b/drivers/gpio/gpio-sim.c > > @@ -10,7 +10,6 @@ > > #include <linux/array_size.h> > > #include <linux/bitmap.h> > > #include <linux/cleanup.h> > > -#include <linux/completion.h> > > #include <linux/configfs.h> > > #include <linux/device.h> > > #include <linux/err.h> > > @@ -37,6 +36,8 @@ > > #include <linux/sysfs.h> > > #include <linux/types.h> > > > > +#include "dev-sync-probe.h" > > + > > #define GPIO_SIM_NGPIO_MAX 1024 > > #define GPIO_SIM_PROP_MAX 4 /* Max 3 properties + sentinel. */ > > #define GPIO_SIM_NUM_ATTRS 3 /* value, pull and sentinel */ > > @@ -541,14 +542,9 @@ static struct platform_driver gpio_sim_driver = { > > }; > > > > struct gpio_sim_device { > > + struct dev_sync_probe_data data; > > Maybe something more indicative of the purpose? probe_data? sync_probe_data? Hm, right. I'll go with probe_data. Thanks! > > Bart