From: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
To: Thomas Richard <thomas.richard@bootlin.com>
Cc: Linus Walleij <linus.walleij@linaro.org>,
Bartosz Golaszewski <brgl@bgdev.pl>,
Geert Uytterhoeven <geert+renesas@glider.be>,
linux-gpio@vger.kernel.org, linux-kernel@vger.kernel.org,
thomas.petazzoni@bootlin.com, DanieleCleri@aaeon.eu,
GaryWang@aaeon.com.tw
Subject: Re: [PATCH v3 10/10] pinctrl: Add pin controller driver for AAEON UP boards
Date: Tue, 22 Apr 2025 18:24:21 +0300 [thread overview]
Message-ID: <aAe0pWa1Fzxb86HM@smile.fi.intel.com> (raw)
In-Reply-To: <e1bb879a-55b3-43fc-8d2d-67401c21ef76@bootlin.com>
On Tue, Apr 22, 2025 at 04:36:33PM +0200, Thomas Richard wrote:
...
> >> +static int upboard_gpio_request(struct gpio_chip *gc, unsigned int offset)
> >> +{
> >> + struct gpiochip_fwd *fwd = container_of(gc, struct gpiochip_fwd, chip);
> >> + struct upboard_pinctrl *pctrl = fwd->data;
> >
> > Yeah, something like
> >
> > struct upboard_pinctrl *pctrl = gpio_fwd_get_data(fwd);
> >
> >> + unsigned int pin = pctrl->pctrl_data->pin_header[offset];
> >> + struct gpio_desc *desc;
> >> + int ret;
> >> +
> >> + ret = pinctrl_gpio_request(gc, offset);
> >> + if (ret)
> >> + return ret;
> >
> >> + /* GPIO desc is already registered */
> >> + if (fwd->descs[offset])
> >> + return 0;
> >
> > As mentioned in another reply, why 0 and even though, why can't it be simply
> > filtered by EEXIST from the below?
> >
> > In worst scenario, you can add an API gpio_fwd_is_registered(fwd, offset).
>
> I cannot filter using EEXIST, because I have to get the GPIO desc first.
> And using the retcode of gpiod_get_index() I cannot detect that I
> already requested the GPIO.
>
> As now gpiochip_fwd is an opaque pointer, I will add the
> gpio_fwd_is_registered() helper.
>
> It is due to the fact that the forwarder never releases a GPIO desc. An
> other solution could be to add the possibility to remove a GPIO desc.
> In upboard_gpio_free() the GPIO desc is free, and we can remove the check.
>
> upboard_gpio_free()
> {
> gpio_fwd_free_desc(fwd, offset);
> pinctrl_gpio_free(gc, offset);
> }
From given options I prefer to have the _gpio_free(), i.e. the latter one.
--
With Best Regards,
Andy Shevchenko
next prev parent reply other threads:[~2025-04-22 15:24 UTC|newest]
Thread overview: 32+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-04-16 14:08 [PATCH v3 00/10] Add pinctrl support for the AAEON UP board FPGA Thomas Richard
2025-04-16 14:08 ` [PATCH v3 01/10] gpiolib: add support to register sparse pin range Thomas Richard
2025-04-17 7:53 ` Linus Walleij
2025-04-17 16:54 ` Andy Shevchenko
2025-04-16 14:08 ` [PATCH v3 02/10] pinctrl: core: add devm_pinctrl_register_mappings() Thomas Richard
2025-04-17 7:54 ` Linus Walleij
2025-04-17 16:07 ` kernel test robot
2025-04-17 16:13 ` Andy Shevchenko
2025-04-17 16:39 ` kernel test robot
2025-04-16 14:08 ` [PATCH v3 03/10] gpio: aggregator: move GPIO forwarder allocation in a dedicated function Thomas Richard
2025-04-17 16:56 ` Andy Shevchenko
2025-04-16 14:08 ` [PATCH v3 04/10] gpio: aggregator: refactor the code to add GPIO desc in the forwarder Thomas Richard
2025-04-17 17:16 ` Andy Shevchenko
2025-04-18 10:07 ` Thomas Richard
2025-04-16 14:08 ` [PATCH v3 05/10] gpio: aggregator: refactor the forwarder registration part Thomas Richard
2025-04-17 17:18 ` Andy Shevchenko
2025-04-16 14:08 ` [PATCH v3 06/10] gpio: aggregator: update gpiochip_fwd_setup_delay_line() parameters Thomas Richard
2025-04-17 17:23 ` Andy Shevchenko
2025-04-16 14:08 ` [PATCH v3 07/10] gpio: aggregator: export symbols of the GPIO forwarder library Thomas Richard
2025-04-17 17:33 ` Andy Shevchenko
2025-04-16 14:08 ` [PATCH v3 08/10] gpio: aggregator: handle runtime registration of gpio_desc in gpiochip_fwd Thomas Richard
2025-04-17 17:38 ` Andy Shevchenko
2025-04-17 17:40 ` Andy Shevchenko
2025-04-16 14:08 ` [PATCH v3 09/10] gpio: aggregator: add possibility to attach data to the forwarder Thomas Richard
2025-04-17 17:43 ` Andy Shevchenko
2025-04-16 14:08 ` [PATCH v3 10/10] pinctrl: Add pin controller driver for AAEON UP boards Thomas Richard
2025-04-17 7:57 ` Linus Walleij
2025-04-17 18:00 ` Andy Shevchenko
2025-04-22 14:36 ` Thomas Richard
2025-04-22 15:24 ` Andy Shevchenko [this message]
2025-04-18 21:45 ` kernel test robot
2025-04-17 18:02 ` [PATCH v3 00/10] Add pinctrl support for the AAEON UP board FPGA Andy Shevchenko
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=aAe0pWa1Fzxb86HM@smile.fi.intel.com \
--to=andriy.shevchenko@linux.intel.com \
--cc=DanieleCleri@aaeon.eu \
--cc=GaryWang@aaeon.com.tw \
--cc=brgl@bgdev.pl \
--cc=geert+renesas@glider.be \
--cc=linus.walleij@linaro.org \
--cc=linux-gpio@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=thomas.petazzoni@bootlin.com \
--cc=thomas.richard@bootlin.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox