* Mixed types of values inside a single property @ 2022-11-21 12:59 Andy Shevchenko 2022-11-21 13:52 ` Krzysztof Kozlowski 0 siblings, 1 reply; 7+ messages in thread From: Andy Shevchenko @ 2022-11-21 12:59 UTC (permalink / raw) To: devicetree; +Cc: Rob Herring, Krzysztof Kozlowski 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 -- With Best Regards, Andy Shevchenko ^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: Mixed types of values inside a single property 2022-11-21 12:59 Mixed types of values inside a single property Andy Shevchenko @ 2022-11-21 13:52 ` Krzysztof Kozlowski 2022-11-21 14:11 ` Andy Shevchenko 0 siblings, 1 reply; 7+ messages in thread From: Krzysztof Kozlowski @ 2022-11-21 13:52 UTC (permalink / raw) To: Andy Shevchenko, devicetree; +Cc: Rob Herring, Krzysztof Kozlowski 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? > > [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 ^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: Mixed types of values inside a single property 2022-11-21 13:52 ` Krzysztof Kozlowski @ 2022-11-21 14:11 ` Andy Shevchenko 2022-11-21 14:23 ` Krzysztof Kozlowski 0 siblings, 1 reply; 7+ messages in thread From: Andy Shevchenko @ 2022-11-21 14:11 UTC (permalink / raw) To: Krzysztof Kozlowski; +Cc: devicetree, Rob Herring, Krzysztof Kozlowski 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? > > > > [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. -- With Best Regards, Andy Shevchenko ^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: Mixed types of values inside a single property 2022-11-21 14:11 ` Andy Shevchenko @ 2022-11-21 14:23 ` Krzysztof Kozlowski 2022-11-21 15:31 ` Andy Shevchenko 0 siblings, 1 reply; 7+ messages in thread From: Krzysztof Kozlowski @ 2022-11-21 14:23 UTC (permalink / raw) To: Andy Shevchenko; +Cc: devicetree, Rob Herring, Krzysztof Kozlowski 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? >>> >>> [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.") 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 ^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: Mixed types of values inside a single property 2022-11-21 14:23 ` Krzysztof Kozlowski @ 2022-11-21 15:31 ` Andy Shevchenko 2022-12-06 15:31 ` Rob Herring 0 siblings, 1 reply; 7+ messages in thread From: Andy Shevchenko @ 2022-11-21 15:31 UTC (permalink / raw) To: Krzysztof Kozlowski; +Cc: devicetree, Rob Herring, Krzysztof Kozlowski 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? > >>> > >>> [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? 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). -- With Best Regards, Andy Shevchenko ^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: Mixed types of values inside a single property 2022-11-21 15:31 ` Andy Shevchenko @ 2022-12-06 15:31 ` Rob Herring 2022-12-06 22:25 ` Andy Shevchenko 0 siblings, 1 reply; 7+ messages in thread From: Rob Herring @ 2022-12-06 15:31 UTC (permalink / raw) To: Andy Shevchenko; +Cc: Krzysztof Kozlowski, devicetree, Krzysztof Kozlowski On Mon, Nov 21, 2022 at 9:31 AM Andy Shevchenko <andriy.shevchenko@intel.com> 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 ^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: Mixed types of values inside a single property 2022-12-06 15:31 ` Rob Herring @ 2022-12-06 22:25 ` Andy Shevchenko 0 siblings, 0 replies; 7+ messages in thread From: Andy Shevchenko @ 2022-12-06 22:25 UTC (permalink / raw) To: Rob Herring; +Cc: Krzysztof Kozlowski, devicetree, Krzysztof Kozlowski On Tue, Dec 06, 2022 at 09:31:49AM -0600, Rob Herring wrote: > On Mon, Nov 21, 2022 at 9:31 AM Andy Shevchenko > <andriy.shevchenko@intel.com> 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. 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). > > > >>> [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.) Maybe we should add these words explicitly there? > > 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. Thanks for clarification! -- With Best Regards, Andy Shevchenko ^ permalink raw reply [flat|nested] 7+ messages in thread
end of thread, other threads:[~2022-12-06 22:25 UTC | newest] Thread overview: 7+ messages (download: mbox.gz follow: Atom feed -- links below jump to the message on this page -- 2022-11-21 12:59 Mixed types of values inside a single property Andy Shevchenko 2022-11-21 13:52 ` Krzysztof Kozlowski 2022-11-21 14:11 ` Andy Shevchenko 2022-11-21 14:23 ` Krzysztof Kozlowski 2022-11-21 15:31 ` Andy Shevchenko 2022-12-06 15:31 ` Rob Herring 2022-12-06 22:25 ` Andy Shevchenko
This is a public inbox, see mirroring instructions for how to clone and mirror all data and code used for this inbox; as well as URLs for NNTP newsgroup(s).