Mixed types of values inside a single property
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?
[1]: https://stackoverflow.com/questions/74517569/reading-tuples-in-a-devicetree
Signature · 2 lines
With Best Regards, Andy Shevchenko
Quoted 8 lines · Andy Shevchenko
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.
Quoted 4 lines
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?
[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?
Best regards,
Krzysztof
Quoted 9 lines · Krzysztof Kozlowski
Quoted 8 lines · Andy Shevchenko
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.
Quoted 7 lines
Quoted 4 lines
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?
[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.
Signature · 2 lines
With Best Regards, Andy Shevchenko
Quoted 13 lines · Andy Shevchenko
Quoted 12 lines · Krzysztof Kozlowski
Quoted 11 lines · Andy Shevchenko
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?
Quoted 7 lines
Quoted 4 lines
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.") 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).
Best regards,
Krzysztof
Quoted 16 lines · Krzysztof Kozlowski
Quoted 15 lines · Andy Shevchenko
Quoted 14 lines · Krzysztof Kozlowski
Quoted 12 lines · Andy Shevchenko
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?
[1]: https://stackoverflow.com/questions/74517569/reading-tuples-in-a-devicetree
Quoted 8 lines
Quoted 5 lines
Quoted 2 lines
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?
It might be though it's lack of my understanding the English language (not a native speaker).
Quoted 4 lines
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).
Signature · 2 lines
With Best Regards, Andy Shevchenko
Quoted 8 lines · Andy Shevchenko
Quoted 6 lines · Krzysztof Kozlowski
Quoted 5 lines · Andy Shevchenko
Quoted 4 lines · Krzysztof Kozlowski
Quoted 3 lines · Andy Shevchenko
Hi, Rob and Krzysztof!
Quoted 7 lines
Quoted 7 lines
Quoted 7 lines
Quoted 7 lines
Quoted 7 lines
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.
Quoted 8 lines
Quoted 8 lines
Quoted 7 lines
Quoted 4 lines
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.
Quoted 7 lines
Quoted 2 lines
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.)
Quoted 8 lines
It might be though it's lack of my understanding the English language (not a native speaker).
Quoted 4 lines
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
Quoted 15 lines · Rob Herring
Quoted 13 lines · Andy Shevchenko
Quoted 11 lines · Krzysztof Kozlowski
Quoted 10 lines · Andy Shevchenko
Quoted 9 lines · Krzysztof Kozlowski
Quoted 8 lines · Andy Shevchenko
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.
Quoted 6 lines
Quoted 2 lines
Quoted 2 lines
Quoted 2 lines
Quoted 2 lines
Quoted 2 lines
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.
Sure. I will try to not forget this next time I will have a question against DT spec (I don't expect this will be anytime soon, though).
Quoted 11 lines
Quoted 11 lines
Quoted 10 lines
Quoted 7 lines
Quoted 4 lines
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.")
Quoted 7 lines
Quoted 4 lines
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.)
Maybe we should add these words explicitly there?
Quoted 8 lines
Quoted 7 lines
It might be though it's lack of my understanding the English language (not a native speaker).
Quoted 4 lines
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).
Quoted 7 lines
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.
Thanks for clarification!
Signature · 2 lines
With Best Regards, Andy Shevchenko