Re: [PATCH v3] checks: add chosen node checks

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



On Thu, Dec 14, 2017 at 09:11:52PM -0600, Rob Herring wrote:
> On Thu, Dec 14, 2017 at 8:27 PM, David Gibson
> <david@xxxxxxxxxxxxxxxxxxxxx> wrote:
> > On Thu, Dec 14, 2017 at 04:40:01PM -0600, Rob Herring wrote:
> >> Add some checks for /chosen node. These check that chosen is located at
> >> the root level and that bootargs and stdout-path properties are strings.
> >>
> >> Signed-off-by: Rob Herring <robh@xxxxxxxxxx>
> >
> > Applied, thanks.
> >
> > One possible follow-on...
> >
> > [snip]
> >> +static void check_chosen_node_stdout_path(struct check *c, struct dt_info *dti,
> >> +                                       struct node *node)
> >> +{
> >> +     struct property *prop;
> >> +
> >> +     if (!streq(node->name, "chosen"))
> >> +             return;
> >> +
> >> +     prop = get_property(node, "stdout-path");
> >> +     if (!prop) {
> >> +             prop = get_property(node, "linux,stdout-path");
> >> +             if (!prop)
> >> +                     return;
> >> +             FAIL(c, dti, "Use 'stdout-path' instead of 'linux,stdout-path'");
> >> +     }
> >> +
> >> +     c->data = prop->name;
> >> +     check_is_string(c, dti, node);
> >
> > .. you could also check that it's actually a valid path to a node,
> > couldn't you?
> 
> Yes I thought of that, but it's often an alias. I didn't look closely,
> but I don't think that would work unless I add that additional
> lookup.

Ah, good point, you would need to check against aliases as well.  We
probably should have a helper that looks up a path, including alias
resolution (so both "/absolute/path" and "alias/path/from/alias").
Both forms are traditionally allowed in most contexts that accept a
path in OF.

-- 
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