public inbox for linux-arm-kernel@lists.infradead.org
 help / color / mirror / Atom feed
From: Andy Shevchenko <andriy.shevchenko@intel.com>
To: Bartosz Golaszewski <brgl@bgdev.pl>
Cc: Kees Cook <kees@kernel.org>, Mika Westerberg <westeri@kernel.org>,
	Dmitry Torokhov <dmitry.torokhov@gmail.com>,
	Andrew Morton <akpm@linux-foundation.org>,
	Linus Walleij <linus.walleij@linaro.org>,
	Manivannan Sadhasivam <mani@kernel.org>,
	Rob Herring <robh@kernel.org>,
	Krzysztof Kozlowski <krzk+dt@kernel.org>,
	Conor Dooley <conor+dt@kernel.org>,
	Saravana Kannan <saravanak@google.com>,
	Greg Kroah-Hartman <gregkh@linuxfoundation.org>,
	Andy Shevchenko <andy@kernel.org>,
	Catalin Marinas <catalin.marinas@arm.com>,
	Will Deacon <will@kernel.org>,
	Srinivas Kandagatla <srini@kernel.org>,
	Liam Girdwood <lgirdwood@gmail.com>,
	Mark Brown <broonie@kernel.org>, Jaroslav Kysela <perex@perex.cz>,
	Takashi Iwai <tiwai@suse.com>,
	Alexey Klimov <alexey.klimov@linaro.org>,
	linux-hardening@vger.kernel.org, linux-kernel@vger.kernel.org,
	linux-gpio@vger.kernel.org, linux-arm-kernel@lists.infradead.org,
	linux-sound@vger.kernel.org, linux-arm-msm@vger.kernel.org,
	Bartosz Golaszewski <bartosz.golaszewski@linaro.org>
Subject: Re: [PATCH v3 03/10] gpiolib: implement low-level, shared GPIO support
Date: Wed, 29 Oct 2025 17:18:49 +0200	[thread overview]
Message-ID: <aQIwWXM8BfjQs7kv@smile.fi.intel.com> (raw)
In-Reply-To: <CAMRc=Me5qPS2PhLK5hpK8BbTS8b9q3T-+86mq6rVDpyKZZUfoA@mail.gmail.com>

On Wed, Oct 29, 2025 at 01:39:34PM +0100, Bartosz Golaszewski wrote:
> On Wed, Oct 29, 2025 at 12:45 PM Andy Shevchenko
> <andriy.shevchenko@intel.com> wrote:
> > On Wed, Oct 29, 2025 at 12:20:39PM +0100, Bartosz Golaszewski wrote:
> > >
> > > This module scans the device tree (for now only OF nodes are supported
> > > but care is taken to make other fwnode implementations easy to
> > > integrate) and determines which GPIO lines are shared by multiple users.
> > > It stores that information in memory. When the GPIO chip exposing shared
> > > lines is registered, the shared GPIO descriptors it exposes are marked
> > > as shared and virtual "proxy" devices that mediate access to the shared
> > > lines are created. When a consumer of a shared GPIO looks it up, its
> > > fwnode lookup is redirected to a just-in-time machine lookup that points
> > > to this proxy device.
> > >
> > > This code can be compiled out on platforms which don't use shared GPIOs.
> >
> > Besides strcmp_suffix() that already exists in OF core, there are also some
> > existing pieces that seems being repeated here (again). Can we reduce amount
> > of duplication?
> 
> I'm afraid you need to be more specific here.

You can simply browse the file, it's not long to find and think about it.
I'm _thinking_ that it's possible to improve the situation overall by
try our best of deduplicating (or rather not duplicating) things.

...

> > > +#if IS_ENABLED(CONFIG_OF)
> > > +static int gpio_shared_of_traverse(struct device_node *curr)
> > > +{
> >
> > I believe parts of this code may be resided somewhere in drivers/of/property.c
> > or nearby as it has the similar parsing routines.
> 
> I don't think this is a good idea, I want to keep it within the
> confines of drivers/gpio/ and the use-case is so specific, there's
> really no point in putting parts of it under drivers/of/.
> 
> If I could only iterate over all properties of an fwnode, I'd have
> skipped using OF-specific routines altogether.

The problem is that every subsystem considers "it's not a good idea" or
"historical reasons" or other excuses. Since you are adding OF-specific
stuff that has something already done inside OF specific code, why to
spread it over the kernel by duplicating in another place(s)?

-- 
With Best Regards,
Andy Shevchenko




  reply	other threads:[~2025-10-29 15:19 UTC|newest]

Thread overview: 28+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-10-29 11:20 [PATCH v3 00/10] gpio: improve support for shared GPIOs Bartosz Golaszewski
2025-10-29 11:20 ` [PATCH v3 01/10] string: provide strends() Bartosz Golaszewski
2025-10-29 11:41   ` Andy Shevchenko
2025-10-29 12:36     ` Bartosz Golaszewski
2025-10-29 15:20       ` Andy Shevchenko
2025-10-29 11:20 ` [PATCH v3 02/10] gpiolib: define GPIOD_FLAG_SHARED Bartosz Golaszewski
2025-11-11 10:39   ` Linus Walleij
2025-10-29 11:20 ` [PATCH v3 03/10] gpiolib: implement low-level, shared GPIO support Bartosz Golaszewski
2025-10-29 11:44   ` Andy Shevchenko
2025-10-29 12:39     ` Bartosz Golaszewski
2025-10-29 15:18       ` Andy Shevchenko [this message]
2025-10-29 15:57         ` Bartosz Golaszewski
2025-10-30  9:30           ` Andy Shevchenko
2025-11-11 10:41   ` Linus Walleij
2025-10-29 11:20 ` [PATCH v3 04/10] gpio: shared-proxy: implement the shared GPIO proxy driver Bartosz Golaszewski
2025-11-11 10:43   ` Linus Walleij
2025-10-29 11:20 ` [PATCH v3 05/10] gpiolib: support shared GPIOs in core subsystem code Bartosz Golaszewski
2025-11-11 10:43   ` Linus Walleij
2025-10-29 11:20 ` [PATCH v3 06/10] gpio: provide gpiod_is_shared() Bartosz Golaszewski
2025-10-29 11:20 ` [PATCH v3 07/10] arm64: select HAVE_SHARED_GPIOS for ARCH_QCOM Bartosz Golaszewski
2025-10-29 11:20 ` [PATCH v3 08/10] ASoC: wsa881x: drop GPIOD_FLAGS_BIT_NONEXCLUSIVE flag from GPIO lookup Bartosz Golaszewski
2025-10-29 11:20 ` [PATCH v3 09/10] ASoC: wsa883x: " Bartosz Golaszewski
2025-10-29 11:20 ` [PATCH v3 10/10] regulator: make the subsystem aware of shared GPIOs Bartosz Golaszewski
2025-10-29 11:54   ` Andy Shevchenko
2025-10-29 12:41     ` Bartosz Golaszewski
2025-10-29 15:21       ` Andy Shevchenko
2025-11-10  9:45 ` [PATCH v3 00/10] gpio: improve support for " Bartosz Golaszewski
2025-11-11 10:46   ` Linus Walleij

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=aQIwWXM8BfjQs7kv@smile.fi.intel.com \
    --to=andriy.shevchenko@intel.com \
    --cc=akpm@linux-foundation.org \
    --cc=alexey.klimov@linaro.org \
    --cc=andy@kernel.org \
    --cc=bartosz.golaszewski@linaro.org \
    --cc=brgl@bgdev.pl \
    --cc=broonie@kernel.org \
    --cc=catalin.marinas@arm.com \
    --cc=conor+dt@kernel.org \
    --cc=dmitry.torokhov@gmail.com \
    --cc=gregkh@linuxfoundation.org \
    --cc=kees@kernel.org \
    --cc=krzk+dt@kernel.org \
    --cc=lgirdwood@gmail.com \
    --cc=linus.walleij@linaro.org \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux-arm-msm@vger.kernel.org \
    --cc=linux-gpio@vger.kernel.org \
    --cc=linux-hardening@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-sound@vger.kernel.org \
    --cc=mani@kernel.org \
    --cc=perex@perex.cz \
    --cc=robh@kernel.org \
    --cc=saravanak@google.com \
    --cc=srini@kernel.org \
    --cc=tiwai@suse.com \
    --cc=westeri@kernel.org \
    --cc=will@kernel.org \
    /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