You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
device: Add new macros to instanciate device objects
In order to get rid of the manually inserted initialization priority,
device object generation need new macros.
Until now, 2 set of macros have co-existed because of legacy support.
Indeed, devices used to be created fully manually before devicetree
introduction. Once devicetree appeared, DT based macros were added.
Now is the time to get rid of such difference, and have a unique macro
for creating device objects.
So instead of DEVICE_DEFINE() and DEVICE_DT_DEFINE() there will be
DEVICE_INSTANCE(). Instead of DEVICE_DT_INST_DEFINE() there will be
DEVICE_INSTANCE_FROM_DT_INST(). Instead of DEVICE_GET() and
DEVICE_DT_GET(), there will be DEVICE_INSTANCE_GET().
Same for DEVICE_INIT_DT_GET() and DEVICE_INIT_GET(), there will be
DEVICE_INIT_ENTRY_GET()
In the future step of deprecating old macros, these are then identified:
- DEVICE_DEFINE
- DEVICE_DT_DEFINE
- DEVICE_GET
- DEVICE_DT_GET
- DEVICE_INIT_DT_GET
- DEVICE_INIT_GET
- DEVICE_NAME_GET() could be replaced by DEVICE_INSTANCE_NAME())
- DEVICE_DT_NAME_GET() could be replaced by DEVICE_INSTANCE_NAME())
- DEVICE_DECLARE() could be replaced as well
And probably some more, thus reducing the amount of macros which would
help to clean-up the header and have a more concise set.
The difference is now that priority parameter is removed, as well as the
name parameter (originaly from DEVICE_DEFINE legacy macro). In this case
it is just simpler to reuse the "unique token" dev_id.
Because of the dependency being fully computed _prior_ to building
zephyr, these new macros do not support CONFIG_DEVICE_DEPS anymore. This
feature was never really used anywhere and is a legacy thing. So new
macros do not accept variable arguments.
Signed-off-by: Tomasz Bursztyka <[email protected]>
0 commit comments