[PATCH 02/15] of: add devicetree probing support
Jean-Christophe PLAGNIOL-VILLARD
plagnioj at jcrosoft.com
Tue Sep 18 11:48:06 EDT 2012
> + !strcmp(pp->name, "linux,phandle"))
> + continue;
> +
> + np = of_find_node_by_path(pp->value);
> + if (!np)
> + continue;
> +
> + /* walk the alias backwards to extract the id and work out
> + * the 'stem' string */
> + while (isdigit(*(end-1)) && end > start)
> + end--;
> + len = end - start;
> +
> + id = simple_strtol(end, 0, 10);
> + if (id < 0)
> + continue;
> +
> + /* Allocate an alias_prop with enough space for the stem */
> + ap = xzalloc(sizeof(*ap) + len + 1);
xzalloc does not if nomem
> + if (!ap)
> + continue;
> + ap->alias = start;
> + of_alias_add(ap, np, id, start, len);
> + }
> +}
> +
Best Regards,
J.
More information about the barebox
mailing list