[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <CAHp75Vehui8wJPvX=wn78eQYVSYk3h0WqiEtczAS81qtuWsYzA@mail.gmail.com>
Date: Tue, 29 Apr 2025 23:05:31 +0300
From: Andy Shevchenko <andy.shevchenko@...il.com>
To: Thomas Richard <thomas.richard@...tlin.com>
Cc: Linus Walleij <linus.walleij@...aro.org>,
Andy Shevchenko <andriy.shevchenko@...ux.intel.com>, Bartosz Golaszewski <brgl@...ev.pl>,
Geert Uytterhoeven <geert+renesas@...der.be>, Kees Cook <kees@...nel.org>,
Andy Shevchenko <andy@...nel.org>, linux-gpio@...r.kernel.org, linux-kernel@...r.kernel.org,
thomas.petazzoni@...tlin.com, DanieleCleri@...on.eu, GaryWang@...on.com.tw,
linux-hardening@...r.kernel.org
Subject: Re: [PATCH v4 05/12] gpio: aggregator: refactor the code to add GPIO
desc in the forwarder
On Tue, Apr 29, 2025 at 5:08 PM Thomas Richard
<thomas.richard@...tlin.com> wrote:
>
> Create a dedicated function to add a GPIO desc in the forwarder. Instead of
> passing an array of GPIO desc, now the GPIO desc are passed on by one to
GPIO desc:s
GPIO desc:s
> the forwarder.
...
> +static int gpiochip_fwd_gpio_add(struct gpiochip_fwd *fwd,
> + struct gpio_desc *desc,
> + unsigned int offset)
> +{
> + struct gpio_chip *parent = gpiod_to_chip(desc);
> + struct gpio_chip *chip = &fwd->chip;
> +
> + if (offset > chip->ngpio)
> + return -EINVAL;
> + if (fwd->descs[offset])
> + return -EEXIST;
If we still need this, it shouldn't be in this patch. This change
doesn't require the check.
> + /*
> + * If any of the GPIO lines are sleeping, then the entire forwarder
> + * will be sleeping.
> + * If any of the chips support .set_config(), then the forwarder will
> + * support setting configs.
> + */
> + if (gpiod_cansleep(desc))
> + chip->can_sleep = true;
> +
> + if (parent && parent->set_config)
> + chip->set_config = gpio_fwd_set_config;
> +
> + fwd->descs[offset] = desc;
> +
> + dev_dbg(chip->parent, "%u => gpio %d irq %d\n", offset,
> + desc_to_gpio(desc), gpiod_to_irq(desc));
> +
> + return 0;
> +}
--
With Best Regards,
Andy Shevchenko
Powered by blists - more mailing lists