From: Andy Shevchenko <andriy.shevchenko@intel.com>
To: Bartosz Golaszewski <brgl@kernel.org>
Cc: Bartosz Golaszewski <bartosz.golaszewski@oss.qualcomm.com>,
Greg Kroah-Hartman <gregkh@linuxfoundation.org>,
"Rafael J. Wysocki" <rafael@kernel.org>,
Danilo Krummrich <dakr@kernel.org>,
Dmitry Torokhov <dmitry.torokhov@gmail.com>,
Brendan Higgins <brendan.higgins@linux.dev>,
David Gow <david@davidgow.net>, Rae Moar <raemoar63@gmail.com>,
Andy Shevchenko <andy@kernel.org>,
driver-core@lists.linux.dev, linux-kernel@vger.kernel.org,
linux-kselftest@vger.kernel.org, kunit-dev@googlegroups.com
Subject: Re: [PATCH v2 1/3] driver core: platform: remove software node on release()
Date: Fri, 24 Apr 2026 16:13:46 +0300 [thread overview]
Message-ID: <aetsiqtCqKfme6eC@ashevche-desk.local> (raw)
In-Reply-To: <CAMRc=Mc92zOdjz-8P2A5og=mTKFUKrj3o7Z28NDdkMktDD+tuw@mail.gmail.com>
On Fri, Apr 24, 2026 at 02:34:29PM +0200, Bartosz Golaszewski wrote:
> On Fri, Apr 24, 2026 at 11:01 AM Andy Shevchenko
> <andriy.shevchenko@intel.com> wrote:
> > On Thu, Apr 23, 2026 at 02:12:02PM +0200, Bartosz Golaszewski wrote:
...
> > > + device_remove_software_node(dev);
> >
> > > of_node_put(pa->pdev.dev.of_node);
> >
> > Can we rather replace of_* get/put with the fwnode_* get/put and make a
> > conditional here?
>
> I thought about it but I'm not sure why we bump the refcount of OF
> nodes but not of the firmware nodes supplied in struct
> platform_device_info. Maybe there was a reason for it. That would
> simplify things.
I could with 99% assurance state that the reason behind this as simple as
ACPI doesn't need that. It's no-op there and no-one at that time thought
of software nodes. More, I have some (a few years old) patch locally that
does this conversion, but never had time to look into it carefully for
any missed corner cases (as part of that work, the preparation was done
for AMBA devices in the ca5a75df36dd ("amba: bus: balance firmware node
reference counting") which is more than a couple of years in upstream).
> > if (is_software_node(...))
> > device_remove...
> > else
> > fwnode_handle_put().
> >
> > (or something like this)
> >
> > And IIRC the above pattern has been already seen somewhere else. But I can't
> > point to it, just some weak memories of seeing that already.
>
> That needs to account for two software nodes, I think it's fine to
> call the two in sequence unconditionally (like I do this this patch)
> and just dump the refcount on registration as necessary.
Sure.
--
With Best Regards,
Andy Shevchenko
next prev parent reply other threads:[~2026-04-24 13:13 UTC|newest]
Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-04-23 12:12 [PATCH v2 0/3] driver core: remove software node from platform devices on device release Bartosz Golaszewski
2026-04-23 12:12 ` [PATCH v2 1/3] driver core: platform: remove software node on release() Bartosz Golaszewski
2026-04-23 17:32 ` Dmitry Torokhov
2026-04-24 12:26 ` Bartosz Golaszewski
2026-04-26 4:24 ` Dmitry Torokhov
2026-04-27 14:13 ` Bartosz Golaszewski
2026-04-24 9:01 ` Andy Shevchenko
2026-04-24 12:34 ` Bartosz Golaszewski
2026-04-24 13:13 ` Andy Shevchenko [this message]
2026-04-23 12:12 ` [PATCH v2 2/3] kunit: provide kunit_software_node_register() Bartosz Golaszewski
2026-04-23 12:12 ` [PATCH v2 3/3] driver core: platform: tests: add test cases 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=aetsiqtCqKfme6eC@ashevche-desk.local \
--to=andriy.shevchenko@intel.com \
--cc=andy@kernel.org \
--cc=bartosz.golaszewski@oss.qualcomm.com \
--cc=brendan.higgins@linux.dev \
--cc=brgl@kernel.org \
--cc=dakr@kernel.org \
--cc=david@davidgow.net \
--cc=dmitry.torokhov@gmail.com \
--cc=driver-core@lists.linux.dev \
--cc=gregkh@linuxfoundation.org \
--cc=kunit-dev@googlegroups.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-kselftest@vger.kernel.org \
--cc=raemoar63@gmail.com \
--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