public inbox for linux-gpio@vger.kernel.org
 help / color / mirror / Atom feed
From: Dmitry Torokhov <dmitry.torokhov@gmail.com>
To: Bartosz Golaszewski <bartosz.golaszewski@oss.qualcomm.com>
Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org>,
	 "Rafael J. Wysocki" <rafael@kernel.org>,
	Danilo Krummrich <dakr@kernel.org>,
	 Linus Walleij <linusw@kernel.org>,
	Bartosz Golaszewski <brgl@kernel.org>,
	 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 1/2] driver core: make fwnode_is_primary() public
Date: Mon, 23 Feb 2026 09:53:41 -0800	[thread overview]
Message-ID: <aZyTvZblnyMgDlYp@google.com> (raw)
In-Reply-To: <20260223-device-match-secondary-fwnode-v2-1-966c00c9eeeb@oss.qualcomm.com>

Hi Bartosz,

On Mon, Feb 23, 2026 at 04:40:52PM +0100, Bartosz Golaszewski wrote:
> Export fwnode_is_primary() in fwnode.h for use in driver code.
> 
> Signed-off-by: Bartosz Golaszewski <bartosz.golaszewski@oss.qualcomm.com>
> ---
>  drivers/base/core.c    | 5 -----
>  include/linux/fwnode.h | 5 +++++
>  2 files changed, 5 insertions(+), 5 deletions(-)
> 
> diff --git a/drivers/base/core.c b/drivers/base/core.c
> index f599a1384eec90c104601422b04dc2b4c19d4382..2e551bbe591b09c66b113b419ba63f17e8bea94a 100644
> --- a/drivers/base/core.c
> +++ b/drivers/base/core.c
> @@ -5122,11 +5122,6 @@ int dev_warn_probe(const struct device *dev, int err, const char *fmt, ...)
>  }
>  EXPORT_SYMBOL_GPL(dev_warn_probe);
>  
> -static inline bool fwnode_is_primary(struct fwnode_handle *fwnode)
> -{
> -	return fwnode && !IS_ERR(fwnode->secondary);
> -}
> -
>  /**
>   * set_primary_fwnode - Change the primary firmware node of a given device.
>   * @dev: Device to handle.
> diff --git a/include/linux/fwnode.h b/include/linux/fwnode.h
> index 097be89487bf5c5a96f01d569c1691088db4f0ca..04db7f3ea50cceb9025c82c6449ba342d0e1b4a4 100644
> --- a/include/linux/fwnode.h
> +++ b/include/linux/fwnode.h
> @@ -230,4 +230,9 @@ void fwnode_links_purge(struct fwnode_handle *fwnode);
>  void fw_devlink_purge_absent_suppliers(struct fwnode_handle *fwnode);
>  bool fw_devlink_is_strict(void);
>  
> +static inline bool fwnode_is_primary(struct fwnode_handle *fwnode)
> +{
> +	return fwnode && !IS_ERR(fwnode->secondary);
> +}

I think this is a bad API to be exported for wider use. It is surprising
that a standalone node is not considered to be a primary. It is also not
great that the argument is not constant pointer.

I would suggest having something like

bool fwnode_has_secondary(const struct fwnode_handle *fwnode);

Thanks.

-- 
Dmitry

  parent reply	other threads:[~2026-02-23 17:53 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 [this message]
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
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=aZyTvZblnyMgDlYp@google.com \
    --to=dmitry.torokhov@gmail.com \
    --cc=andriy.shevchenko@linux.intel.com \
    --cc=bartosz.golaszewski@oss.qualcomm.com \
    --cc=brgl@kernel.org \
    --cc=dakr@kernel.org \
    --cc=djrscally@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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox