mirror of
https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
synced 2026-08-31 11:41:29 -04:00
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>
This commit is contained in:
committed by
Greg Kroah-Hartman
parent
8877c06885
commit
5b84ef0b02
@@ -730,6 +730,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
|
||||
|
||||
@@ -268,6 +268,8 @@ void platform_device_set_of_node(struct platform_device *pdev,
|
||||
struct device_node *np);
|
||||
void platform_device_set_fwnode(struct platform_device *pdev,
|
||||
struct fwnode_handle *fwnode);
|
||||
void platform_device_set_of_node_from_dev(struct platform_device *pdev,
|
||||
const struct device *dev2);
|
||||
extern int platform_device_add(struct platform_device *pdev);
|
||||
extern void platform_device_del(struct platform_device *pdev);
|
||||
extern void platform_device_put(struct platform_device *pdev);
|
||||
|
||||
Reference in New Issue
Block a user