device: Const-ify all device driver instance pointers
Now that device_api attribute is unmodified at runtime, as well as all the other attributes, it is possible to switch all device driver instance to be constant. A coccinelle rule is used for this: @r_const_dev_1 disable optional_qualifier @ @@ -struct device * +const struct device * @r_const_dev_2 disable optional_qualifier @ @@ -struct device * const +const struct device * Fixes #27399 Signed-off-by: Tomasz Bursztyka <tomasz.bursztyka@linux.intel.com>
This commit is contained in:
parent
c8906fef79
commit
e18fcbba5a
1426 changed files with 9356 additions and 8368 deletions
|
@ -39,7 +39,7 @@ static void can_msgq_put(struct zcan_frame *frame, void *arg)
|
|||
}
|
||||
}
|
||||
|
||||
int z_impl_can_attach_msgq(struct device *dev, struct k_msgq *msg_q,
|
||||
int z_impl_can_attach_msgq(const struct device *dev, struct k_msgq *msg_q,
|
||||
const struct zcan_filter *filter)
|
||||
{
|
||||
const struct can_driver_api *api = dev->api;
|
||||
|
@ -128,7 +128,7 @@ static void can_work_isr_put(struct zcan_frame *frame, void *arg)
|
|||
k_work_submit_to_queue(work->work_queue, &work->work_item);
|
||||
}
|
||||
|
||||
int can_attach_workq(struct device *dev, struct k_work_q *work_q,
|
||||
int can_attach_workq(const struct device *dev, struct k_work_q *work_q,
|
||||
struct zcan_work *work,
|
||||
can_rx_callback_t callback, void *callback_arg,
|
||||
const struct zcan_filter *filter)
|
||||
|
|
|
@ -7,18 +7,20 @@
|
|||
#include <syscall_handler.h>
|
||||
#include <drivers/can.h>
|
||||
|
||||
static inline int z_vrfy_can_configure(struct device *dev, enum can_mode mode,
|
||||
static inline int z_vrfy_can_configure(const struct device *dev,
|
||||
enum can_mode mode,
|
||||
uint32_t bitrate)
|
||||
{
|
||||
|
||||
Z_OOPS(Z_SYSCALL_DRIVER_CAN(dev, configure));
|
||||
|
||||
return z_impl_can_configure((struct device *)dev, (enum can_mode)mode,
|
||||
(uint32_t)bitrate);
|
||||
return z_impl_can_configure((const struct device *)dev,
|
||||
(enum can_mode)mode,
|
||||
(uint32_t)bitrate);
|
||||
}
|
||||
#include <syscalls/can_configure_mrsh.c>
|
||||
|
||||
static inline int z_vrfy_can_send(struct device *dev,
|
||||
static inline int z_vrfy_can_send(const struct device *dev,
|
||||
const struct zcan_frame *msg,
|
||||
k_timeout_t timeout,
|
||||
can_tx_callback_t callback_isr,
|
||||
|
@ -35,15 +37,15 @@ static inline int z_vrfy_can_send(struct device *dev,
|
|||
|
||||
Z_OOPS(Z_SYSCALL_MEMORY_READ((void *)callback_arg, sizeof(void *)));
|
||||
|
||||
return z_impl_can_send((struct device *)dev,
|
||||
(const struct zcan_frame *)msg,
|
||||
(k_timeout_t)timeout,
|
||||
(can_tx_callback_t) callback_isr,
|
||||
(void *)callback_arg);
|
||||
return z_impl_can_send((const struct device *)dev,
|
||||
(const struct zcan_frame *)msg,
|
||||
(k_timeout_t)timeout,
|
||||
(can_tx_callback_t) callback_isr,
|
||||
(void *)callback_arg);
|
||||
}
|
||||
#include <syscalls/can_send_mrsh.c>
|
||||
|
||||
static inline int z_vrfy_can_attach_msgq(struct device *dev,
|
||||
static inline int z_vrfy_can_attach_msgq(const struct device *dev,
|
||||
struct k_msgq *msgq,
|
||||
const struct zcan_filter *filter)
|
||||
{
|
||||
|
@ -53,23 +55,23 @@ static inline int z_vrfy_can_attach_msgq(struct device *dev,
|
|||
sizeof(struct zcan_filter)));
|
||||
Z_OOPS(Z_SYSCALL_OBJ(msgq, K_OBJ_MSGQ));
|
||||
|
||||
return z_impl_can_attach_msgq((struct device *)dev,
|
||||
(struct k_msgq *)msgq,
|
||||
(const struct zcan_filter *) filter);
|
||||
return z_impl_can_attach_msgq((const struct device *)dev,
|
||||
(struct k_msgq *)msgq,
|
||||
(const struct zcan_filter *) filter);
|
||||
}
|
||||
#include <syscalls/can_attach_msgq_mrsh.c>
|
||||
|
||||
static inline void z_vrfy_can_detach(struct device *dev, int filter_id)
|
||||
static inline void z_vrfy_can_detach(const struct device *dev, int filter_id)
|
||||
{
|
||||
|
||||
Z_OOPS(Z_SYSCALL_DRIVER_CAN(dev, detach));
|
||||
|
||||
z_impl_can_detach((struct device *)dev, (int)filter_id);
|
||||
z_impl_can_detach((const struct device *)dev, (int)filter_id);
|
||||
}
|
||||
#include <syscalls/can_detach_mrsh.c>
|
||||
|
||||
static inline
|
||||
enum can_state z_vrfy_can_get_state(struct device *dev,
|
||||
enum can_state z_vrfy_can_get_state(const struct device *dev,
|
||||
struct can_bus_err_cnt *err_cnt)
|
||||
{
|
||||
|
||||
|
@ -85,7 +87,8 @@ enum can_state z_vrfy_can_get_state(struct device *dev,
|
|||
|
||||
|
||||
#ifndef CONFIG_CAN_AUTO_BUS_OFF_RECOVERY
|
||||
static inline int z_vrfy_can_recover(struct device *dev, k_timeout_t timeout)
|
||||
static inline int z_vrfy_can_recover(const struct device *dev,
|
||||
k_timeout_t timeout)
|
||||
{
|
||||
|
||||
Z_OOPS(Z_SYSCALL_OBJ(dev, K_OBJ_DRIVER_CAN));
|
||||
|
|
|
@ -88,7 +88,8 @@ void tx_thread(void *data_arg, void *arg2, void *arg3)
|
|||
}
|
||||
}
|
||||
|
||||
int can_loopback_send(struct device *dev, const struct zcan_frame *frame,
|
||||
int can_loopback_send(const struct device *dev,
|
||||
const struct zcan_frame *frame,
|
||||
k_timeout_t timeout, can_tx_callback_t callback,
|
||||
void *callback_arg)
|
||||
{
|
||||
|
@ -144,7 +145,7 @@ static inline int get_free_filter(struct can_loopback_filter *filters)
|
|||
return CAN_NO_FREE_FILTER;
|
||||
}
|
||||
|
||||
int can_loopback_attach_isr(struct device *dev, can_rx_callback_t isr,
|
||||
int can_loopback_attach_isr(const struct device *dev, can_rx_callback_t isr,
|
||||
void *cb_arg,
|
||||
const struct zcan_filter *filter)
|
||||
{
|
||||
|
@ -182,7 +183,7 @@ int can_loopback_attach_isr(struct device *dev, can_rx_callback_t isr,
|
|||
return filter_id;
|
||||
}
|
||||
|
||||
void can_loopback_detach(struct device *dev, int filter_id)
|
||||
void can_loopback_detach(const struct device *dev, int filter_id)
|
||||
{
|
||||
struct can_loopback_data *data = DEV_DATA(dev);
|
||||
|
||||
|
@ -192,7 +193,7 @@ void can_loopback_detach(struct device *dev, int filter_id)
|
|||
k_mutex_unlock(&data->mtx);
|
||||
}
|
||||
|
||||
int can_loopback_configure(struct device *dev, enum can_mode mode,
|
||||
int can_loopback_configure(const struct device *dev, enum can_mode mode,
|
||||
uint32_t bitrate)
|
||||
{
|
||||
struct can_loopback_data *data = DEV_DATA(dev);
|
||||
|
@ -203,7 +204,7 @@ int can_loopback_configure(struct device *dev, enum can_mode mode,
|
|||
return 0;
|
||||
}
|
||||
|
||||
static enum can_state can_loopback_get_state(struct device *dev,
|
||||
static enum can_state can_loopback_get_state(const struct device *dev,
|
||||
struct can_bus_err_cnt *err_cnt)
|
||||
{
|
||||
ARG_UNUSED(dev);
|
||||
|
@ -217,7 +218,7 @@ static enum can_state can_loopback_get_state(struct device *dev,
|
|||
}
|
||||
|
||||
#ifndef CONFIG_CAN_AUTO_BUS_OFF_RECOVERY
|
||||
int can_loopback_recover(struct device *dev, k_timeout_t timeout)
|
||||
int can_loopback_recover(const struct device *dev, k_timeout_t timeout)
|
||||
{
|
||||
ARG_UNUSED(dev);
|
||||
ARG_UNUSED(timeout);
|
||||
|
@ -226,7 +227,7 @@ int can_loopback_recover(struct device *dev, k_timeout_t timeout)
|
|||
}
|
||||
#endif /* CONFIG_CAN_AUTO_BUS_OFF_RECOVERY */
|
||||
|
||||
static void can_loopback_register_state_change_isr(struct device *dev,
|
||||
static void can_loopback_register_state_change_isr(const struct device *dev,
|
||||
can_state_change_isr_t isr)
|
||||
{
|
||||
ARG_UNUSED(dev);
|
||||
|
@ -246,7 +247,7 @@ static const struct can_driver_api can_api_funcs = {
|
|||
};
|
||||
|
||||
|
||||
static int can_loopback_init(struct device *dev)
|
||||
static int can_loopback_init(const struct device *dev)
|
||||
{
|
||||
struct can_loopback_data *data = DEV_DATA(dev);
|
||||
k_tid_t tx_tid;
|
||||
|
@ -285,9 +286,9 @@ DEVICE_AND_API_INIT(can_loopback_1, CONFIG_CAN_LOOPBACK_DEV_NAME,
|
|||
|
||||
#include "socket_can_generic.h"
|
||||
|
||||
static int socket_can_init_1(struct device *dev)
|
||||
static int socket_can_init_1(const struct device *dev)
|
||||
{
|
||||
struct device *can_dev = DEVICE_GET(can_loopback_1);
|
||||
const struct device *can_dev = DEVICE_GET(can_loopback_1);
|
||||
struct socket_can_context *socket_context = dev->data;
|
||||
|
||||
LOG_DBG("Init socket CAN device %p (%s) for dev %p (%s)",
|
||||
|
|
|
@ -17,7 +17,7 @@ LOG_MODULE_REGISTER(mcp2515_can);
|
|||
|
||||
#include "can_mcp2515.h"
|
||||
|
||||
static int mcp2515_cmd_soft_reset(struct device *dev)
|
||||
static int mcp2515_cmd_soft_reset(const struct device *dev)
|
||||
{
|
||||
uint8_t cmd_buf[] = { MCP2515_OPCODE_RESET };
|
||||
|
||||
|
@ -31,7 +31,8 @@ static int mcp2515_cmd_soft_reset(struct device *dev)
|
|||
return spi_write(DEV_DATA(dev)->spi, &DEV_DATA(dev)->spi_cfg, &tx);
|
||||
}
|
||||
|
||||
static int mcp2515_cmd_bit_modify(struct device *dev, uint8_t reg_addr, uint8_t mask,
|
||||
static int mcp2515_cmd_bit_modify(const struct device *dev, uint8_t reg_addr,
|
||||
uint8_t mask,
|
||||
uint8_t data)
|
||||
{
|
||||
uint8_t cmd_buf[] = { MCP2515_OPCODE_BIT_MODIFY, reg_addr, mask, data };
|
||||
|
@ -46,7 +47,7 @@ static int mcp2515_cmd_bit_modify(struct device *dev, uint8_t reg_addr, uint8_t
|
|||
return spi_write(DEV_DATA(dev)->spi, &DEV_DATA(dev)->spi_cfg, &tx);
|
||||
}
|
||||
|
||||
static int mcp2515_cmd_write_reg(struct device *dev, uint8_t reg_addr,
|
||||
static int mcp2515_cmd_write_reg(const struct device *dev, uint8_t reg_addr,
|
||||
uint8_t *buf_data, uint8_t buf_len)
|
||||
{
|
||||
uint8_t cmd_buf[] = { MCP2515_OPCODE_WRITE, reg_addr };
|
||||
|
@ -76,8 +77,8 @@ static int mcp2515_cmd_write_reg(struct device *dev, uint8_t reg_addr,
|
|||
* 4: TX Buffer 2, Start at TXB2SIDH (0x51)
|
||||
* 5: TX Buffer 2, Start at TXB2D0 (0x56)
|
||||
*/
|
||||
static int mcp2515_cmd_load_tx_buffer(struct device *dev, uint8_t abc,
|
||||
uint8_t *buf_data, uint8_t buf_len)
|
||||
static int mcp2515_cmd_load_tx_buffer(const struct device *dev, uint8_t abc,
|
||||
uint8_t *buf_data, uint8_t buf_len)
|
||||
{
|
||||
__ASSERT(abc <= 5, "abc <= 5");
|
||||
|
||||
|
@ -101,7 +102,7 @@ static int mcp2515_cmd_load_tx_buffer(struct device *dev, uint8_t abc,
|
|||
* opcode that respectively initiate transmission for buffers TXB0, TXB1 and
|
||||
* TXB2.
|
||||
*/
|
||||
static int mcp2515_cmd_rts(struct device *dev, uint8_t nnn)
|
||||
static int mcp2515_cmd_rts(const struct device *dev, uint8_t nnn)
|
||||
{
|
||||
__ASSERT(nnn < BIT(MCP2515_TX_CNT), "nnn < BIT(MCP2515_TX_CNT)");
|
||||
|
||||
|
@ -117,7 +118,7 @@ static int mcp2515_cmd_rts(struct device *dev, uint8_t nnn)
|
|||
return spi_write(DEV_DATA(dev)->spi, &DEV_DATA(dev)->spi_cfg, &tx);
|
||||
}
|
||||
|
||||
static int mcp2515_cmd_read_reg(struct device *dev, uint8_t reg_addr,
|
||||
static int mcp2515_cmd_read_reg(const struct device *dev, uint8_t reg_addr,
|
||||
uint8_t *buf_data, uint8_t buf_len)
|
||||
{
|
||||
uint8_t cmd_buf[] = { MCP2515_OPCODE_READ, reg_addr };
|
||||
|
@ -152,8 +153,8 @@ static int mcp2515_cmd_read_reg(struct device *dev, uint8_t reg_addr,
|
|||
* 2: Receive Buffer 1, Start at RXB1SIDH (0x71)
|
||||
* 3: Receive Buffer 1, Start at RXB1D0 (0x76)
|
||||
*/
|
||||
static int mcp2515_cmd_read_rx_buffer(struct device *dev, uint8_t nm,
|
||||
uint8_t *buf_data, uint8_t buf_len)
|
||||
static int mcp2515_cmd_read_rx_buffer(const struct device *dev, uint8_t nm,
|
||||
uint8_t *buf_data, uint8_t buf_len)
|
||||
{
|
||||
__ASSERT(nm <= 0x03, "nm <= 0x03");
|
||||
|
||||
|
@ -253,7 +254,7 @@ static void mcp2515_convert_mcp2515frame_to_zcanframe(const uint8_t *source,
|
|||
}
|
||||
}
|
||||
|
||||
const int mcp2515_set_mode(struct device *dev, uint8_t mcp2515_mode)
|
||||
const int mcp2515_set_mode(const struct device *dev, uint8_t mcp2515_mode)
|
||||
{
|
||||
uint8_t canstat;
|
||||
|
||||
|
@ -271,7 +272,7 @@ const int mcp2515_set_mode(struct device *dev, uint8_t mcp2515_mode)
|
|||
return 0;
|
||||
}
|
||||
|
||||
static int mcp2515_get_mode(struct device *dev, uint8_t *mode)
|
||||
static int mcp2515_get_mode(const struct device *dev, uint8_t *mode)
|
||||
{
|
||||
uint8_t canstat;
|
||||
|
||||
|
@ -289,7 +290,7 @@ static int mcp2515_get_mode(struct device *dev, uint8_t *mode)
|
|||
return 0;
|
||||
}
|
||||
|
||||
static int mcp2515_configure(struct device *dev, enum can_mode mode,
|
||||
static int mcp2515_configure(const struct device *dev, enum can_mode mode,
|
||||
uint32_t bitrate)
|
||||
{
|
||||
const struct mcp2515_config *dev_cfg = DEV_CFG(dev);
|
||||
|
@ -422,9 +423,10 @@ done:
|
|||
return ret;
|
||||
}
|
||||
|
||||
static int mcp2515_send(struct device *dev, const struct zcan_frame *msg,
|
||||
k_timeout_t timeout, can_tx_callback_t callback,
|
||||
void *callback_arg)
|
||||
static int mcp2515_send(const struct device *dev,
|
||||
const struct zcan_frame *msg,
|
||||
k_timeout_t timeout, can_tx_callback_t callback,
|
||||
void *callback_arg)
|
||||
{
|
||||
struct mcp2515_data *dev_data = DEV_DATA(dev);
|
||||
uint8_t tx_idx = 0U;
|
||||
|
@ -484,7 +486,8 @@ static int mcp2515_send(struct device *dev, const struct zcan_frame *msg,
|
|||
return 0;
|
||||
}
|
||||
|
||||
static int mcp2515_attach_isr(struct device *dev, can_rx_callback_t rx_cb,
|
||||
static int mcp2515_attach_isr(const struct device *dev,
|
||||
can_rx_callback_t rx_cb,
|
||||
void *cb_arg,
|
||||
const struct zcan_filter *filter)
|
||||
{
|
||||
|
@ -518,7 +521,7 @@ static int mcp2515_attach_isr(struct device *dev, can_rx_callback_t rx_cb,
|
|||
return filter_idx;
|
||||
}
|
||||
|
||||
static void mcp2515_detach(struct device *dev, int filter_nr)
|
||||
static void mcp2515_detach(const struct device *dev, int filter_nr)
|
||||
{
|
||||
struct mcp2515_data *dev_data = DEV_DATA(dev);
|
||||
|
||||
|
@ -527,7 +530,7 @@ static void mcp2515_detach(struct device *dev, int filter_nr)
|
|||
k_mutex_unlock(&dev_data->mutex);
|
||||
}
|
||||
|
||||
static void mcp2515_register_state_change_isr(struct device *dev,
|
||||
static void mcp2515_register_state_change_isr(const struct device *dev,
|
||||
can_state_change_isr_t isr)
|
||||
{
|
||||
struct mcp2515_data *dev_data = DEV_DATA(dev);
|
||||
|
@ -559,7 +562,8 @@ static uint8_t mcp2515_filter_match(struct zcan_frame *msg,
|
|||
return 1;
|
||||
}
|
||||
|
||||
static void mcp2515_rx_filter(struct device *dev, struct zcan_frame *msg)
|
||||
static void mcp2515_rx_filter(const struct device *dev,
|
||||
struct zcan_frame *msg)
|
||||
{
|
||||
struct mcp2515_data *dev_data = DEV_DATA(dev);
|
||||
uint8_t filter_idx = 0U;
|
||||
|
@ -588,7 +592,7 @@ static void mcp2515_rx_filter(struct device *dev, struct zcan_frame *msg)
|
|||
k_mutex_unlock(&dev_data->mutex);
|
||||
}
|
||||
|
||||
static void mcp2515_rx(struct device *dev, uint8_t rx_idx)
|
||||
static void mcp2515_rx(const struct device *dev, uint8_t rx_idx)
|
||||
{
|
||||
__ASSERT(rx_idx < MCP2515_RX_CNT, "rx_idx < MCP2515_RX_CNT");
|
||||
|
||||
|
@ -605,7 +609,7 @@ static void mcp2515_rx(struct device *dev, uint8_t rx_idx)
|
|||
mcp2515_rx_filter(dev, &msg);
|
||||
}
|
||||
|
||||
static void mcp2515_tx_done(struct device *dev, uint8_t tx_idx)
|
||||
static void mcp2515_tx_done(const struct device *dev, uint8_t tx_idx)
|
||||
{
|
||||
struct mcp2515_data *dev_data = DEV_DATA(dev);
|
||||
|
||||
|
@ -621,7 +625,7 @@ static void mcp2515_tx_done(struct device *dev, uint8_t tx_idx)
|
|||
k_sem_give(&dev_data->tx_sem);
|
||||
}
|
||||
|
||||
static enum can_state mcp2515_get_state(struct device *dev,
|
||||
static enum can_state mcp2515_get_state(const struct device *dev,
|
||||
struct can_bus_err_cnt *err_cnt)
|
||||
{
|
||||
uint8_t eflg;
|
||||
|
@ -657,7 +661,7 @@ static enum can_state mcp2515_get_state(struct device *dev,
|
|||
return CAN_ERROR_ACTIVE;
|
||||
}
|
||||
|
||||
static void mcp2515_handle_errors(struct device *dev)
|
||||
static void mcp2515_handle_errors(const struct device *dev)
|
||||
{
|
||||
struct mcp2515_data *dev_data = DEV_DATA(dev);
|
||||
can_state_change_isr_t state_change_isr = dev_data->state_change_isr;
|
||||
|
@ -673,14 +677,14 @@ static void mcp2515_handle_errors(struct device *dev)
|
|||
}
|
||||
|
||||
#ifndef CONFIG_CAN_AUTO_BUS_OFF_RECOVERY
|
||||
static void mcp2515_recover(struct device *dev, k_timeout_t timeout)
|
||||
static void mcp2515_recover(const struct device *dev, k_timeout_t timeout)
|
||||
{
|
||||
ARG_UNUSED(dev);
|
||||
ARG_UNUSED(timeout);
|
||||
}
|
||||
#endif
|
||||
|
||||
static void mcp2515_handle_interrupts(struct device *dev)
|
||||
static void mcp2515_handle_interrupts(const struct device *dev)
|
||||
{
|
||||
const struct mcp2515_config *dev_cfg = DEV_CFG(dev);
|
||||
struct mcp2515_data *dev_data = DEV_DATA(dev);
|
||||
|
@ -748,7 +752,7 @@ static void mcp2515_handle_interrupts(struct device *dev)
|
|||
}
|
||||
}
|
||||
|
||||
static void mcp2515_int_thread(struct device *dev)
|
||||
static void mcp2515_int_thread(const struct device *dev)
|
||||
{
|
||||
struct mcp2515_data *dev_data = DEV_DATA(dev);
|
||||
|
||||
|
@ -758,7 +762,7 @@ static void mcp2515_int_thread(struct device *dev)
|
|||
}
|
||||
}
|
||||
|
||||
static void mcp2515_int_gpio_callback(struct device *dev,
|
||||
static void mcp2515_int_gpio_callback(const struct device *dev,
|
||||
struct gpio_callback *cb, uint32_t pins)
|
||||
{
|
||||
struct mcp2515_data *dev_data =
|
||||
|
@ -780,7 +784,7 @@ static const struct can_driver_api can_api_funcs = {
|
|||
};
|
||||
|
||||
|
||||
static int mcp2515_init(struct device *dev)
|
||||
static int mcp2515_init(const struct device *dev)
|
||||
{
|
||||
const struct mcp2515_config *dev_cfg = DEV_CFG(dev);
|
||||
struct mcp2515_data *dev_data = DEV_DATA(dev);
|
||||
|
|
|
@ -26,14 +26,14 @@ struct mcp2515_tx_cb {
|
|||
|
||||
struct mcp2515_data {
|
||||
/* spi device data */
|
||||
struct device *spi;
|
||||
const struct device *spi;
|
||||
struct spi_config spi_cfg;
|
||||
#if DT_INST_SPI_DEV_HAS_CS_GPIOS(0)
|
||||
struct spi_cs_control spi_cs_ctrl;
|
||||
#endif /* DT_INST_SPI_DEV_HAS_CS_GPIOS(0) */
|
||||
|
||||
/* interrupt data */
|
||||
struct device *int_gpio;
|
||||
const struct device *int_gpio;
|
||||
struct gpio_callback int_gpio_cb;
|
||||
struct k_thread int_thread;
|
||||
k_thread_stack_t *int_thread_stack;
|
||||
|
|
|
@ -60,7 +60,7 @@ struct mcux_flexcan_config {
|
|||
uint32_t prop_seg;
|
||||
uint32_t phase_seg1;
|
||||
uint32_t phase_seg2;
|
||||
void (*irq_config_func)(struct device *dev);
|
||||
void (*irq_config_func)(const struct device *dev);
|
||||
};
|
||||
|
||||
struct mcux_flexcan_rx_callback {
|
||||
|
@ -92,12 +92,13 @@ struct mcux_flexcan_data {
|
|||
can_state_change_isr_t state_change_isr;
|
||||
};
|
||||
|
||||
static int mcux_flexcan_configure(struct device *dev, enum can_mode mode,
|
||||
static int mcux_flexcan_configure(const struct device *dev,
|
||||
enum can_mode mode,
|
||||
uint32_t bitrate)
|
||||
{
|
||||
const struct mcux_flexcan_config *config = dev->config;
|
||||
flexcan_config_t flexcan_config;
|
||||
struct device *clock_dev;
|
||||
const struct device *clock_dev;
|
||||
uint32_t clock_freq;
|
||||
|
||||
clock_dev = device_get_binding(config->clock_name);
|
||||
|
@ -245,7 +246,8 @@ static int mcux_get_tx_alloc(struct mcux_flexcan_data *data)
|
|||
return alloc >= MCUX_FLEXCAN_MAX_TX ? -1 : alloc;
|
||||
}
|
||||
|
||||
static int mcux_flexcan_send(struct device *dev, const struct zcan_frame *msg,
|
||||
static int mcux_flexcan_send(const struct device *dev,
|
||||
const struct zcan_frame *msg,
|
||||
k_timeout_t timeout,
|
||||
can_tx_callback_t callback_isr, void *callback_arg)
|
||||
{
|
||||
|
@ -295,7 +297,8 @@ static int mcux_flexcan_send(struct device *dev, const struct zcan_frame *msg,
|
|||
return CAN_TX_OK;
|
||||
}
|
||||
|
||||
static int mcux_flexcan_attach_isr(struct device *dev, can_rx_callback_t isr,
|
||||
static int mcux_flexcan_attach_isr(const struct device *dev,
|
||||
can_rx_callback_t isr,
|
||||
void *callback_arg,
|
||||
const struct zcan_filter *filter)
|
||||
{
|
||||
|
@ -350,7 +353,7 @@ static int mcux_flexcan_attach_isr(struct device *dev, can_rx_callback_t isr,
|
|||
return alloc;
|
||||
}
|
||||
|
||||
static void mcux_flexcan_register_state_change_isr(struct device *dev,
|
||||
static void mcux_flexcan_register_state_change_isr(const struct device *dev,
|
||||
can_state_change_isr_t isr)
|
||||
{
|
||||
struct mcux_flexcan_data *data = dev->data;
|
||||
|
@ -358,7 +361,7 @@ static void mcux_flexcan_register_state_change_isr(struct device *dev,
|
|||
data->state_change_isr = isr;
|
||||
}
|
||||
|
||||
static enum can_state mcux_flexcan_get_state(struct device *dev,
|
||||
static enum can_state mcux_flexcan_get_state(const struct device *dev,
|
||||
struct can_bus_err_cnt *err_cnt)
|
||||
{
|
||||
const struct mcux_flexcan_config *config = dev->config;
|
||||
|
@ -384,7 +387,7 @@ static enum can_state mcux_flexcan_get_state(struct device *dev,
|
|||
}
|
||||
|
||||
#ifndef CONFIG_CAN_AUTO_BUS_OFF_RECOVERY
|
||||
int mcux_flexcan_recover(struct device *dev, k_timeout_t timeout)
|
||||
int mcux_flexcan_recover(const struct device *dev, k_timeout_t timeout)
|
||||
{
|
||||
const struct mcux_flexcan_config *config = dev->config;
|
||||
int ret = 0;
|
||||
|
@ -412,7 +415,7 @@ int mcux_flexcan_recover(struct device *dev, k_timeout_t timeout)
|
|||
}
|
||||
#endif /* CONFIG_CAN_AUTO_BUS_OFF_RECOVERY */
|
||||
|
||||
static void mcux_flexcan_detach(struct device *dev, int filter_id)
|
||||
static void mcux_flexcan_detach(const struct device *dev, int filter_id)
|
||||
{
|
||||
const struct mcux_flexcan_config *config = dev->config;
|
||||
struct mcux_flexcan_data *data = dev->data;
|
||||
|
@ -440,7 +443,7 @@ static void mcux_flexcan_detach(struct device *dev, int filter_id)
|
|||
k_mutex_unlock(&data->rx_mutex);
|
||||
}
|
||||
|
||||
static inline void mcux_flexcan_transfer_error_status(struct device *dev,
|
||||
static inline void mcux_flexcan_transfer_error_status(const struct device *dev,
|
||||
uint32_t error)
|
||||
{
|
||||
const struct mcux_flexcan_config *config = dev->config;
|
||||
|
@ -517,7 +520,7 @@ static inline void mcux_flexcan_transfer_error_status(struct device *dev,
|
|||
}
|
||||
}
|
||||
|
||||
static inline void mcux_flexcan_transfer_tx_idle(struct device *dev,
|
||||
static inline void mcux_flexcan_transfer_tx_idle(const struct device *dev,
|
||||
uint32_t mb)
|
||||
{
|
||||
struct mcux_flexcan_data *data = dev->data;
|
||||
|
@ -542,7 +545,7 @@ static inline void mcux_flexcan_transfer_tx_idle(struct device *dev,
|
|||
}
|
||||
}
|
||||
|
||||
static inline void mcux_flexcan_transfer_rx_idle(struct device *dev,
|
||||
static inline void mcux_flexcan_transfer_rx_idle(const struct device *dev,
|
||||
uint32_t mb)
|
||||
{
|
||||
const struct mcux_flexcan_config *config = dev->config;
|
||||
|
@ -583,7 +586,7 @@ static void mcux_flexcan_transfer_callback(CAN_Type *base,
|
|||
status_t status, uint32_t result,
|
||||
void *userData)
|
||||
{
|
||||
struct device *dev = (struct device *)userData;
|
||||
const struct device *dev = (const struct device *)userData;
|
||||
|
||||
switch (status) {
|
||||
case kStatus_FLEXCAN_UnHandled:
|
||||
|
@ -609,14 +612,14 @@ static void mcux_flexcan_transfer_callback(CAN_Type *base,
|
|||
|
||||
static void mcux_flexcan_isr(void *arg)
|
||||
{
|
||||
struct device *dev = (struct device *)arg;
|
||||
const struct device *dev = (const struct device *)arg;
|
||||
const struct mcux_flexcan_config *config = dev->config;
|
||||
struct mcux_flexcan_data *data = dev->data;
|
||||
|
||||
FLEXCAN_TransferHandleIRQ(config->base, &data->handle);
|
||||
}
|
||||
|
||||
static int mcux_flexcan_init(struct device *dev)
|
||||
static int mcux_flexcan_init(const struct device *dev)
|
||||
{
|
||||
const struct mcux_flexcan_config *config = dev->config;
|
||||
struct mcux_flexcan_data *data = dev->data;
|
||||
|
@ -661,7 +664,7 @@ static const struct can_driver_api mcux_flexcan_driver_api = {
|
|||
};
|
||||
|
||||
#if DT_NODE_HAS_STATUS(DT_DRV_INST(0), okay)
|
||||
static void mcux_flexcan_config_func_0(struct device *dev);
|
||||
static void mcux_flexcan_config_func_0(const struct device *dev);
|
||||
|
||||
static const struct mcux_flexcan_config mcux_flexcan_config_0 = {
|
||||
.base = (CAN_Type *) DT_INST_REG_ADDR(0),
|
||||
|
@ -685,7 +688,7 @@ DEVICE_AND_API_INIT(can_mcux_flexcan_0, DT_INST_LABEL(0),
|
|||
&mcux_flexcan_config_0, POST_KERNEL,
|
||||
CONFIG_CAN_INIT_PRIORITY, &mcux_flexcan_driver_api);
|
||||
|
||||
static void mcux_flexcan_config_func_0(struct device *dev)
|
||||
static void mcux_flexcan_config_func_0(const struct device *dev)
|
||||
{
|
||||
#if DT_INST_IRQ_HAS_NAME(0, rx_warning)
|
||||
IRQ_CONNECT(DT_INST_IRQ_BY_NAME(0, rx_warning, irq),
|
||||
|
@ -731,9 +734,9 @@ static void mcux_flexcan_config_func_0(struct device *dev)
|
|||
|
||||
#include "socket_can_generic.h"
|
||||
|
||||
static int socket_can_init_0(struct device *dev)
|
||||
static int socket_can_init_0(const struct device *dev)
|
||||
{
|
||||
struct device *can_dev = DEVICE_GET(can_mcux_flexcan_0);
|
||||
const struct device *can_dev = DEVICE_GET(can_mcux_flexcan_0);
|
||||
struct socket_can_context *socket_context = dev->data;
|
||||
|
||||
LOG_DBG("Init socket CAN device %p (%s) for dev %p (%s)",
|
||||
|
@ -763,7 +766,7 @@ NET_DEVICE_INIT(socket_can_flexcan_0, SOCKET_CAN_NAME_1, socket_can_init_0,
|
|||
#endif /* DT_NODE_HAS_STATUS(DT_DRV_INST(0), okay) */
|
||||
|
||||
#if DT_NODE_HAS_STATUS(DT_DRV_INST(1), okay)
|
||||
static void mcux_flexcan_config_func_1(struct device *dev);
|
||||
static void mcux_flexcan_config_func_1(const struct device *dev);
|
||||
|
||||
static const struct mcux_flexcan_config mcux_flexcan_config_1 = {
|
||||
.base = (CAN_Type *) DT_INST_REG_ADDR(1),
|
||||
|
@ -787,7 +790,7 @@ DEVICE_AND_API_INIT(can_mcux_flexcan_1, DT_INST_LABEL(1),
|
|||
&mcux_flexcan_config_1, POST_KERNEL,
|
||||
CONFIG_CAN_INIT_PRIORITY, &mcux_flexcan_driver_api);
|
||||
|
||||
static void mcux_flexcan_config_func_1(struct device *dev)
|
||||
static void mcux_flexcan_config_func_1(const struct device *dev)
|
||||
{
|
||||
IRQ_CONNECT(DT_INST_IRQ_BY_NAME(1, warning, irq),
|
||||
DT_INST_IRQ_BY_NAME(1, warning, priority),
|
||||
|
|
|
@ -16,7 +16,7 @@ struct mcast_filter_mapping {
|
|||
};
|
||||
|
||||
struct net_can_context {
|
||||
struct device *can_dev;
|
||||
const struct device *can_dev;
|
||||
struct net_if *iface;
|
||||
int recv_filter_id;
|
||||
struct mcast_filter_mapping mcast_mapping[NET_IF_MAX_IPV6_MADDR];
|
||||
|
@ -88,7 +88,8 @@ static inline void can_set_lladdr(struct net_pkt *pkt, struct zcan_frame *frame)
|
|||
net_buf_pull(buf, sizeof(uint16_t));
|
||||
}
|
||||
|
||||
static int net_can_send(struct device *dev, const struct zcan_frame *frame,
|
||||
static int net_can_send(const struct device *dev,
|
||||
const struct zcan_frame *frame,
|
||||
can_tx_callback_t cb, void *cb_arg, k_timeout_t timeout)
|
||||
{
|
||||
struct net_can_context *ctx = dev->data;
|
||||
|
@ -172,7 +173,7 @@ static inline int attach_mcast_filter(struct net_can_context *ctx,
|
|||
static void mcast_cb(struct net_if *iface, const struct in6_addr *addr,
|
||||
bool is_joined)
|
||||
{
|
||||
struct device *dev = net_if_get_device(iface);
|
||||
const struct device *dev = net_if_get_device(iface);
|
||||
struct net_can_context *ctx = dev->data;
|
||||
struct mcast_filter_mapping *filter_mapping;
|
||||
int filter_id;
|
||||
|
@ -205,7 +206,7 @@ static void mcast_cb(struct net_if *iface, const struct in6_addr *addr,
|
|||
|
||||
static void net_can_iface_init(struct net_if *iface)
|
||||
{
|
||||
struct device *dev = net_if_get_device(iface);
|
||||
const struct device *dev = net_if_get_device(iface);
|
||||
struct net_can_context *ctx = dev->data;
|
||||
|
||||
ctx->iface = iface;
|
||||
|
@ -217,7 +218,7 @@ static void net_can_iface_init(struct net_if *iface)
|
|||
net_if_mcast_mon_register(&mcast_monitor, iface, mcast_cb);
|
||||
}
|
||||
|
||||
static int can_attach_filter(struct device *dev, can_rx_callback_t cb,
|
||||
static int can_attach_filter(const struct device *dev, can_rx_callback_t cb,
|
||||
void *cb_arg,
|
||||
const struct zcan_filter *filter)
|
||||
{
|
||||
|
@ -226,7 +227,7 @@ static int can_attach_filter(struct device *dev, can_rx_callback_t cb,
|
|||
return can_attach_isr(ctx->can_dev, cb, cb_arg, filter);
|
||||
}
|
||||
|
||||
static void can_detach_filter(struct device *dev, int filter_id)
|
||||
static void can_detach_filter(const struct device *dev, int filter_id)
|
||||
{
|
||||
struct net_can_context *ctx = dev->data;
|
||||
|
||||
|
@ -312,7 +313,7 @@ static inline int can_attach_all_mcast_filter(struct net_can_context *ctx)
|
|||
}
|
||||
#endif /*CONFIG_NET_L2_CANBUS_ETH_TRANSLATOR*/
|
||||
|
||||
static int can_enable(struct device *dev, bool enable)
|
||||
static int can_enable(const struct device *dev, bool enable)
|
||||
{
|
||||
struct net_can_context *ctx = dev->data;
|
||||
|
||||
|
@ -370,9 +371,9 @@ static struct net_can_api net_can_api_inst = {
|
|||
.enable = can_enable,
|
||||
};
|
||||
|
||||
static int net_can_init(struct device *dev)
|
||||
static int net_can_init(const struct device *dev)
|
||||
{
|
||||
struct device *can_dev;
|
||||
const struct device *can_dev;
|
||||
struct net_can_context *ctx = dev->data;
|
||||
|
||||
can_dev = device_get_binding(DT_CHOSEN_ZEPHYR_CAN_PRIMARY_LABEL);
|
||||
|
|
|
@ -209,7 +209,7 @@ static void print_frame(struct zcan_frame *frame, void *arg)
|
|||
|
||||
static int cmd_config(const struct shell *shell, size_t argc, char **argv)
|
||||
{
|
||||
struct device *can_dev;
|
||||
const struct device *can_dev;
|
||||
int pos = 1;
|
||||
bool silent = false, loopback = false;
|
||||
enum can_mode mode;
|
||||
|
@ -257,7 +257,7 @@ static int cmd_config(const struct shell *shell, size_t argc, char **argv)
|
|||
|
||||
static int cmd_send(const struct shell *shell, size_t argc, char **argv)
|
||||
{
|
||||
struct device *can_dev;
|
||||
const struct device *can_dev;
|
||||
int pos = 1;
|
||||
bool rtr = false, ext = false;
|
||||
struct zcan_frame frame;
|
||||
|
@ -308,7 +308,7 @@ static int cmd_send(const struct shell *shell, size_t argc, char **argv)
|
|||
|
||||
static int cmd_attach(const struct shell *shell, size_t argc, char **argv)
|
||||
{
|
||||
struct device *can_dev;
|
||||
const struct device *can_dev;
|
||||
int pos = 1;
|
||||
bool rtr = false, ext = false, rtr_mask = false;
|
||||
struct zcan_filter filter;
|
||||
|
@ -384,7 +384,7 @@ static int cmd_attach(const struct shell *shell, size_t argc, char **argv)
|
|||
|
||||
static int cmd_detach(const struct shell *shell, size_t argc, char **argv)
|
||||
{
|
||||
struct device *can_dev;
|
||||
const struct device *can_dev;
|
||||
char *end_ptr;
|
||||
long id;
|
||||
|
||||
|
|
|
@ -175,12 +175,12 @@ void can_stm32_tx_isr_handler(CAN_TypeDef *can, struct can_stm32_data *data)
|
|||
|
||||
static void can_stm32_isr(void *arg)
|
||||
{
|
||||
struct device *dev;
|
||||
const struct device *dev;
|
||||
struct can_stm32_data *data;
|
||||
const struct can_stm32_config *cfg;
|
||||
CAN_TypeDef *can;
|
||||
|
||||
dev = (struct device *)arg;
|
||||
dev = (const struct device *)arg;
|
||||
data = DEV_DATA(dev);
|
||||
cfg = DEV_CFG(dev);
|
||||
can = cfg->can;
|
||||
|
@ -197,12 +197,12 @@ static void can_stm32_isr(void *arg)
|
|||
|
||||
static void can_stm32_rx_isr(void *arg)
|
||||
{
|
||||
struct device *dev;
|
||||
const struct device *dev;
|
||||
struct can_stm32_data *data;
|
||||
const struct can_stm32_config *cfg;
|
||||
CAN_TypeDef *can;
|
||||
|
||||
dev = (struct device *)arg;
|
||||
dev = (const struct device *)arg;
|
||||
data = DEV_DATA(dev);
|
||||
cfg = DEV_CFG(dev);
|
||||
can = cfg->can;
|
||||
|
@ -212,12 +212,12 @@ static void can_stm32_rx_isr(void *arg)
|
|||
|
||||
static void can_stm32_tx_isr(void *arg)
|
||||
{
|
||||
struct device *dev;
|
||||
const struct device *dev;
|
||||
struct can_stm32_data *data;
|
||||
const struct can_stm32_config *cfg;
|
||||
CAN_TypeDef *can;
|
||||
|
||||
dev = (struct device *)arg;
|
||||
dev = (const struct device *)arg;
|
||||
data = DEV_DATA(dev);
|
||||
cfg = DEV_CFG(dev);
|
||||
can = cfg->can;
|
||||
|
@ -227,12 +227,12 @@ static void can_stm32_tx_isr(void *arg)
|
|||
|
||||
static void can_stm32_state_change_isr(void *arg)
|
||||
{
|
||||
struct device *dev;
|
||||
const struct device *dev;
|
||||
struct can_stm32_data *data;
|
||||
const struct can_stm32_config *cfg;
|
||||
CAN_TypeDef *can;
|
||||
|
||||
dev = (struct device *)arg;
|
||||
dev = (const struct device *)arg;
|
||||
data = DEV_DATA(dev);
|
||||
cfg = DEV_CFG(dev);
|
||||
can = cfg->can;
|
||||
|
@ -297,14 +297,14 @@ static int can_leave_sleep_mode(CAN_TypeDef *can)
|
|||
return 0;
|
||||
}
|
||||
|
||||
int can_stm32_runtime_configure(struct device *dev, enum can_mode mode,
|
||||
int can_stm32_runtime_configure(const struct device *dev, enum can_mode mode,
|
||||
uint32_t bitrate)
|
||||
{
|
||||
CAN_HandleTypeDef hcan;
|
||||
const struct can_stm32_config *cfg = DEV_CFG(dev);
|
||||
CAN_TypeDef *can = cfg->can;
|
||||
struct can_stm32_data *data = DEV_DATA(dev);
|
||||
struct device *clock;
|
||||
const struct device *clock;
|
||||
uint32_t clock_rate;
|
||||
uint32_t prescaler;
|
||||
uint32_t reg_mode;
|
||||
|
@ -383,7 +383,7 @@ done:
|
|||
return ret;
|
||||
}
|
||||
|
||||
static int can_stm32_init(struct device *dev)
|
||||
static int can_stm32_init(const struct device *dev)
|
||||
{
|
||||
const struct can_stm32_config *cfg = DEV_CFG(dev);
|
||||
struct can_stm32_data *data = DEV_DATA(dev);
|
||||
|
@ -391,7 +391,7 @@ static int can_stm32_init(struct device *dev)
|
|||
#if DT_NODE_HAS_STATUS(DT_NODELABEL(can2), okay)
|
||||
CAN_TypeDef *master_can = cfg->master_can;
|
||||
#endif
|
||||
struct device *clock;
|
||||
const struct device *clock;
|
||||
int ret;
|
||||
|
||||
k_mutex_init(&data->inst_mutex);
|
||||
|
@ -458,7 +458,7 @@ static int can_stm32_init(struct device *dev)
|
|||
return 0;
|
||||
}
|
||||
|
||||
static void can_stm32_register_state_change_isr(struct device *dev,
|
||||
static void can_stm32_register_state_change_isr(const struct device *dev,
|
||||
can_state_change_isr_t isr)
|
||||
{
|
||||
struct can_stm32_data *data = DEV_DATA(dev);
|
||||
|
@ -474,7 +474,7 @@ static void can_stm32_register_state_change_isr(struct device *dev,
|
|||
}
|
||||
}
|
||||
|
||||
static enum can_state can_stm32_get_state(struct device *dev,
|
||||
static enum can_state can_stm32_get_state(const struct device *dev,
|
||||
struct can_bus_err_cnt *err_cnt)
|
||||
{
|
||||
const struct can_stm32_config *cfg = DEV_CFG(dev);
|
||||
|
@ -500,7 +500,7 @@ static enum can_state can_stm32_get_state(struct device *dev,
|
|||
}
|
||||
|
||||
#ifndef CONFIG_CAN_AUTO_BUS_OFF_RECOVERY
|
||||
int can_stm32_recover(struct device *dev, k_timeout_t timeout)
|
||||
int can_stm32_recover(const struct device *dev, k_timeout_t timeout)
|
||||
{
|
||||
const struct can_stm32_config *cfg = DEV_CFG(dev);
|
||||
struct can_stm32_data *data = DEV_DATA(dev);
|
||||
|
@ -541,7 +541,7 @@ done:
|
|||
#endif /* CONFIG_CAN_AUTO_BUS_OFF_RECOVERY */
|
||||
|
||||
|
||||
int can_stm32_send(struct device *dev, const struct zcan_frame *msg,
|
||||
int can_stm32_send(const struct device *dev, const struct zcan_frame *msg,
|
||||
k_timeout_t timeout, can_tx_callback_t callback,
|
||||
void *callback_arg)
|
||||
{
|
||||
|
@ -951,7 +951,8 @@ done:
|
|||
return filter_nr;
|
||||
}
|
||||
|
||||
static inline int can_stm32_attach(struct device *dev, can_rx_callback_t cb,
|
||||
static inline int can_stm32_attach(const struct device *dev,
|
||||
can_rx_callback_t cb,
|
||||
void *cb_arg,
|
||||
const struct zcan_filter *filter)
|
||||
{
|
||||
|
@ -970,7 +971,7 @@ static inline int can_stm32_attach(struct device *dev, can_rx_callback_t cb,
|
|||
return filter_nr;
|
||||
}
|
||||
|
||||
int can_stm32_attach_isr(struct device *dev, can_rx_callback_t isr,
|
||||
int can_stm32_attach_isr(const struct device *dev, can_rx_callback_t isr,
|
||||
void *cb_arg,
|
||||
const struct zcan_filter *filter)
|
||||
{
|
||||
|
@ -983,7 +984,7 @@ int can_stm32_attach_isr(struct device *dev, can_rx_callback_t isr,
|
|||
return filter_nr;
|
||||
}
|
||||
|
||||
void can_stm32_detach(struct device *dev, int filter_nr)
|
||||
void can_stm32_detach(const struct device *dev, int filter_nr)
|
||||
{
|
||||
const struct can_stm32_config *cfg = DEV_CFG(dev);
|
||||
struct can_stm32_data *data = DEV_DATA(dev);
|
||||
|
@ -1103,9 +1104,9 @@ static void config_can_1_irq(CAN_TypeDef *can)
|
|||
|
||||
#include "socket_can_generic.h"
|
||||
|
||||
static int socket_can_init_1(struct device *dev)
|
||||
static int socket_can_init_1(const struct device *dev)
|
||||
{
|
||||
struct device *can_dev = DEVICE_GET(can_stm32_1);
|
||||
const struct device *can_dev = DEVICE_GET(can_stm32_1);
|
||||
struct socket_can_context *socket_context = dev->data;
|
||||
|
||||
LOG_DBG("Init socket CAN device %p (%s) for dev %p (%s)",
|
||||
|
@ -1186,9 +1187,9 @@ static void config_can_2_irq(CAN_TypeDef *can)
|
|||
|
||||
#include "socket_can_generic.h"
|
||||
|
||||
static int socket_can_init_2(struct device *dev)
|
||||
static int socket_can_init_2(const struct device *dev)
|
||||
{
|
||||
struct device *can_dev = DEVICE_GET(can_stm32_2);
|
||||
const struct device *can_dev = DEVICE_GET(can_stm32_2);
|
||||
struct socket_can_context *socket_context = dev->data;
|
||||
|
||||
LOG_DBG("Init socket CAN device %p (%s) for dev %p (%s)",
|
||||
|
|
|
@ -24,7 +24,7 @@ CAN_DEFINE_MSGQ(socket_can_msgq, 5);
|
|||
K_KERNEL_STACK_DEFINE(rx_thread_stack, RX_THREAD_STACK_SIZE);
|
||||
|
||||
struct socket_can_context {
|
||||
struct device *can_dev;
|
||||
const struct device *can_dev;
|
||||
struct net_if *iface;
|
||||
struct k_msgq *msgq;
|
||||
|
||||
|
@ -35,7 +35,7 @@ struct socket_can_context {
|
|||
|
||||
static inline void socket_can_iface_init(struct net_if *iface)
|
||||
{
|
||||
struct device *dev = net_if_get_device(iface);
|
||||
const struct device *dev = net_if_get_device(iface);
|
||||
struct socket_can_context *socket_context = dev->data;
|
||||
|
||||
socket_context->iface = iface;
|
||||
|
@ -53,7 +53,8 @@ static inline void tx_irq_callback(uint32_t error_flags, void *arg)
|
|||
}
|
||||
|
||||
/* This is called by net_if.c when packet is about to be sent */
|
||||
static inline int socket_can_send(struct device *dev, struct net_pkt *pkt)
|
||||
static inline int socket_can_send(const struct device *dev,
|
||||
struct net_pkt *pkt)
|
||||
{
|
||||
struct socket_can_context *socket_context = dev->data;
|
||||
int ret;
|
||||
|
@ -75,7 +76,7 @@ static inline int socket_can_send(struct device *dev, struct net_pkt *pkt)
|
|||
return -ret;
|
||||
}
|
||||
|
||||
static inline int socket_can_setsockopt(struct device *dev, void *obj,
|
||||
static inline int socket_can_setsockopt(const struct device *dev, void *obj,
|
||||
int level, int optname,
|
||||
const void *optval, socklen_t optlen)
|
||||
{
|
||||
|
@ -102,7 +103,7 @@ static inline int socket_can_setsockopt(struct device *dev, void *obj,
|
|||
return 0;
|
||||
}
|
||||
|
||||
static inline void socket_can_close(struct device *dev, int filter_id)
|
||||
static inline void socket_can_close(const struct device *dev, int filter_id)
|
||||
{
|
||||
struct socket_can_context *socket_context = dev->data;
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue