Skip to content

Harmonize DEVICE_* and EMUL_* naming #45976

@alevkoy

Description

@alevkoy

Is your enhancement proposal related to a problem? Please describe.
Currently, struct devices are defined and accessed using macros such as DEVICE_DT_DEFINE, DEVICE_DT_INST_DEFINE, and DEVICE_DT_NAME_GET. Each of these create a structure based on devicetree contents. There is also DEVICE_DEFINE, which creates a struct device outside the context of the devicetree.

struct emuls are defined and accessed using EMUL_DEFINE and EMUL_REG_NAME. These are analogous to DEVICE_DT_DEFINE and DEVICE_DT_NAME_GET, respectively, in that they take node IDs as parameters. EMUL_DEFINE also takes its data_ptr and cfg_ptr parameters in the opposite order from DEVICE_DT_DEFINE.

This inconsistent naming somewhat obscures the purpose of the emulator macros.

Describe the solution you'd like

  • Create aliases EMUL_DT_DEFINE and EMUL_DT_NAME_GET for EMUL_DEFINE and EMUL_REG_NAME.
  • Replace uses of the old macros with usages of the new macros.
  • Mark the old macros @deprecated.
  • Delete the old macros after a suitable transition period.

Describe alternatives you've considered
Continuing to use the old names in future work would work, but it would slightly increase the learning burden for new development compared to making them uniform with the set of names for devices.

Additional context
Some related work in #44883.

@yperess Can you assign this to me?

Metadata

Metadata

Assignees

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions