Skip to content

devicetree: clearly define constraints on identifier/property name conflicts #21369

@pabigot

Description

@pabigot

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 and DT_STUFF_ARRAY_1. Now that the tooling generates an initializer list as the value of DT_STUFF_ARRAY these sub-property values are no longer necessary. By inspection of samples from the slack channel it seems having properties bar of type array and bar-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 assuming DT_INST_# will not conflict, but that's not robust.

Something to discuss.

Metadata

Metadata

Labels

area: DevicetreebugThe issue is a bug, or the PR is fixing a bugpriority: lowLow impact/importance bug

Type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions