[Pdbg] [RFC 09/12] libpdbg: Initialise target class from device-tree

Alistair Popple alistair at popple.id.au
Tue Aug 20 14:58:34 AEST 2019


This was only required for the subsequent patches so I will drop this from the 
series for now. We can always add it back if it turns out we need it later on.

- Alistair

On Tuesday, 20 August 2019 2:06:52 PM AEST Amitay Isaacs wrote:
> I guess we can keep this for time being till we add drivers for all the
> hardware units.
> 
> Reviewed-by: Amitay Isaacs <amitay at ozlabs.org>
> 
> On Tue, 2019-08-06 at 11:37 +1000, Alistair Popple wrote:
> > The target class is usually initialised from the hardware unit
> > description. However if no hardware unit is found no class is
> > assigned. This patch makes it possible to assign one in cases when no
> > hardware unit is available.
> > 
> > This is primarily useful for busses and other targets that have
> > drivers assigned via the backend selection logic.
> > 
> > Signed-off-by: Alistair Popple <alistair at popple.id.au>
> > ---
> >  libpdbg/device.c | 11 +++++++++++
> >  1 file changed, 11 insertions(+)
> > 
> > diff --git a/libpdbg/device.c b/libpdbg/device.c
> > index f6d27db..428d946 100644
> > --- a/libpdbg/device.c
> > +++ b/libpdbg/device.c
> > @@ -118,6 +118,8 @@ static struct pdbg_target *pdbg_target_new(const
> > void *fdt, int node_offset)
> >  
> >  static struct pdbg_target *dt_new_node(const char *name, const void
> > *fdt, int node_offset)
> >  {
> > +	struct pdbg_target_class *target_class;
> > +	const struct fdt_property *prop;
> >  	struct pdbg_target *node = NULL;
> >  	size_t size = sizeof(*node);
> >  
> > @@ -132,6 +134,15 @@ static struct pdbg_target *dt_new_node(const
> > char *name, const void *fdt, int no
> >  		abort();
> >  	}
> >  
> > +	if (fdt && !node->class) {
> > +		prop = fdt_get_property(fdt, node_offset, "class",
> > NULL);
> > +		if (prop) {
> > +			node->class = (char *) &prop->data[0];
> > +			target_class = get_target_class(node);
> > +			list_add_tail(&target_class->targets, &node-
> > >class_link);
> > +		}
> > +	}
> > +
> >  	node->dn_name = take_name(name);
> >  	node->parent = NULL;
> >  	list_head_init(&node->properties);
> 
> Amitay.
> 






More information about the Pdbg mailing list