Messages in this thread | | | From | Måns Rullgård <> | Subject | Re: [PATCH] platform: set of_node in platform_device_register_full() | Date | Wed, 20 Feb 2019 11:53:50 +0000 |
| |
Mans Rullgard <mans@mansr.com> writes:
> If the provided fwnode is an OF node, set dev.of_node as well. > > Some drivers are just shims that create extra "glue" devices with the > DT device as parent and have the real driver bind to these. In these > cases, the glue device needs to get a reference to the original DT node > in order for the main driver to access properties and child nodes. > > For example, the sunxi-musb driver creates such a glue device using > platform_device_register_full(). Consequently, devices attached to > this USB interface don't get associated with DT nodes, if present, > the way they do with EHCI. > > This change will allow sunxi-musb and similar driver to easily > propagate the DT node to child devices as required. > > Signed-off-by: Mans Rullgard <mans@mansr.com> > --- > drivers/base/platform.c | 1 + > 1 file changed, 1 insertion(+) > > diff --git a/drivers/base/platform.c b/drivers/base/platform.c > index dff82a3c2caa..853a1d0e5845 100644 > --- a/drivers/base/platform.c > +++ b/drivers/base/platform.c > @@ -512,6 +512,7 @@ struct platform_device *platform_device_register_full( > > pdev->dev.parent = pdevinfo->parent; > pdev->dev.fwnode = pdevinfo->fwnode; > + pdev->dev.of_node = of_node_get(to_of_node(pdev->dev.fwnode)); > > if (pdevinfo->dma_mask) { > /* > --
Sorry, I forgot to add a v2 to this. Anyway, the only change is the commit message.
-- Måns Rullgård
| |