linux-gpio.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Thomas Richard <thomas.richard@bootlin.com>
To: Geert Uytterhoeven <geert@linux-m68k.org>
Cc: Linus Walleij <linus.walleij@linaro.org>,
	Bartosz Golaszewski <brgl@bgdev.pl>,
	Thomas Petazzoni <thomas.petazzoni@bootlin.com>,
	Bartosz Golaszewski <bartosz.golaszewski@linaro.org>,
	linux-gpio@vger.kernel.org, linux-kernel@vger.kernel.org,
	kernel test robot <oliver.sang@intel.com>
Subject: Re: [PATCH] gpio: aggregator: restore the set_config operation
Date: Mon, 6 Oct 2025 14:26:01 +0200	[thread overview]
Message-ID: <1003b65c-7b4f-422c-a720-9f84e5642b1d@bootlin.com> (raw)
In-Reply-To: <CAMuHMdU_3Wfzq_qc9odGYtSAsMMOgww90qyH+GN4eQ7cxJMG+g@mail.gmail.com>

On 10/6/25 9:42 AM, Geert Uytterhoeven wrote:
> Hi Thomas,
> 
> On Fri, 3 Oct 2025 at 16:30, Thomas Richard <thomas.richard@bootlin.com> wrote:
>> On 10/3/25 3:59 PM, Thomas Richard wrote:
>>>> Is there any specific reason why you are doing this unconditionally,
>>>> instead of only when any of its parents support .set_config(), like
>>>> was done before?
>>>>
>>> My idea was: it will be handled by the core, so the if statement is not
>>> needed. But if we conditionally add the operation we can save some time
>>> in case there is no chip supporting set_config().
>>
>> I just remembered the true reason why I'm doing this unconditionally.
>>
>> The user of the forwarder can override GPIO operations like I do in the
>> pinctrl-upboard driver [1].
>> And now we can add/remove GPIO desc at runtime, if set_config() is set
>> conditionally in gpiochip_fwd_desc_add() it will override the custom
>> set_config() operation.
>> So the only solution is to set the set_config() operation
>> unconditionally in devm_gpiochip_fwd_alloc().
> 
> OK, that makes sense, so
> Reviewed-by: Geert Uytterhoeven <geert+renesas@glider.be>
> 
> I do find this overriding a bit fragile.
> And in theory, such a driver could override chip->can_sleep to false,
> which might be overwritten again by gpiochip_fwd_desc_add()...

Yes, I agree.
Maybe we should not export gpiochip_fwd_get_gpiochip() so it will not be
possible to get the gpio_chip and override some properties. And we add
some helpers to override the GPIO operations. I can make a try.

Regards,

Thomas

-- 
Thomas Richard, Bootlin
Embedded Linux and Kernel engineering
https://bootlin.com

  reply	other threads:[~2025-10-06 12:26 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-09-29 10:03 [PATCH] gpio: aggregator: restore the set_config operation Thomas Richard
2025-09-29 10:15 ` Geert Uytterhoeven
2025-10-03 13:59   ` Thomas Richard
2025-10-03 14:30     ` Thomas Richard
2025-10-06  7:42       ` Geert Uytterhoeven
2025-10-06 12:26         ` Thomas Richard [this message]
2025-09-29 12:45 ` Bartosz Golaszewski
2025-11-05  9:59   ` Thomas Richard
2025-11-05 10:39     ` Bartosz Golaszewski
2025-11-05 10:39 ` Bartosz Golaszewski

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=1003b65c-7b4f-422c-a720-9f84e5642b1d@bootlin.com \
    --to=thomas.richard@bootlin.com \
    --cc=bartosz.golaszewski@linaro.org \
    --cc=brgl@bgdev.pl \
    --cc=geert@linux-m68k.org \
    --cc=linus.walleij@linaro.org \
    --cc=linux-gpio@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=oliver.sang@intel.com \
    --cc=thomas.petazzoni@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;
as well as URLs for NNTP newsgroup(s).