Re: [PATCH RFC v2 4/6] gpio: aggregator: handle runtime registration of gpio_desc in gpiochip_fwd
From: Andy Shevchenko
Date: Mon Mar 17 2025 - 13:22:27 EST
On Mon, Mar 17, 2025 at 04:38:02PM +0100, Thomas Richard wrote:
> Add request() callback to check if the GPIO descriptor was well registered
> in the gpiochip_fwd before to use it. This is done to handle the case
> where GPIO descriptor is added at runtime in the forwarder.
>
> If at least one GPIO descriptor was not added before the forwarder
> registration, we assume the forwarder can sleep as if a GPIO is added at
> runtime it may sleep.
Hmm... This should rather be reformatted each time a new descriptor is added,
no?
...
> +int gpio_fwd_request(struct gpio_chip *chip, unsigned int offset)
> +{
> + struct gpiochip_fwd *fwd = gpiochip_get_data(chip);
> +
> + return fwd->descs[offset] ? 0 : -ENXIO;
Why was this error code chosen?
> +}
...
> struct gpio_chip *chip = &fwd->chip;
> struct device *dev = fwd->dev;
> - int error;
> + int ndescs = 0;
> + int error, i;
The new added variables are signed. Why?
--
With Best Regards,
Andy Shevchenko