public inbox for linux-kernel@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>,
	brgl@kernel.org,  driver-core@lists.linux.dev,
	linux-kernel@vger.kernel.org
Subject: Re: [PATCH 1/2] driver core: platform: remove software node on release()
Date: Sun, 12 Apr 2026 20:56:22 -0700	[thread overview]
Message-ID: <adxmFlfIcoZ19Nm9@google.com> (raw)
In-Reply-To: <20260410-swnode-remove-on-dev-unreg-v1-1-cd7d305f3db2@oss.qualcomm.com>

Hi Bartosz,

On Fri, Apr 10, 2026 at 01:50:45PM +0200, Bartosz Golaszewski wrote:
> If we pass a software node to a newly created device using struct
> platform_device_info, it will not be removed when the device is
> released. This may happen when a module creating the device is removed
> or on failure in platform_device_add().
> 
> When we try to reuse that software node in a subsequent call to
> platform_device_register_full(), it will fails with -EBUSY. Add the
> missing call to device_remove_software_node() in release path.

Thank you for spotting this, but I do not believe the patch is correct
as it stands. We need to differentiate between nodes registered by
platform devices vs nodes that already registered where we simply use
them.

I think we need to mark nodes that platform_device_register_full()
registers form swnodes as "managed = true" so that they are cleaned up
properly.

See also sashiko feedback.

https://sashiko.dev/#/patchset/20260410-swnode-remove-on-dev-unreg-v1-0-cd7d305f3db2%40oss.qualcomm.com

Thanks.

-- 
Dmitry

  reply	other threads:[~2026-04-13  3:56 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-04-10 11:50 [PATCH 0/2] driver core: remove software node from platform devices on device release Bartosz Golaszewski
2026-04-10 11:50 ` [PATCH 1/2] driver core: platform: remove software node on release() Bartosz Golaszewski
2026-04-13  3:56   ` Dmitry Torokhov [this message]
2026-04-10 11:50 ` [PATCH 2/2] driver core: platform: tests: add a test case for correct swnode removal 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=adxmFlfIcoZ19Nm9@google.com \
    --to=dmitry.torokhov@gmail.com \
    --cc=bartosz.golaszewski@oss.qualcomm.com \
    --cc=brgl@kernel.org \
    --cc=dakr@kernel.org \
    --cc=driver-core@lists.linux.dev \
    --cc=gregkh@linuxfoundation.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=rafael@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