All of lore.kernel.org
 help / color / mirror / Atom feed
From: "Danilo Krummrich" <dakr@kernel.org>
To: "Rafael J. Wysocki" <rafael@kernel.org>
Cc: "Bartosz Golaszewski" <bartosz.golaszewski@oss.qualcomm.com>,
	"Greg Kroah-Hartman" <gregkh@linuxfoundation.org>,
	"Linus Walleij" <linusw@kernel.org>,
	"Bartosz Golaszewski" <brgl@kernel.org>,
	"Dmitry Torokhov" <dmitry.torokhov@gmail.com>,
	"Andy Shevchenko" <andriy.shevchenko@linux.intel.com>,
	"Daniel Scally" <djrscally@gmail.com>,
	"Heikki Krogerus" <heikki.krogerus@linux.intel.com>,
	"Sakari Ailus" <sakari.ailus@linux.intel.com>,
	"Len Brown" <lenb@kernel.org>, <driver-core@lists.linux.dev>,
	<linux-kernel@vger.kernel.org>, <linux-gpio@vger.kernel.org>,
	<linux-acpi@vger.kernel.org>
Subject: Re: [PATCH v2 2/2] gpiolib: match secondary fwnode too in gpio_device_find_by_fwnode()
Date: Mon, 23 Feb 2026 21:00:30 +0100	[thread overview]
Message-ID: <DGMLWYUO9Z48.1769AL2OS2YMK@kernel.org> (raw)
In-Reply-To: <CAJZ5v0jr_i9k3d+np8c+ANhewMhT-TL9exLzZKUJOVarBGnHfw@mail.gmail.com>

On Mon Feb 23, 2026 at 8:55 PM CET, Rafael J. Wysocki wrote:
> On Mon, Feb 23, 2026 at 8:45 PM Danilo Krummrich <dakr@kernel.org> wrote:
>>
>> On Mon Feb 23, 2026 at 4:40 PM CET, Bartosz Golaszewski wrote:
>> >  static int gpio_chip_match_by_fwnode(struct gpio_chip *gc, const void *fwnode)
>> >  {
>> > -     return device_match_fwnode(&gc->gpiodev->dev, fwnode);
>> > +     struct device *dev = &gc->gpiodev->dev;
>> > +     struct fwnode_handle *node = dev_fwnode(dev);
>> > +
>> > +     if (IS_ERR(fwnode))
>> > +             return 0;
>> > +
>> > +     if (device_match_fwnode(dev, fwnode))
>> > +             return 1;
>> > +
>> > +     return fwnode_is_primary(node) && node->secondary == fwnode;
>> >  }
>>
>> Rafael, I understand [1] as you agree with my point, but object to introduce
>> device_match_fwnode_ext() (or whatever name we would pick eventually :)
>> regardless because only the GPIO code would need it as by now.
>
> This is a preference, not a strong objection, but yes.
>
>> IIUC, I wonder if exposing fwnode_is_primary() instead is a good trade.
>
> Well, there is the secondary pointer in struct fwnode_handle, so it is
> kind of exported anyway and it could be documented as "a secondary
> fwnode_handle supplying additional properties or an error pointer", so
> exposing this static inline doesn't change much IMV.
>
> What's your specific concern about exposing it?

No concern with either approach from my side, I was just curious. :)

Maybe it makes sense to add a comment to gpio_chip_match_by_fwnode() hinting to
move this into common code once there's another occurance of this pattern.

But either way, this is

Reviewed-by: Danilo Krummrich <dakr@kernel.org>

>> [1] https://lore.kernel.org/driver-core/CAJZ5v0jUCtKTW-g-C0pKu0DQqOkyfSz=upXwbtYeV_=rMBUMyg@mail.gmail.com/

  reply	other threads:[~2026-02-23 20:00 UTC|newest]

Thread overview: 28+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-02-23 15:40 [PATCH v2 0/2] driver core: provide and use device_match_fwnode_ext() Bartosz Golaszewski
2026-02-23 15:40 ` [PATCH v2 1/2] driver core: make fwnode_is_primary() public Bartosz Golaszewski
2026-02-23 15:42   ` Rafael J. Wysocki
2026-02-23 17:53   ` Dmitry Torokhov
2026-02-23 17:54   ` Andy Shevchenko
2026-02-23 18:28     ` Bartosz Golaszewski
2026-02-23 18:49       ` Rafael J. Wysocki
2026-02-23 19:32       ` Andy Shevchenko
2026-02-23 19:45         ` Rafael J. Wysocki
2026-02-23 20:24           ` Andy Shevchenko
2026-02-23 15:40 ` [PATCH v2 2/2] gpiolib: match secondary fwnode too in gpio_device_find_by_fwnode() Bartosz Golaszewski
2026-02-23 15:43   ` Rafael J. Wysocki
2026-02-23 17:23   ` Sakari Ailus
2026-02-23 17:46     ` Rafael J. Wysocki
2026-02-23 22:07       ` Sakari Ailus
2026-02-24  8:47         ` Bartosz Golaszewski
2026-02-24  8:56           ` Sakari Ailus
2026-02-24  9:43             ` Andy Shevchenko
2026-02-25  7:39               ` Sakari Ailus
2026-02-25  9:38                 ` Andy Shevchenko
2026-02-25 10:07                   ` Heikki Krogerus
2026-02-23 19:45   ` Danilo Krummrich
2026-02-23 19:55     ` Rafael J. Wysocki
2026-02-23 20:00       ` Danilo Krummrich [this message]
2026-02-23 20:04         ` Rafael J. Wysocki
2026-02-23 20:46   ` Rafael J. Wysocki
2026-02-23 15:46 ` [PATCH v2 0/2] driver core: provide and use device_match_fwnode_ext() Bartosz Golaszewski
2026-02-23 16:00   ` Rafael J. Wysocki

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=DGMLWYUO9Z48.1769AL2OS2YMK@kernel.org \
    --to=dakr@kernel.org \
    --cc=andriy.shevchenko@linux.intel.com \
    --cc=bartosz.golaszewski@oss.qualcomm.com \
    --cc=brgl@kernel.org \
    --cc=djrscally@gmail.com \
    --cc=dmitry.torokhov@gmail.com \
    --cc=driver-core@lists.linux.dev \
    --cc=gregkh@linuxfoundation.org \
    --cc=heikki.krogerus@linux.intel.com \
    --cc=lenb@kernel.org \
    --cc=linusw@kernel.org \
    --cc=linux-acpi@vger.kernel.org \
    --cc=linux-gpio@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=rafael@kernel.org \
    --cc=sakari.ailus@linux.intel.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.