All of lore.kernel.org
 help / color / mirror / Atom feed
From: "Danilo Krummrich" <dakr@kernel.org>
To: "Bartosz Golaszewski" <bartosz.golaszewski@oss.qualcomm.com>
Cc: "Maximilian Luz" <luzmaximilian@gmail.com>,
	"Hans de Goede" <hansg@kernel.org>,
	"Ilpo Järvinen" <ilpo.jarvinen@linux.intel.com>,
	"Matthew Brost" <matthew.brost@intel.com>,
	"Thomas Hellström" <thomas.hellstrom@linux.intel.com>,
	"Rodrigo Vivi" <rodrigo.vivi@intel.com>,
	"David Airlie" <airlied@gmail.com>,
	"Simona Vetter" <simona@ffwll.ch>,
	"Greg Kroah-Hartman" <gregkh@linuxfoundation.org>,
	"Rafael J. Wysocki" <rafael@kernel.org>,
	brgl@kernel.org, platform-driver-x86@vger.kernel.org,
	linux-kernel@vger.kernel.org, intel-xe@lists.freedesktop.org,
	dri-devel@lists.freedesktop.org, driver-core@lists.linux.dev
Subject: Re: [PATCH v8 1/5] driver core: platform: amend the API contract for fwnode setters
Date: Fri, 17 Jul 2026 13:29:47 +0200	[thread overview]
Message-ID: <DK0T8DPQIBSQ.Z9Y2UCXE54HU@kernel.org> (raw)
In-Reply-To: <20260716-swnode-remove-on-dev-unreg-v8-1-5c2b8cc38c28@oss.qualcomm.com>

On Thu Jul 16, 2026 at 2:31 PM CEST, Bartosz Golaszewski wrote:
> @@ -723,11 +725,20 @@ EXPORT_SYMBOL_GPL(platform_device_set_of_node);
>   *
>   * Assign a firmware node to this platform device. Internally keep track of the
>   * reference count. Devices created with platform_device_alloc() must use this
> - * function instead of assigning the node manually.
> + * function instead of assigning the node manually. This function must not be
> + * called for a platform device that already has a software node as its primary
> + * firmware node assigned.
>   */
>  void platform_device_set_fwnode(struct platform_device *pdev,
>  				struct fwnode_handle *fwnode)
>  {
> +	/*
> +	 * If we call this function for a platform device whose primary
> +	 * firmware node is a software node, we'll never end up calling the
> +	 * symmetric software_node_notify_remove(). There are no users for this
> +	 * right now in the tree so just disallow it.
> +	 */
> +	WARN_ON(is_software_node(dev_fwnode(&pdev->dev)));
>  	fwnode_handle_put(pdev->dev.fwnode);
>  	device_set_node(&pdev->dev, fwnode_handle_get(fwnode));
>  }

When I suggested this I actually meant to never allow to replace an existing
node (not only for swnodes), as I think there's no use-case for this anyway and
it makes the API more consistent.

However, this can be done in a follow-up too; the patch is fine as is, as it
addresses the problem I pointed out about software_node_notify_remove() not
being called independently.

So, I'll pick this up later today.

Thanks,
Danilo

  parent reply	other threads:[~2026-07-17 11:29 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-07-16 12:31 [PATCH v8 0/5] driver core: unify the release path for dynamically allocated platform devices Bartosz Golaszewski
2026-07-16 12:31 ` [PATCH v8 1/5] driver core: platform: amend the API contract for fwnode setters Bartosz Golaszewski
2026-07-16 12:39   ` sashiko-bot
2026-07-17 11:29   ` Danilo Krummrich [this message]
2026-07-16 12:31 ` [PATCH v8 2/5] platform/surface: gpe: use platform_device_register_full() Bartosz Golaszewski
2026-07-16 12:31 ` [PATCH v8 3/5] drm/xe/i2c: use device_create_managed_software_node() Bartosz Golaszewski
2026-07-16 12:31 ` [PATCH v8 4/5] driver core: platform: unify release path Bartosz Golaszewski
2026-07-16 13:02   ` sashiko-bot
2026-07-16 12:31 ` [PATCH v8 5/5] driver core: platform: tests: add test cases for correct swnode removal Bartosz Golaszewski
2026-07-16 12:51   ` sashiko-bot
2026-07-19 23:08 ` [PATCH v8 0/5] driver core: unify the release path for dynamically allocated platform devices Danilo Krummrich

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=DK0T8DPQIBSQ.Z9Y2UCXE54HU@kernel.org \
    --to=dakr@kernel.org \
    --cc=airlied@gmail.com \
    --cc=bartosz.golaszewski@oss.qualcomm.com \
    --cc=brgl@kernel.org \
    --cc=dri-devel@lists.freedesktop.org \
    --cc=driver-core@lists.linux.dev \
    --cc=gregkh@linuxfoundation.org \
    --cc=hansg@kernel.org \
    --cc=ilpo.jarvinen@linux.intel.com \
    --cc=intel-xe@lists.freedesktop.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=luzmaximilian@gmail.com \
    --cc=matthew.brost@intel.com \
    --cc=platform-driver-x86@vger.kernel.org \
    --cc=rafael@kernel.org \
    --cc=rodrigo.vivi@intel.com \
    --cc=simona@ffwll.ch \
    --cc=thomas.hellstrom@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.