Commit cfe5bd92 authored by Gerard Marull-Paretas's avatar Gerard Marull-Paretas Committed by Anas Nashif
Browse files

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: default avatarGerard Marull-Paretas <gerard@teslabs.com>
parent 07f3ac95
Loading
Loading
Loading
Loading
+3 −0
Changes for doc/releases/release-notes-4.0.rst: 3 added lines, 0 removed lines.
Original line number Diff line number Diff line
@@ -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
============================

+7 −15
Changes for include/zephyr/device.h: 7 added lines, 15 removed lines.
Original line number Diff line number Diff line
@@ -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))                                      \