]> git.kernelconcepts.de Git - karo-tx-linux.git/commitdiff
of/platform: Initialise dev->fwnode appropriately
authorRobin Murphy <robin.murphy@arm.com>
Wed, 14 Sep 2016 15:01:24 +0000 (16:01 +0100)
committerRob Herring <robh@kernel.org>
Thu, 15 Sep 2016 13:35:56 +0000 (08:35 -0500)
Whilst we're some of the way towards a universal firmware property
interface, drivers which deal with both OF and ACPI probing end up
having to do things like this:

    dev->of_node ? &dev->of_node->fwnode : dev->fwnode

This seems unnecessary, when the OF code could instead simply fill in
the device's fwnode when binding the of_node, and let the drivers use
dev->fwnode either way. Let's give it a go and see what falls out.

Signed-off-by: Robin Murphy <robin.murphy@arm.com>
Signed-off-by: Rob Herring <robh@kernel.org>
drivers/of/platform.c

index f39ccd5aa70125a1fc22529fff0b3de185aa5cd6..f811d27964370475040b3a51b3b86d590b621cf8 100644 (file)
@@ -142,6 +142,7 @@ struct platform_device *of_device_alloc(struct device_node *np,
        }
 
        dev->dev.of_node = of_node_get(np);
+       dev->dev.fwnode = &np->fwnode;
        dev->dev.parent = parent ? : &platform_bus;
 
        if (bus_id)
@@ -241,6 +242,7 @@ static struct amba_device *of_amba_device_create(struct device_node *node,
 
        /* setup generic device info */
        dev->dev.of_node = of_node_get(node);
+       dev->dev.fwnode = &node->fwnode;
        dev->dev.parent = parent ? : &platform_bus;
        dev->dev.platform_data = platform_data;
        if (bus_id)