Re: [PATCH] of: reduce the number of PROBE_DEFERs

From: Grant Likely
Date: Tue Aug 20 2013 - 06:13:50 EST


On Tue, Aug 20, 2013 at 11:01 AM, Jean-Francois Moine <moinejf@xxxxxxx> wrote:
> This patch populates the platform from the device tree into two steps:
> the first step creates the nodes that are referenced by a phandle,
> the second step creates the other nodes.
>
> This permits to reduce the number of PROBE_DEFERs.
>
> Signed-off-by: Jean-Francois Moine <moinejf@xxxxxxx>
> ---
> A better way to reduce probe deferral could be sorting the nodes
> according to their phandle level in the DT blob at compilation time ...

Have you got measurements or statistics that show this making a
difference? I suspect you'll find for boot time it will have little to
no affect since the device driver probe order is more closely related
to the kernel link order than the order that devices were registered.

g.

> ---
> drivers/of/platform.c | 17 ++++++++++++++++-
> 1 file changed, 16 insertions(+), 1 deletion(-)
>
> diff --git a/drivers/of/platform.c b/drivers/of/platform.c
> index e0a6514..a2ea858 100644
> --- a/drivers/of/platform.c
> +++ b/drivers/of/platform.c
> @@ -382,8 +382,23 @@ static int of_platform_bus_create(struct device_node *bus,
> if (!dev || !of_match_node(matches, bus))
> return 0;
>
> + /* first step: create the nodes that are referenced by phandle */
> for_each_child_of_node(bus, child) {
> - pr_debug(" create child: %s\n", child->full_name);
> + if (child->phandle == 0)
> + continue;
> + pr_debug(" create child 1: %s\n", child->full_name);
> + rc = of_platform_bus_create(child, matches, lookup, &dev->dev, strict);
> + if (rc) {
> + of_node_put(child);
> + return rc;
> + }
> + }
> +
> + /* second step: create the other nodes */
> + for_each_child_of_node(bus, child) {
> + if (child->phandle != 0)
> + continue;
> + pr_debug(" create child 2: %s\n", child->full_name);
> rc = of_platform_bus_create(child, matches, lookup, &dev->dev, strict);
> if (rc) {
> of_node_put(child);
>
>
> --
> Ken ar c'hentañ | ** Breizh ha Linux atav! **
> Jef | http://moinejf.free.fr/
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/