[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <Z9hWKxbcHlhyiCmR@smile.fi.intel.com>
Date: Mon, 17 Mar 2025 19:04:43 +0200
From: Andy Shevchenko <andriy.shevchenko@...ux.intel.com>
To: Thomas Richard <thomas.richard@...tlin.com>
Cc: Linus Walleij <linus.walleij@...aro.org>,
Bartosz Golaszewski <brgl@...ev.pl>,
Geert Uytterhoeven <geert+renesas@...der.be>,
linux-gpio@...r.kernel.org, linux-kernel@...r.kernel.org,
thomas.petazzoni@...tlin.com, DanieleCleri@...on.eu,
GaryWang@...on.com.tw
Subject: Re: [PATCH RFC v2 2/6] gpio: aggregator: refactor the forwarder part.
On Mon, Mar 17, 2025 at 04:38:00PM +0100, Thomas Richard wrote:
> Prepare the code to create a gpio-fwd library. This library will allow to
> create and register a gpiochip forwarder.
...
> struct gpiochip_fwd {
> + struct device *dev;
> struct gpio_chip chip;
Have you checked the code generation?
Also, is this new pointer the same as chip.parent?
> struct gpio_desc **descs;
> union {
> };
...
> +static struct gpiochip_fwd *devm_gpiochip_fwd_alloc(struct device *dev,
> + unsigned int ngpios)
I would rather split as
static struct gpiochip_fwd *
devm_gpiochip_fwd_alloc(struct device *dev, unsigned int ngpios)
...
> + fwd->descs = devm_kcalloc(dev, ngpios, sizeof(*fwd->descs),
> + GFP_KERNEL);
One line.
...
> +static int gpiochip_fwd_register(struct gpiochip_fwd *fwd)
> +{
> + struct gpio_chip *chip = &fwd->chip;
> + struct device *dev = fwd->dev;
> + int error;
>
> if (chip->can_sleep)
> mutex_init(&fwd->mlock);
> else
> spin_lock_init(&fwd->slock);
>
> + error = devm_gpiochip_add_data(dev, chip, fwd);
> +
> + return error;
return devm_...
> +}
...
Overall it looks and feels like this can be split to more simpler logically
isolated changes. At least I see that folding function parameters can be a
separate patch.
--
With Best Regards,
Andy Shevchenko
Powered by blists - more mailing lists