Re: [PATCH v2 19/19] driver core: platform: count references to all kinds of firmware nodes
From: Andy Shevchenko
Date: Mon Jun 29 2026 - 12:26:36 EST
On Mon, Jun 29, 2026 at 11:12:42AM +0200, Bartosz Golaszewski wrote:
> When using platform_device_register_full(), we currently only increase
> the reference count of the OF node associated with a platform device. We
> symmetrically decrease it in platform_device_release(). With all users in
> tree now converted to using provided platform device helpers for
> assigning OF and firmware nodes, we can now switch to counting references
> of all kinds of firmware nodes.
Yep, that's the expected result, thanks!
...
> void platform_device_set_fwnode(struct platform_device *pdev,
> struct fwnode_handle *fwnode)
> {
> - if (is_of_node(fwnode))
> - platform_device_set_of_node(pdev, to_of_node(fwnode));
> - else
> - pdev->dev.fwnode = fwnode;
> + fwnode_handle_put(pdev->dev.fwnode);
> + pdev->dev.fwnode = fwnode_handle_get(fwnode);
> + pdev->dev.of_node = to_of_node(fwnode);
device_set_node(&pdev->dev, fwnode_handle_get(fwnode));
> }
...
> pdev->dev.parent = pdevinfo->parent;
> - pdev->dev.fwnode = pdevinfo->fwnode;
> - pdev->dev.of_node = of_node_get(to_of_node(pdev->dev.fwnode));
> + pdev->dev.fwnode = fwnode_handle_get(pdevinfo->fwnode);
> + pdev->dev.of_node = to_of_node(pdev->dev.fwnode);
See above.
...
With them being addressed,
Reviewed-by: Andy Shevchenko <andriy.shevchenko@xxxxxxxxxxxxxxx>
--
With Best Regards,
Andy Shevchenko