-
Notifications
You must be signed in to change notification settings - Fork 6.8k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
devicetree: clearly define constraints on identifier/property name conflicts #21369
Comments
I've created this as a bug because the existing path seems to prevent binding authors from using certain property names because the tooling generates symbols that conflict with them. Fixing that doesn't seem like an enhancement. |
I think it would be best to step to step remove stuff that isn't used/needed to start with. It's hard to even get an overview now, and that makes it hard to redesign things. @galak @pabigot Once |
The stuff I'm working on now will allow initializers to be generated for entire nodes by the way. That might clean stuff up some more eventually. |
I want this discussed as a policy before trying to make changes. There probably are uses of the I'm aware of new work extending initializer support and concern about the preview I saw on slack is what motivated this issue. |
Do you prefer Another option would be to add a tag to the existence flags, but I didn't feel like going through all of the code to fix it while working on this. I think that might be nicer at least, if we don't want tags for at least some of the cases. |
Gotta have some way to differentiate things if we're gonna generate both "node X exists" and "initializer for node X" identifiers at least. Maybe the second one could double for the first in some nicer-designed universe... |
I proposed that the name end with the devicetree path, to node or property. Anything else risks conflict with other paths. So distinguishing roles for multiple attributes of a node or property has to be done somewhere else, perhaps as a prefix as I suggested. ATM I'm not convinced we need initializers for nodes. What's the use case, how do you deal with order of components, and with changing elements as properties are added? We need to be careful and take into account devicetree use cases we haven't been able to support yet. The interpretation of the base identifier for a node should remain the presence flag, while for a property it should remain the value (expressed as an initializer for multi-element values like arrays). For phandle-arrays where cell names are provided those might reasonably be used as suffixes, as they are already. |
Can't it clash if you have a prefix as well though? The macro stuff is brittle in that way in general.
Haven't run into any issues that were caused by clashes between paths/names and "tag" parts of identifiers, so maybe it's not a super-urgent issue.
It's for #21239. Feels like it might simplify some stuff there at least, and might make new ways of defining things in devicetree possible. The order matches the order in devicetree. It's up to you to make sure it matches whatever struct you're initializing. |
If name/tag clashes start becoming a problem, I'd add a separator like I agree that it's ugly that it can clash. Just wonder how urgent it is. And yeah, nice if it's consistent. |
@carlescufi Related to this I think we need to start taking the devicetree infrastructure under management similar to other API with respect to changes to interface and behavior. Binding descriptions specify what properties are present, which affects devicetree source and drivers. Adding a new property can require modifications to the test Devicetree sources are very likeout to be out-of-tree, so adding And specific to this issue, changes to the way the tooling presents devicetree property values to the application and driver code may require changes to drivers to adopt the new approach so old solutions can be removed, or may inadvertently prevent use of "compatible" devicetree source from non-Zephyr projects because the property names in the outside bindings conflict when processed by Zephyr's tooling. We need to move toward a more managed evolution of the entire Zephyr devicetree infrastructure so that we pick solutions that can meet needs we are only starting to understand, without having to come up with new solutions every time a problem reappears from a new perspective (cf #19285). |
I agree with this. I want to discuss this with @galak as part of the API meeting series. I will add this issue to the project and remind myself to add it for discussion. |
@galak @pabigot @ulfalizer After the meeting yesterday, could we come to a conclusion on this particular item? It is blocking other DT-related progress that is regarded as important: |
@jhedberg can we discuss the priority of this issue for 2.2? This has become a blocker for additional work and I'd like to propose raising this to medium |
Updated to medium now |
Back to low.. hasn't been updated for awhile (discussed in release meeting, @carlescufi approves) |
I would like to propose a rule for the devicetree scripting, to the effect that the generated identifiers should always end with the unmodified property or node name. This rule would excludes the use of suffixes like
_INIT
or_UNQUOTED
for special cases.It also means we need to deprecate the original generation of individual elements of array-valued properties with a suffix ordinal, e.g.
DT_STUFF_ARRAY_0
andDT_STUFF_ARRAY_1
. Now that the tooling generates an initializer list as the value ofDT_STUFF_ARRAY
these sub-property values are no longer necessary. By inspection of samples from the slack channel it seems having propertiesbar
of typearray
andbar-1
of type string would create conflicting symbols.I'm aware this deeply complicates solution to #21273. A solution might be supported by clearly defining a namespace within a prefix, e.g.
DT_ZEPHYR_something_COMPAT_PROPERTY
, or switching to a more powerful way of providing devicetree data to the code that needs it. We have partial solutions like assumingDT_INST_#
will not conflict, but that's not robust.Something to discuss.
The text was updated successfully, but these errors were encountered: