Skip to content

replace device define macros with devicetree-based macro #30467

@pabigot

Description

@pabigot

With the merge of #30196 we need to convert any device object definitions that are based on a devicetree node to use DEVICE_DT_DEFINE instead of:

  • DEVICE_DEFINE 17 driver source files
  • DEVICE_AND_API_INIT 361 driver source files

The vast majority of these are for devices that are associated with a devicetree node. Changing allows use of new API to access the device object directly via DEVICE_DT_GET() rather than a runtime lookup through the label property, and provides access to additional common devicetree information like dependencies.

Examples of the sort of changes required include:

  • 63043bc when instance macros based on iterating over devices are already used;
  • cf33927 when interrupts require local direct access to the device before it is defined.

There will be remaining instances of DEVICE_DEFINE and/or DEVICE_AND_API_INIT for device objects that do not derive from devicetree, such as USB class instance devices like CDC_ACM.

Note

The role of this issue is solely to replace the macros used to define struct device objects when a device corresponds to a devicetree node. It enables, but does not implement, changes in device references in driver from ones that use the label property. As noted in #30536 that can only be done when all drivers in a given subsystem have been converted.

Metadata

Metadata

Labels

bugThe issue is a bug, or the PR is fixing a bugpriority: highHigh impact/importance bug

Type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions