This RFC is to show the following (a) a use case for a new remoteproc API rproc_get_by_id() (b) patch for the new API rproc_get_by_id() For context there exist multiple drivers in remoteproc that manage more than one remote processor. For these drivers, calls to rproc_get_by_phandle() are not sufficient as the check at https://github.com/torvalds/linux/blob/master/drivers/remoteproc/remoteproc_core.c#L2111 will not work. This is because for r->dev.parent, r->dev's parent is expected to be the platform device that corresponds to the platform-probe() call but instead is the child and this child does not have the driver field set. An example to show this issue is as follows: If a remoteproc driver has the following DTS binding: /{ remoteproc_cluster { compatible = "soc,remoteproc-cluster"; core0: core0 { memory-region; sram; }; core1: core1 { memory-region; sram; } }; }; And in the corresponding driver the platform-probe() is as follows: static int cluster_platform_probe(struct platform_device *pdev) { struct device_node *np = dev_of_node(dev); struct device *dev = &pdev->dev; struct platform_device *cpdev; struct device *child_dev; struct rproc *rp; for_each_available_child_of_node(np, child) { cpdev = of_find_device_by_node(child); child_dev = &cpdev->dev; rp = rproc_alloc(cdev, dev_name(cdev), dummy_ops, NULL, sizeof(struct dummy_ops)); } return 0; } After the rproc call is done and when another driver tries to access this rproc structure via a rproc_get_by_phandle(), the aforementioned check of r->dev.parent->driver will be NULL. To account for a remoteproc driver that manages multiple remote processors, I have provided an API rproc_get_by_id() that enables getting rp given a phandle to the core in question with a DT binding and usage of the API. Sample binding: /{ platform_driver_sample { compatible = "custom_platform"; rproc = <&core1>; }; }; Sample usage: static int custom_platform_probe(struct platform_device *pdev) { struct rproc *rp; struct device_node *node; node = of_parse_phandle(pdev->dev.of_node, "rproc", 0); /* Here get rproc 1, as its index should be 1 */ rp = rproc_get_by_id(node->phandle, 1); return 0; } If we want further specification of getting the correct remoteproc ID, this can be inferred from the pdev->dev child's device child node and its dev->init_name field as this is set in rproc_alloc() as follows: dev_set_name(&rproc->dev, "remoteproc%d", rproc->index); We can then parse the pdev->dev child device as follows: int index; sscanf(dev_name(dev), "remoteproc%d", &index); Additionally I have provided the implementation for the API in the subsequent patch. Ben Levinsky (1): remoteproc: Introduce rproc_get_by_id API drivers/remoteproc/remoteproc_core.c | 64 +++++++++++++++++++++++++++- include/linux/remoteproc.h | 1 + 2 files changed, 64 insertions(+), 1 deletion(-) -- 2.25.1