diff options
| author | Bartosz Golaszewski <bartosz.golaszewski@oss.qualcomm.com> | 2026-07-06 14:44:16 +0200 |
|---|---|---|
| committer | Greg Kroah-Hartman <gregkh@linuxfoundation.org> | 2026-07-10 16:07:09 +0200 |
| commit | 5b84ef0b029eb488c6a8fd83eea37010ac63b5e1 (patch) | |
| tree | e2d7a905ac3d74ca45242d2ca25baca3a14e6173 /drivers/base | |
| parent | 8877c06885ce43780f7630973dc47cd3a625524b (diff) | |
driver core: platform: provide platform_device_set_of_node_from_dev()
Provide a platform-specific variant of device_set_of_node_from_dev(). In
addition to bumping the reference count of the OF node being assigned,
it also assigns the fwnode of the platform device.
Reviewed-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Signed-off-by: Bartosz Golaszewski <bartosz.golaszewski@oss.qualcomm.com>
Link: https://patch.msgid.link/20260706-pdev-fwnode-ref-v3-4-1ff028e33779@oss.qualcomm.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Diffstat (limited to 'drivers/base')
| -rw-r--r-- | drivers/base/platform.c | 16 |
1 files changed, 16 insertions, 0 deletions
diff --git a/drivers/base/platform.c b/drivers/base/platform.c index 6520b70cf305..f24a5f406746 100644 --- a/drivers/base/platform.c +++ b/drivers/base/platform.c @@ -731,6 +731,22 @@ void platform_device_set_fwnode(struct platform_device *pdev, EXPORT_SYMBOL_GPL(platform_device_set_fwnode); /** + * platform_device_set_of_node_from_dev - reuse OF node of another device + * @pdev: platform device to set the node for + * @dev2: device whose OF node to reuse + * + * Reuses the OF node of another device in this platform device while + * internally keeping track of reference counting. + */ +void platform_device_set_of_node_from_dev(struct platform_device *pdev, + const struct device *dev2) +{ + device_set_of_node_from_dev(&pdev->dev, dev2); + pdev->dev.fwnode = of_fwnode_handle(pdev->dev.of_node); +} +EXPORT_SYMBOL_GPL(platform_device_set_of_node_from_dev); + +/** * platform_device_add - add a platform device to device hierarchy * @pdev: platform device we're adding * |
