Re: [PATCH v2 4/5] of: overlay: Pick up label symbols from overlays.
On Mon, May 16, 2016 at 9:40 PM, Geert Uytterhoevenwrote: > On Mon, May 16, 2016 at 9:27 PM, Pantelis Antoniou > wrote: >>> On May 16, 2016, at 22:06 , Geert Uytterhoeven wrote: >>> On Mon, May 16, 2016 at 6:52 PM, Pantelis Antoniou >>> wrote: Insert overlay symbols to the base tree when applied. This makes it possible to apply an overlay that references a label that a previously inserted overlay had. Signed-off-by: Pantelis Antoniou >>> >>> This patch hasn't changed, so I think you can keep my >> >> It’s been tweaked slightly that’s why I dropped your tested-by >> signoff. Could you test this version again please to verify it >> works for you? > > Oh, I missed that you did make some changes... > > Will test again and report back to you... Tested-by: Geert Uytterhoeven Gr{oetje,eeting}s, Geert -- Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- ge...@linux-m68k.org In personal conversations with technical people, I call myself a hacker. But when I'm talking to journalists I just say "programmer" or something like that. -- Linus Torvalds
Re: [PATCH v2 4/5] of: overlay: Pick up label symbols from overlays.
On Mon, May 16, 2016 at 9:40 PM, Geert Uytterhoeven wrote: > On Mon, May 16, 2016 at 9:27 PM, Pantelis Antoniou > wrote: >>> On May 16, 2016, at 22:06 , Geert Uytterhoeven wrote: >>> On Mon, May 16, 2016 at 6:52 PM, Pantelis Antoniou >>> wrote: Insert overlay symbols to the base tree when applied. This makes it possible to apply an overlay that references a label that a previously inserted overlay had. Signed-off-by: Pantelis Antoniou >>> >>> This patch hasn't changed, so I think you can keep my >> >> It’s been tweaked slightly that’s why I dropped your tested-by >> signoff. Could you test this version again please to verify it >> works for you? > > Oh, I missed that you did make some changes... > > Will test again and report back to you... Tested-by: Geert Uytterhoeven Gr{oetje,eeting}s, Geert -- Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- ge...@linux-m68k.org In personal conversations with technical people, I call myself a hacker. But when I'm talking to journalists I just say "programmer" or something like that. -- Linus Torvalds
Re: [PATCH v2 4/5] of: overlay: Pick up label symbols from overlays.
Hi Pantelis, On Mon, May 16, 2016 at 9:27 PM, Pantelis Antoniouwrote: >> On May 16, 2016, at 22:06 , Geert Uytterhoeven wrote: >> On Mon, May 16, 2016 at 6:52 PM, Pantelis Antoniou >> wrote: >>> Insert overlay symbols to the base tree when applied. >>> This makes it possible to apply an overlay that references a label >>> that a previously inserted overlay had. >>> >>> Signed-off-by: Pantelis Antoniou >> >> This patch hasn't changed, so I think you can keep my > > It’s been tweaked slightly that’s why I dropped your tested-by > signoff. Could you test this version again please to verify it > works for you? Oh, I missed that you did make some changes... Will test again and report back to you... Gr{oetje,eeting}s, Geert -- Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- ge...@linux-m68k.org In personal conversations with technical people, I call myself a hacker. But when I'm talking to journalists I just say "programmer" or something like that. -- Linus Torvalds
Re: [PATCH v2 4/5] of: overlay: Pick up label symbols from overlays.
Hi Pantelis, On Mon, May 16, 2016 at 9:27 PM, Pantelis Antoniou wrote: >> On May 16, 2016, at 22:06 , Geert Uytterhoeven wrote: >> On Mon, May 16, 2016 at 6:52 PM, Pantelis Antoniou >> wrote: >>> Insert overlay symbols to the base tree when applied. >>> This makes it possible to apply an overlay that references a label >>> that a previously inserted overlay had. >>> >>> Signed-off-by: Pantelis Antoniou >> >> This patch hasn't changed, so I think you can keep my > > It’s been tweaked slightly that’s why I dropped your tested-by > signoff. Could you test this version again please to verify it > works for you? Oh, I missed that you did make some changes... Will test again and report back to you... Gr{oetje,eeting}s, Geert -- Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- ge...@linux-m68k.org In personal conversations with technical people, I call myself a hacker. But when I'm talking to journalists I just say "programmer" or something like that. -- Linus Torvalds
Re: [PATCH v2 4/5] of: overlay: Pick up label symbols from overlays.
Hi Geert, > On May 16, 2016, at 22:06 , Geert Uytterhoevenwrote: > > On Mon, May 16, 2016 at 6:52 PM, Pantelis Antoniou > wrote: >> Insert overlay symbols to the base tree when applied. >> This makes it possible to apply an overlay that references a label >> that a previously inserted overlay had. >> >> Signed-off-by: Pantelis Antoniou > > This patch hasn't changed, so I think you can keep my It’s been tweaked slightly that’s why I dropped your tested-by signoff. Could you test this version again please to verify it works for you? > Tested-by: Geert Uytterhoeven > > Gr{oetje,eeting}s, > >Geert > Regards — Pantelis > -- > Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- > ge...@linux-m68k.org > > In personal conversations with technical people, I call myself a hacker. But > when I'm talking to journalists I just say "programmer" or something like > that. >-- Linus Torvalds
Re: [PATCH v2 4/5] of: overlay: Pick up label symbols from overlays.
Hi Geert, > On May 16, 2016, at 22:06 , Geert Uytterhoeven wrote: > > On Mon, May 16, 2016 at 6:52 PM, Pantelis Antoniou > wrote: >> Insert overlay symbols to the base tree when applied. >> This makes it possible to apply an overlay that references a label >> that a previously inserted overlay had. >> >> Signed-off-by: Pantelis Antoniou > > This patch hasn't changed, so I think you can keep my It’s been tweaked slightly that’s why I dropped your tested-by signoff. Could you test this version again please to verify it works for you? > Tested-by: Geert Uytterhoeven > > Gr{oetje,eeting}s, > >Geert > Regards — Pantelis > -- > Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- > ge...@linux-m68k.org > > In personal conversations with technical people, I call myself a hacker. But > when I'm talking to journalists I just say "programmer" or something like > that. >-- Linus Torvalds
Re: [PATCH v2 4/5] of: overlay: Pick up label symbols from overlays.
On Mon, May 16, 2016 at 6:52 PM, Pantelis Antoniouwrote: > Insert overlay symbols to the base tree when applied. > This makes it possible to apply an overlay that references a label > that a previously inserted overlay had. > > Signed-off-by: Pantelis Antoniou This patch hasn't changed, so I think you can keep my Tested-by: Geert Uytterhoeven Gr{oetje,eeting}s, Geert -- Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- ge...@linux-m68k.org In personal conversations with technical people, I call myself a hacker. But when I'm talking to journalists I just say "programmer" or something like that. -- Linus Torvalds
Re: [PATCH v2 4/5] of: overlay: Pick up label symbols from overlays.
On Mon, May 16, 2016 at 6:52 PM, Pantelis Antoniou wrote: > Insert overlay symbols to the base tree when applied. > This makes it possible to apply an overlay that references a label > that a previously inserted overlay had. > > Signed-off-by: Pantelis Antoniou This patch hasn't changed, so I think you can keep my Tested-by: Geert Uytterhoeven Gr{oetje,eeting}s, Geert -- Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- ge...@linux-m68k.org In personal conversations with technical people, I call myself a hacker. But when I'm talking to journalists I just say "programmer" or something like that. -- Linus Torvalds
[PATCH v2 4/5] of: overlay: Pick up label symbols from overlays.
Insert overlay symbols to the base tree when applied. This makes it possible to apply an overlay that references a label that a previously inserted overlay had. Signed-off-by: Pantelis Antoniou--- drivers/of/overlay.c | 93 1 file changed, 93 insertions(+) diff --git a/drivers/of/overlay.c b/drivers/of/overlay.c index a274d65..89ebb70 100644 --- a/drivers/of/overlay.c +++ b/drivers/of/overlay.c @@ -8,6 +8,7 @@ * modify it under the terms of the GNU General Public License * version 2 as published by the Free Software Foundation. */ + #undef DEBUG #include #include @@ -514,6 +515,91 @@ static int of_free_overlay_info(struct of_overlay *ov) return 0; } +static int of_overlay_add_symbols( + struct device_node *tree, + struct of_overlay *ov) +{ + struct of_overlay_info *ovinfo; + struct device_node *root_sym = NULL; + struct device_node *child = NULL; + struct property *prop; + const char *path, *s; + char *new_path; + int i, len, err; + + /* both may fail (if no fixups are required) */ + root_sym = of_find_node_by_path("/__symbols__"); + child = of_get_child_by_name(tree, "__symbols__"); + + err = 0; + /* do nothing if either is NULL */ + if (!root_sym || !child) + goto out; + + for_each_property_of_node(child, prop) { + + /* skip properties added automatically */ + if (of_prop_cmp(prop->name, "name") == 0) + continue; + + err = of_property_read_string(child, + prop->name, ); + if (err != 0) { + pr_err("Could not find symbol '%s'\n", prop->name); + continue; + } + + /* now find fragment index */ + s = path; + + /* compare paths to find fragment index */ + for (i = 0, ovinfo = NULL, len = -1; i < ov->count; i++) { + ovinfo = >ovinfo_tab[i]; + + pr_debug("#%d: overlay->name=%s target->name=%s\n", + i, ovinfo->overlay->full_name, + ovinfo->target->full_name); + + len = strlen(ovinfo->overlay->full_name); + if (strncasecmp(path, ovinfo->overlay->full_name, + len) == 0 && path[len] == '/') + break; + } + + if (i >= ov->count) + continue; + + pr_debug("found target at #%d\n", i); + new_path = kasprintf(GFP_KERNEL, "%s%s", + ovinfo->target->full_name, + path + len); + if (!new_path) { + pr_err("Failed to allocate propname for \"%s\"\n", + prop->name); + err = -ENOMEM; + break; + } + + err = of_changeset_add_property_string(>cset, root_sym, + prop->name, new_path); + + /* free always */ + kfree(new_path); + + if (err) { + pr_err("Failed to add property for \"%s\"\n", + prop->name); + break; + } + } + +out: + of_node_put(child); + of_node_put(root_sym); + + return err; +} + static LIST_HEAD(ov_list); static DEFINE_IDR(ov_idr); @@ -642,6 +728,13 @@ static int __of_overlay_create(struct device_node *tree, goto err_abort_trans; } + err = of_overlay_add_symbols(tree, ov); + if (err) { + pr_err("%s: of_overlay_add_symbols() failed for tree@%s\n", + __func__, tree->full_name); + goto err_abort_trans; + } + /* apply the changeset */ err = __of_changeset_apply(>cset); if (err) { -- 1.7.12
[PATCH v2 4/5] of: overlay: Pick up label symbols from overlays.
Insert overlay symbols to the base tree when applied. This makes it possible to apply an overlay that references a label that a previously inserted overlay had. Signed-off-by: Pantelis Antoniou --- drivers/of/overlay.c | 93 1 file changed, 93 insertions(+) diff --git a/drivers/of/overlay.c b/drivers/of/overlay.c index a274d65..89ebb70 100644 --- a/drivers/of/overlay.c +++ b/drivers/of/overlay.c @@ -8,6 +8,7 @@ * modify it under the terms of the GNU General Public License * version 2 as published by the Free Software Foundation. */ + #undef DEBUG #include #include @@ -514,6 +515,91 @@ static int of_free_overlay_info(struct of_overlay *ov) return 0; } +static int of_overlay_add_symbols( + struct device_node *tree, + struct of_overlay *ov) +{ + struct of_overlay_info *ovinfo; + struct device_node *root_sym = NULL; + struct device_node *child = NULL; + struct property *prop; + const char *path, *s; + char *new_path; + int i, len, err; + + /* both may fail (if no fixups are required) */ + root_sym = of_find_node_by_path("/__symbols__"); + child = of_get_child_by_name(tree, "__symbols__"); + + err = 0; + /* do nothing if either is NULL */ + if (!root_sym || !child) + goto out; + + for_each_property_of_node(child, prop) { + + /* skip properties added automatically */ + if (of_prop_cmp(prop->name, "name") == 0) + continue; + + err = of_property_read_string(child, + prop->name, ); + if (err != 0) { + pr_err("Could not find symbol '%s'\n", prop->name); + continue; + } + + /* now find fragment index */ + s = path; + + /* compare paths to find fragment index */ + for (i = 0, ovinfo = NULL, len = -1; i < ov->count; i++) { + ovinfo = >ovinfo_tab[i]; + + pr_debug("#%d: overlay->name=%s target->name=%s\n", + i, ovinfo->overlay->full_name, + ovinfo->target->full_name); + + len = strlen(ovinfo->overlay->full_name); + if (strncasecmp(path, ovinfo->overlay->full_name, + len) == 0 && path[len] == '/') + break; + } + + if (i >= ov->count) + continue; + + pr_debug("found target at #%d\n", i); + new_path = kasprintf(GFP_KERNEL, "%s%s", + ovinfo->target->full_name, + path + len); + if (!new_path) { + pr_err("Failed to allocate propname for \"%s\"\n", + prop->name); + err = -ENOMEM; + break; + } + + err = of_changeset_add_property_string(>cset, root_sym, + prop->name, new_path); + + /* free always */ + kfree(new_path); + + if (err) { + pr_err("Failed to add property for \"%s\"\n", + prop->name); + break; + } + } + +out: + of_node_put(child); + of_node_put(root_sym); + + return err; +} + static LIST_HEAD(ov_list); static DEFINE_IDR(ov_idr); @@ -642,6 +728,13 @@ static int __of_overlay_create(struct device_node *tree, goto err_abort_trans; } + err = of_overlay_add_symbols(tree, ov); + if (err) { + pr_err("%s: of_overlay_add_symbols() failed for tree@%s\n", + __func__, tree->full_name); + goto err_abort_trans; + } + /* apply the changeset */ err = __of_changeset_apply(>cset); if (err) { -- 1.7.12