On Mon, Mar 17, 2025 at 4:38 PM Thomas Richard <thomas.richard@xxxxxxxxxxx> wrote: > > Add a data pointer to store private data in the forwarder. > > Signed-off-by: Thomas Richard <thomas.richard@xxxxxxxxxxx> > --- > drivers/gpio/gpio-aggregator.c | 6 ++++-- > include/linux/gpio/gpio-fwd.h | 3 ++- > 2 files changed, 6 insertions(+), 3 deletions(-) > > diff --git a/drivers/gpio/gpio-aggregator.c b/drivers/gpio/gpio-aggregator.c > index b9026ff2bfdc1..3c78c47ce40ae 100644 > --- a/drivers/gpio/gpio-aggregator.c > +++ b/drivers/gpio/gpio-aggregator.c > @@ -556,7 +556,7 @@ int gpiochip_fwd_add_gpio_desc(struct gpiochip_fwd *fwd, struct gpio_desc *desc, > } > EXPORT_SYMBOL_GPL(gpiochip_fwd_add_gpio_desc); > > -int gpiochip_fwd_register(struct gpiochip_fwd *fwd) > +int gpiochip_fwd_register(struct gpiochip_fwd *fwd, void *data) > { > struct gpio_chip *chip = &fwd->chip; > struct device *dev = fwd->dev; > @@ -579,6 +579,8 @@ int gpiochip_fwd_register(struct gpiochip_fwd *fwd) I see Andy already requested some renaming but can you also use a gpio_fwd_ prefix for these exported interfaces? Bart > else > spin_lock_init(&fwd->slock); > > + fwd->data = data; > + > error = devm_gpiochip_add_data(dev, chip, fwd); > > return error; > @@ -625,7 +627,7 @@ static struct gpiochip_fwd *gpiochip_fwd_create(struct device *dev, > return ERR_PTR(error); > } > > - error = gpiochip_fwd_register(fwd); > + error = gpiochip_fwd_register(fwd, NULL); > if (error) > return ERR_PTR(error); > > diff --git a/include/linux/gpio/gpio-fwd.h b/include/linux/gpio/gpio-fwd.h > index 80ec34ee282fc..c242cc1888180 100644 > --- a/include/linux/gpio/gpio-fwd.h > +++ b/include/linux/gpio/gpio-fwd.h > @@ -10,6 +10,7 @@ struct gpiochip_fwd_timing { > struct gpiochip_fwd { > struct device *dev; > struct gpio_chip chip; > + void *data; > struct gpio_desc **descs; > union { > struct mutex mlock; /* protects tmp[] if can_sleep */ > @@ -50,6 +51,6 @@ int gpiochip_fwd_add_gpio_desc(struct gpiochip_fwd *fwd, > struct gpio_desc *desc, > unsigned int offset); > > -int gpiochip_fwd_register(struct gpiochip_fwd *fwd); > +int gpiochip_fwd_register(struct gpiochip_fwd *fwd, void *data); > > #endif > > -- > 2.39.5 >