[Pdbg] [PATCH v2 03/16] libpdbg: Add API to get device tree path and find target via path
Amitay Isaacs
amitay at ozlabs.org
Wed Nov 7 17:00:53 AEDT 2018
Reviewed-by: Amitay Isaacs <amitay at ozlabs.org>
On Wed, 2018-11-07 at 16:39 +1100, Alistair Popple wrote:
> Signed-off-by: Alistair Popple <alistair at popple.id.au>
> ---
> libpdbg/libpdbg.c | 13 +++++++++++++
> libpdbg/libpdbg.h | 2 ++
> 2 files changed, 15 insertions(+)
>
> diff --git a/libpdbg/libpdbg.c b/libpdbg/libpdbg.c
> index ccaad3e..f77138a 100644
> --- a/libpdbg/libpdbg.c
> +++ b/libpdbg/libpdbg.c
> @@ -135,6 +135,19 @@ const char *pdbg_target_dn_name(struct
> pdbg_target *target)
> return target->dn_name;
> }
>
> +char *pdbg_target_path(const struct pdbg_target *target)
> +{
> + return dt_get_path(target);
> +}
> +
> +struct pdbg_target *pdbg_target_from_path(struct pdbg_target
> *target, const char *path)
> +{
> + if (!target)
> + target = dt_root;
> +
> + return dt_find_by_path(target, path);
> +}
> +
> void pdbg_set_target_property(struct pdbg_target *target, const char
> *name, const void *val, size_t size)
> {
> struct dt_property *p;
> diff --git a/libpdbg/libpdbg.h b/libpdbg/libpdbg.h
> index 138521c..b11866a 100644
> --- a/libpdbg/libpdbg.h
> +++ b/libpdbg/libpdbg.h
> @@ -84,6 +84,8 @@ void pdbg_target_release(struct pdbg_target
> *target);
> enum pdbg_target_status pdbg_target_status(struct pdbg_target
> *target);
> void pdbg_target_status_set(struct pdbg_target *target, enum
> pdbg_target_status status);
> uint32_t pdbg_target_index(struct pdbg_target *target);
> +char *pdbg_target_path(const struct pdbg_target *target);
> +struct pdbg_target *pdbg_target_from_path(struct pdbg_target
> *target, const char *path);
> uint32_t pdbg_parent_index(struct pdbg_target *target, char *klass);
> char *pdbg_target_class_name(struct pdbg_target *target);
> char *pdbg_target_name(struct pdbg_target *target);
> --
> 2.11.0
>
Amitay.
--
There is never a wrong time to do the right thing.
More information about the Pdbg
mailing list