On Thu, Mar 20, 2025 at 04:51:04PM GMT, Bartosz Golaszewski wrote: > On Sat, Mar 15, 2025 at 5:41 PM Koichiro Den <koichiro.den@xxxxxxxxxxxxx> wrote: > > > > Prepare for the upcoming configfs interface. These functions will be > > used by both the existing sysfs interface and the new configfs > > interface, reducing code duplication. > > > > No functional change. > > > > Signed-off-by: Koichiro Den <koichiro.den@xxxxxxxxxxxxx> > > --- > > drivers/gpio/gpio-aggregator.c | 58 +++++++++++++++++++++------------- > > 1 file changed, 36 insertions(+), 22 deletions(-) > > > > diff --git a/drivers/gpio/gpio-aggregator.c b/drivers/gpio/gpio-aggregator.c > > index e026deb4ac64..2692a31e01ac 100644 > > --- a/drivers/gpio/gpio-aggregator.c > > +++ b/drivers/gpio/gpio-aggregator.c > > @@ -36,12 +36,41 @@ > > struct gpio_aggregator { > > struct gpiod_lookup_table *lookups; > > struct platform_device *pdev; > > + int id; > > char args[]; > > }; > > > > static DEFINE_MUTEX(gpio_aggregator_lock); /* protects idr */ > > static DEFINE_IDR(gpio_aggregator_idr); > > > > +static int aggr_alloc(struct gpio_aggregator **aggr, size_t arg_size) > > +{ > > + struct gpio_aggregator *new __free(kfree) = NULL; > > + int ret; > > + > > + new = kzalloc(sizeof(*new) + arg_size, GFP_KERNEL); > > Please prefer declaring the auto variable and initializing it at the > same time. Should be: > > struct gpio_aggregator *new __free(kfree) = kzalloc(...); Thanks for the review. Should I send v7 for this change? Koichiro > > > + if (!new) > > + return -ENOMEM; > > + > > + mutex_lock(&gpio_aggregator_lock); > > If adding new code, please use lock guards. > > Bart