-
Notifications
You must be signed in to change notification settings - Fork 8.2k
DTS API close out for 2.3 #25009
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
DTS API close out for 2.3 #25009
Conversation
|
All checks are passing now. checkpatch (informational only, not a failure)Tip: The bot edits this comment instead of posting a new one, so you can check the comment's history to see earlier messages. |
6d960d4 to
9a4dc52
Compare
galak
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Need decide if we want to phase out compat2enabled or tweak its semantics. I think changing the semantics is ok since the only status values we've really dealt with are (no status, status = "okay", status = "ok", and status = "disabled". I'm also good if we want to deprecate this and introduce something new.
We agreed in dev-review that whatever we do, we can't break gen_legacy_defines.py. It uses compat2enabled, so we can't change its semantics without also making changes to gen_legacy_defines.py, which seems a bit reckless this late in the release cycle. I'm adding new functionality specifically to be able to leave the legacy scripts alone. |
We should probably add a comment in compat2enabled and node.enabled about these only existing for gen_legacy_defines.py. Do we want to call this compat2avail to match the linux API? |
86df21d to
257d1d3
Compare
pabigot
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Haven't looked closely at the documentation yet but figure that can be tuned if necessary.
Yep, I promise to go over the documentation with a fine tooth comb before the release and correct any errors I find during the stabilization/documentation period. Thanks. |
doc/guides/dts/howtos.rst
Outdated
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
remove "is"
doc/guides/dts/howtos.rst
Outdated
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
remove second either in the line
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
No, this is correct. There are two optional subordinate clauses, one of which requires its own either.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Or rather, it's correct with two eithers, just the first, just the second, or neither. IMO. English is pretty flexible.
ioannisg
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks ok to me
Pls, address some minor doc-related comments.
Move to FOREACH to prepare for an upcoming patch. Signed-off-by: Kumar Gala <[email protected]>
Even though it is about to be done for sound technical reasons, a subsequent patch adding access to all device nodes at the last minute in the 2.3 release is going to be playing a bit of a fast one on the Zephyr community, especially users of DT_INST APIs. In particular, instance numbers are currently allocated only to enabled nodes, but that will not be true soon: *every* node of a compatible will be allocated an instance number, even disabled ones. This is especially unfortunate for drivers and applications that expect singletons of their compatibles, and use DT_INST(0, ...) to mean "the one enabled instance of my compatible". To avoid gratuitous breakage, let's prepare for that by sorting each edt.compat2nodes sub-list so that enabled instances always come before disabled ones. This doesn't break any API guarantees, because there basically *are* no ordering guarantees, in part precisely to give us the flexibility to do things like this. And it does help patterns that use instances 0 through N-1, including the important singleton case. Signed-off-by: Martí Bolívar <[email protected]>
Usually, we want to operate only on "available" device
nodes ("available" means "status is okay and a matching binding is
found"), but that's not true in all cases.
Sometimes we want to operate on special nodes without matching
bindings, such as those describing memory.
To handle the distinction, change various additional devicetree APIs
making it clear that they operate only on available device nodes,
adjusting gen_defines and devicetree.h implementation details
accordingly:
- emit macros for all existing nodes in gen_defines.py, regardless
of status or matching binding
- rename DT_NUM_INST to DT_NUM_INST_STATUS_OKAY
- rename DT_NODE_HAS_COMPAT to DT_NODE_HAS_COMPAT_STATUS_OKAY
- rename DT_INST_FOREACH to DT_INST_FOREACH_STATUS_OKAY
- rename DT_ANY_INST_ON_BUS to DT_ANY_INST_ON_BUS_STATUS_OKAY
- rewrite DT_HAS_NODE_STATUS_OKAY in terms of a new DT_NODE_HAS_STATUS
- resurrect DT_HAS_NODE in the form of DT_NODE_EXISTS
- remove DT_COMPAT_ON_BUS as a public API
- use the new default_prop_types edtlib parameter
Signed-off-by: Martí Bolívar <[email protected]>
These are redundantly checking a node's status twice. Signed-off-by: Martí Bolívar <[email protected]> Signed-off-by: Kumar Gala <[email protected]>
Add some tests for DT_NODE_HAS_STATUS Signed-off-by: Kumar Gala <[email protected]>
Add more HOWTO information for the two current devicetree-based device instantiation styles, and a bit more information on how to create devices that depend on others. Point to this from the Kconfig tips page, since it is meant as a replacement for existing Kconfig practice. Update macros.bnf. Signed-off-by: Martí Bolívar <[email protected]>
Swap this out and make the status a parameter. Leave a couple of cases of DT_NODE_HAS_COMPAT(). Signed-off-by: Kumar Gala <[email protected]> Signed-off-by: Martí Bolívar <[email protected]>
DTS changes for 2.3.
This PR is attempting to close out the remaining issues discussed in the last dev-review, namely being able to access data for all nodes regardless of their status.
This has knock-on effects in the API which cause various renames.
We're going to defer a few more of them until after code freeze to avoid breaking CI any more.