Thread (1 message) 1 message, 1 author, 2014-05-13

[PATCH v3] of: Keep track of populated platform devices

From: Rob Herring <hidden>
Date: 2014-05-13 12:24:50
Also in: linux-devicetree

On Tue, May 13, 2014 at 6:48 AM, Pawel Moll [off-list ref] wrote:
In "Device Tree powered" systems, platform devices are usually
massively populated with of_platform_populate() call, executed
at some level of initcalls, either by generic architecture
or by platform-specific code.

There are situations though where certain devices must be
created (and bound with drivers) before all the others.
This presents a challenge, as devices created explicitly
would be created again by of_platform_populate().

This patch tries to solve that issue in a generic way,
adding a "populated" flag for a DT node description.
Once set, this device will never be created again via
of_* API, so of_platform_populate() will skip such nodes
(and its children) in a similar way to the non-available
ones.

The flag is cleared when a device is being removed and
returns the DT node by calling of_device_node_put() (it
was missing from the amba device release function, added).

Signed-off-by: Pawel Moll <redacted>
A few formatting nits, but otherwise:

Reviewed-by: Rob Herring <robh@kernel.org>

[..]
quoted hunk
@@ -206,12 +206,13 @@ static struct platform_device *of_platform_device_create_pdata(
 {
        struct platform_device *dev;

-       if (!of_device_is_available(np))
+       if (!of_device_is_available(np) ||
+                       of_node_test_and_set_flag(np, OF_POPULATED))
This should be lined up with the ! on the previous line.

quoted hunk
@@ -264,14 +269,15 @@ static struct amba_device *of_amba_device_create(struct device_node *node,

        pr_debug("Creating amba device %s\n", node->full_name);

-       if (!of_device_is_available(node))
+       if (!of_device_is_available(node) ||
+                       of_node_test_and_set_flag(node, OF_POPULATED))
And this one.
                return NULL;
Rob
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help