[Pdbg] [PATCH 03/10] libpdbg/target: add a release operation
Nicholas Piggin
npiggin at gmail.com
Tue May 8 12:57:21 AEST 2018
On Tue, 08 May 2018 12:12:54 +1000
Alistair Popple <alistair at popple.id.au> wrote:
> > diff --git a/libpdbg/target.c b/libpdbg/target.c
> > index 704d7d5..bf5fb08 100644
> > --- a/libpdbg/target.c
> > +++ b/libpdbg/target.c
> > @@ -285,6 +285,9 @@ enum pdbg_target_status pdbg_target_probe(struct pdbg_target *target)
> > assert(target);
> >
> > status = pdbg_target_status(target);
> > + assert(status != PDBG_TARGET_RELEASED);
> > + assert(status != PDBG_TARGET_PENDING_RELEASE);
>
> Is there any reason we couldn't just reprobe targets that are in this state?
No I don't think so. Well, PENDING_RELEASE would just flip back, _RELEASED
would have to be re-probed.
>
> > diff --git a/libpdbg/target.h b/libpdbg/target.h
> > index eba26cb..a33e089 100644
> > --- a/libpdbg/target.h
> > +++ b/libpdbg/target.h
> > @@ -44,6 +44,7 @@ struct pdbg_target {
> > char *compatible;
> > char *class;
> > int (*probe)(struct pdbg_target *target);
> > + void (*release)(struct pdbg_target *target);
> > int index;
> > enum pdbg_target_status status;
> > const char *dn_name;
> > @@ -64,9 +65,14 @@ struct pdbg_target_class *get_target_class(const char *name);
> > bool pdbg_target_is_class(struct pdbg_target *target, const char *class);
> >
> > extern struct list_head empty_list;
> > +extern struct list_head target_classes;
> > +
> > #define for_each_class_target(class_name, target) \
> > list_for_each((find_target_class(class_name) ? &require_target_class(class_name)->targets : &empty_list), target, class_link)
> >
> > +#define for_each_target_class(target_class) \
> > + list_for_each(&target_classes, target_class, class_head_link)
> > +
>
> What is this used for? I guess it's meant to iterate over every class?
Yes it's to clean up everything, used in the next patch.
Thanks,
Nick
More information about the Pdbg
mailing list