diff --git a/doc/releases/release-notes-4.0.rst b/doc/releases/release-notes-4.0.rst index 9e03b3d594ae48..25ba180d581bb3 100644 --- a/doc/releases/release-notes-4.0.rst +++ b/doc/releases/release-notes-4.0.rst @@ -32,6 +32,9 @@ API Changes * Removed deprecated ``ceiling_fraction`` macro. :c:macro:`DIV_ROUND_UP` needs to be used now. +* Deprecated ``EARLY``, ``APPLICATION`` and ``SMP`` init levels can no longer be + used for devices. + Removed APIs in this release ============================ diff --git a/include/zephyr/device.h b/include/zephyr/device.h index cc72cb177f3564..52b8604db8095e 100644 --- a/include/zephyr/device.h +++ b/include/zephyr/device.h @@ -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_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 */ -#define Z_DEVICE_LEVEL_CHECK_DEPRECATED_LEVEL(level) \ - Z_DEVICE_LEVEL_DEPRECATED_##level +#define Z_DEVICE_CHECK_INIT_LEVEL(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. @@ -1105,7 +1097,7 @@ device_get_dt_nodelabels(const struct device *dev) * @param prio Initialization priority. */ #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( \ level, prio, Z_DEVICE_INIT_SUB_PRIO(node_id)) \