Message ID | 20191014051748.20190-19-amitay@ozlabs.org |
---|---|
State | Accepted |
Headers | show |
Series | Add system device tree to libpdbg | expand |
Reviewed-by: Alistair Popple <alistair@popple.id.au> On Monday, 14 October 2019 4:17:36 PM AEDT Amitay Isaacs wrote: > Signed-off-by: Amitay Isaacs <amitay@ozlabs.org> > --- > src/main.c | 18 ++++++++++++++++++ > 1 file changed, 18 insertions(+) > > diff --git a/src/main.c b/src/main.c > index f7f891a..09c236e 100644 > --- a/src/main.c > +++ b/src/main.c > @@ -513,6 +513,21 @@ static bool parse_options(int argc, char *argv[]) > return true; > } > > +static bool child_enabled(struct pdbg_target *target) > +{ > + struct pdbg_target *child; > + > + pdbg_for_each_child_target(target, child) { > + if (child_enabled(child)) > + return true; > + > + if (pdbg_target_status(child) == PDBG_TARGET_ENABLED) > + return true; > + } > + > + return false; > +} > + > static void print_target(struct pdbg_target *target, int level) > { > int i; > @@ -520,6 +535,9 @@ static void print_target(struct pdbg_target *target, int level) > enum pdbg_target_status status; > const char *classname; > > + if (level == 0 && !child_enabled(target)) > + return; > + > /* Does this target actually exist? */ > status = pdbg_target_status(target); > if (status != PDBG_TARGET_ENABLED) >
diff --git a/src/main.c b/src/main.c index f7f891a..09c236e 100644 --- a/src/main.c +++ b/src/main.c @@ -513,6 +513,21 @@ static bool parse_options(int argc, char *argv[]) return true; } +static bool child_enabled(struct pdbg_target *target) +{ + struct pdbg_target *child; + + pdbg_for_each_child_target(target, child) { + if (child_enabled(child)) + return true; + + if (pdbg_target_status(child) == PDBG_TARGET_ENABLED) + return true; + } + + return false; +} + static void print_target(struct pdbg_target *target, int level) { int i; @@ -520,6 +535,9 @@ static void print_target(struct pdbg_target *target, int level) enum pdbg_target_status status; const char *classname; + if (level == 0 && !child_enabled(target)) + return; + /* Does this target actually exist? */ status = pdbg_target_status(target); if (status != PDBG_TARGET_ENABLED)
Signed-off-by: Amitay Isaacs <amitay@ozlabs.org> --- src/main.c | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+)