Re: [PATCH v3 1/3] driver core: platform: remove software node on release()

From: Andy Shevchenko

Date: Tue Apr 28 2026 - 07:37:27 EST


On Tue, Apr 28, 2026 at 01:16:30PM +0200, Bartosz Golaszewski wrote:
> On Tue, Apr 28, 2026 at 1:10 PM Andy Shevchenko
> <andriy.shevchenko@xxxxxxxxx> wrote:
> > On Tue, Apr 28, 2026 at 11:20:26AM +0200, Bartosz Golaszewski wrote:

...

> > > + device_remove_software_node(dev);
> > > of_node_put(pa->pdev.dev.of_node);
> >
> > So, why do we decide not to convert this to fwnode_handle_put() (and respective
> > _get() elsewhere)?
>
> Yes, I'll do it separately, I don't want to shove too much stuff into
> this bugfix.

Ah, good!

...

> > > + /*
> > > + * If the primary firmware node is a software node and there's no
> > > + * secondary firmware node, the primary will be affected by the call
> > > + * to device_remove_software_node() in platform_device_release() and
> > > + * its reference count will be dropped by one. Take another reference
> > > + * here to make it have no effect.
> > > + */
> > > + if (is_software_node(pdevinfo->fwnode) && !pdevinfo->swnode)
> > > + fwnode_handle_get(pdevinfo->fwnode);
> >
> > IIUC the `is_software_node(pdevinfo->fwnode) && pdevinfo->swnode` may not
> > happen here due to the above check. If I haven't missed anything, this check
> > is simply
>
> Right, it can be a simple is_software_node(pdevinfo->fwnode).

With that being addressed, the rest LGTM,

Reviewed-by: Andy Shevchenko <andriy.shevchenko@xxxxxxxxx>

(also assuming we will have at some point the above mentioned amendment).

--
With Best Regards,
Andy Shevchenko