Message ID | 20191003041909.23187-12-amitay@ozlabs.org |
---|---|
State | Accepted |
Headers | show |
Series | Add system device tree to libpdbg | expand |
Context | Check | Description |
---|---|---|
snowpatch_ozlabs/apply_patch | success | Successfully applied on branch master (8a10a05c89db666bf98734139334166da7c370a4) |
snowpatch_ozlabs/build-multiarch | success | Test build-multiarch on branch master |
Reviewed-by: Alistair Popple <alistair@popple.id.au> On Thursday, 3 October 2019 2:18:50 PM AEDT Amitay Isaacs wrote: > Even though there can be two different paths to a node, libpdbg users > should always see the path as defined in system device tree (view) which > is the same and independent of the backend device tree. > > Signed-off-by: Amitay Isaacs <amitay@ozlabs.org> > --- > libpdbg/device.c | 2 ++ > 1 file changed, 2 insertions(+) > > diff --git a/libpdbg/device.c b/libpdbg/device.c > index 2a02504..2f3d677 100644 > --- a/libpdbg/device.c > +++ b/libpdbg/device.c > @@ -219,6 +219,7 @@ static char *dt_get_path(struct pdbg_target *node) > return strdup("<NULL>"); > > for (n = node; n; n = n->parent) { > + n = target_to_virtual(n); > len += strlen(n->dn_name); > if (n->parent || n == node) > len++; > @@ -227,6 +228,7 @@ static char *dt_get_path(struct pdbg_target *node) > assert(path); > p = path + len; > for (n = node; n; n = n->parent) { > + n = target_to_virtual(n); > len = strlen(n->dn_name); > p -= len; > memcpy(p, n->dn_name, len); >
diff --git a/libpdbg/device.c b/libpdbg/device.c index 2a02504..2f3d677 100644 --- a/libpdbg/device.c +++ b/libpdbg/device.c @@ -219,6 +219,7 @@ static char *dt_get_path(struct pdbg_target *node) return strdup("<NULL>"); for (n = node; n; n = n->parent) { + n = target_to_virtual(n); len += strlen(n->dn_name); if (n->parent || n == node) len++; @@ -227,6 +228,7 @@ static char *dt_get_path(struct pdbg_target *node) assert(path); p = path + len; for (n = node; n; n = n->parent) { + n = target_to_virtual(n); len = strlen(n->dn_name); p -= len; memcpy(p, n->dn_name, len);
Even though there can be two different paths to a node, libpdbg users should always see the path as defined in system device tree (view) which is the same and independent of the backend device tree. Signed-off-by: Amitay Isaacs <amitay@ozlabs.org> --- libpdbg/device.c | 2 ++ 1 file changed, 2 insertions(+)