drivers: can: Refactor drivers to use shared init priority

Refactors all of the CAN drivers to use a shared driver class
initialization priority configuration, CONFIG_CAN_INIT_PRIORITY, to
allow configuring CAN drivers separately from other devices. This is
similar to other driver classes like I2C and SPI.

The default is set to CONFIG_KERNEL_INIT_PRIORITY_DEVICE to preserve the
existing default initialization priority for most drivers. The exception
is the mcp2515 driver which has a dependency on a SPI driver and must
therefore initialize later than the default device priority.

Signed-off-by: Maureen Helm <maureen.helm@intel.com>
This commit is contained in:
Maureen Helm 2021-10-20 14:36:07 -05:00 committed by Anas Nashif
commit e297f8ee26
9 changed files with 21 additions and 19 deletions

View file

@ -808,7 +808,7 @@ static const struct can_driver_api mcux_flexcan_driver_api = {
DEVICE_DT_INST_DEFINE(id, &mcux_flexcan_init, \
NULL, &mcux_flexcan_data_##id, \
&mcux_flexcan_config_##id, POST_KERNEL, \
CONFIG_KERNEL_INIT_PRIORITY_DEVICE, \
CONFIG_CAN_INIT_PRIORITY, \
&mcux_flexcan_driver_api); \
\
static void mcux_flexcan_irq_config_##id(const struct device *dev) \
@ -849,7 +849,7 @@ DT_INST_FOREACH_STATUS_OKAY(FLEXCAN_DEVICE_INIT_MCUX)
NET_DEVICE_INIT(socket_can_flexcan_##id, SOCKET_CAN_NAME_##id, \
socket_can_init_##id, NULL, \
&socket_can_context_##id, NULL, \
CONFIG_KERNEL_INIT_PRIORITY_DEVICE, &socket_can_api, \
CONFIG_CAN_INIT_PRIORITY, &socket_can_api, \
CANBUS_RAW_L2, NET_L2_GET_CTX_TYPE(CANBUS_RAW_L2), \
CAN_MTU); \