device: remove support for deprecated init levels

EARLY, APPLICATION and SMP levels are no longer support for device
drivers as 2 releases have happened since its deprecation. Add a
validation macro so that compilation fails if the given level is not
valid.

Signed-off-by: Gerard Marull-Paretas <gerard@teslabs.com>
This commit is contained in:
Gerard Marull-Paretas 2024-08-12 12:34:06 +02:00 committed by Anas Nashif
commit cfe5bd9224
2 changed files with 10 additions and 15 deletions

View file

@ -32,6 +32,9 @@ API Changes
* Removed deprecated ``ceiling_fraction`` macro. :c:macro:`DIV_ROUND_UP` needs * Removed deprecated ``ceiling_fraction`` macro. :c:macro:`DIV_ROUND_UP` needs
to be used now. to be used now.
* Deprecated ``EARLY``, ``APPLICATION`` and ``SMP`` init levels can no longer be
used for devices.
Removed APIs in this release Removed APIs in this release
============================ ============================

View file

@ -1075,24 +1075,16 @@ device_get_dt_nodelabels(const struct device *dev)
Z_DEVICE_SECTION_NAME(level, prio), DEVICE_NAME_GET(dev_id)) = \ Z_DEVICE_SECTION_NAME(level, prio), DEVICE_NAME_GET(dev_id)) = \
Z_DEVICE_INIT(name, pm, data, config, api, state, deps, node_id, dev_id) Z_DEVICE_INIT(name, pm, data, config, api, state, deps, node_id, dev_id)
/* deprecated device initialization levels */
#define Z_DEVICE_LEVEL_DEPRECATED_EARLY \
__WARN("EARLY device driver level is deprecated")
#define Z_DEVICE_LEVEL_DEPRECATED_PRE_KERNEL_1
#define Z_DEVICE_LEVEL_DEPRECATED_PRE_KERNEL_2
#define Z_DEVICE_LEVEL_DEPRECATED_POST_KERNEL
#define Z_DEVICE_LEVEL_DEPRECATED_APPLICATION \
__WARN("APPLICATION device driver level is deprecated")
#define Z_DEVICE_LEVEL_DEPRECATED_SMP \
__WARN("SMP device driver level is deprecated")
/** /**
* @brief Issue a warning if the given init level is deprecated. * @brief Issue an error if the given init level is not supported.
* *
* @param level Init level * @param level Init level
*/ */
#define Z_DEVICE_LEVEL_CHECK_DEPRECATED_LEVEL(level) \ #define Z_DEVICE_CHECK_INIT_LEVEL(level) \
Z_DEVICE_LEVEL_DEPRECATED_##level COND_CODE_1(Z_INIT_PRE_KERNEL_1_##level, (), \
(COND_CODE_1(Z_INIT_PRE_KERNEL_2_##level, (), \
(COND_CODE_1(Z_INIT_POST_KERNEL_##level, (), \
(ZERO_OR_COMPILE_ERROR(0)))))))
/** /**
* @brief Define the init entry for a device. * @brief Define the init entry for a device.
@ -1105,7 +1097,7 @@ device_get_dt_nodelabels(const struct device *dev)
* @param prio Initialization priority. * @param prio Initialization priority.
*/ */
#define Z_DEVICE_INIT_ENTRY_DEFINE(node_id, dev_id, init_fn_, level, prio) \ #define Z_DEVICE_INIT_ENTRY_DEFINE(node_id, dev_id, init_fn_, level, prio) \
Z_DEVICE_LEVEL_CHECK_DEPRECATED_LEVEL(level) \ Z_DEVICE_CHECK_INIT_LEVEL(level) \
\ \
static const Z_DECL_ALIGN(struct init_entry) __used __noasan Z_INIT_ENTRY_SECTION( \ static const Z_DECL_ALIGN(struct init_entry) __used __noasan Z_INIT_ENTRY_SECTION( \
level, prio, Z_DEVICE_INIT_SUB_PRIO(node_id)) \ level, prio, Z_DEVICE_INIT_SUB_PRIO(node_id)) \