Re: Mixed types of values inside a single property

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

 



On Mon, Nov 21, 2022 at 9:31 AM Andy Shevchenko
<andriy.shevchenko@xxxxxxxxx> wrote:
>
> On Mon, Nov 21, 2022 at 03:23:53PM +0100, Krzysztof Kozlowski wrote:
> > On 21/11/2022 15:11, Andy Shevchenko wrote:
> > > On Mon, Nov 21, 2022 at 02:52:37PM +0100, Krzysztof Kozlowski wrote:
> > >> On 21/11/2022 13:59, Andy Shevchenko wrote:
> > >>>
> > >>> Hi, Rob and Krzysztof!
> > >>>
> > >>> Today on SO one question [1] was popped up, and I, remembering a bit of
> > >>> the code of device properties in the Linux kernel, was a bit surprised of it
> > >>> in a way that reading DT specification (0.4-rc1 as of today) doesn't clarify
> > >>> that either.
> > >>>
> > >>> Can the specification be a bit more clear about that? Or is it me and the OP of
> > >>> that question who missed something in the DT spec?

Please use devicetree-spec list for questions like this because it's a
spec question and I only see these on my periodic search for non-patch
emails.

> > >>> [1]: https://stackoverflow.com/questions/74517569/reading-tuples-in-a-devicetree
> > >>
> > >> I saw question on Stackoverflow and I saw there answers, but what is the
> > >> question to us?
> > >
> > > Does the specification allows mixed types of the values in the same property?
> > > Because reading it doesn't give a hint.
> >
> > I think DT spec allows it ("Format is specific to the property. See the
> > property definition.")
>
> And the quoted sentence confuses me. Is it related to _defined_ only properties
> (that are in the same document) or is it to any property, then what does the
> second part actually mean in the latter case: "see the property definition".
> Where?

Any property in the schemas. (I would say if not in the spec, but
everything in the spec should have a schema.)

>
> It might be though it's lack of my understanding the English language
> (not a native speaker).
>
> > but DT schema mostly not (finite list of property
> > types). To some level DT schema accepts mixes, e.g. phandle-array
> > containing phandle and offsets, but that's because phandle is actually
> > also a number (dtschema/schemas/types.yaml).

At the spec level, properties are just byte strings. They can be
anything including a file (i.e. FIT images). In theory, you could make
properties C structs if you wanted.

However, since there is 0 type or field size information in the DT
itself, we don't mix data types or sizes. That's enforced at the
schema level and by what APIs we have to read properties.

Rob



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


  Powered by Linux