Re: [PATCH v4] Add limited read-only support for older (V2 and V3) device tree to libfdt.

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]



On Thu, Mar 01, 2018 at 09:14:11AM -0600, Rob Herring wrote:
> On Wed, Jan 24, 2018 at 11:13 PM,  <nwhitehorn@xxxxxxxxxxx> wrote:
> > From: Nathan Whitehorn <nwhitehorn@xxxxxxxxxxx>
> >
> > This can be useful in particular in the kernel when booting on systems
> > with FDT-emitting firmware that is out of date. Releases of kexec-tools
> > on ppc64 prior to the end of 2014 are notable examples of such.
> >
> > Signed-off-by: Nathan Whitehorn <nwhitehorn@xxxxxxxxxxx>
> 
> [...]
> 
> > @@ -233,16 +234,34 @@ int fdt_path_offset(const void *fdt, const char *path)
> >  const char *fdt_get_name(const void *fdt, int nodeoffset, int *len)
> >  {
> >         const struct fdt_node_header *nh = fdt_offset_ptr_(fdt, nodeoffset);
> > +       const char *nameptr;
> >         int err;
> >
> >         if (((err = fdt_check_header(fdt)) != 0)
> >             || ((err = fdt_check_node_offset_(fdt, nodeoffset)) < 0))
> >                         goto fail;
> >
> > +       nameptr = nh->name;
> > +
> > +       if (fdt_version(fdt) < 0x10) {
> > +               /*
> > +                * For old FDT versions, match the naming conventions of V16:
> > +                * give only the leaf name (after all /). The actual tree
> > +                * contents are loosely checked.
> > +                */
> > +               const char *leaf;
> > +               leaf = strrchr(nameptr, '/');
> 
> strrchr is a new dependency which means for importing new libfdt into
> the kernel I get to add 3 implementations of it (because early boot
> code is not shared).
> 
> It would be nice if new dependencies were explicit somehow.

Yeah, it would.  So far I haven't thought of a good way of doing
that.  Suggestions welcome.

-- 
David Gibson			| I'll have my music baroque, and my code
david AT gibson.dropbear.id.au	| minimalist, thank you.  NOT _the_ _other_
				| _way_ _around_!
http://www.ozlabs.org/~dgibson

Attachment: signature.asc
Description: PGP signature


[Index of Archives]     [Device Tree]     [Device Tree Spec]     [Linux Driver Backports]     [Video for Linux]     [Linux USB Devel]     [Linux Audio Users]     [Linux Kernel]     [Linux SCSI]     [Yosemite Backpacking]

  Powered by Linux