drivers: can: add struct device argument to callback functions

Include a pointer to the CAN controller device for the CAN
transmit, receive, and state change callback functions.

Signed-off-by: Henrik Brix Andersen <hebad@vestas.com>
This commit is contained in:
Henrik Brix Andersen 2022-03-17 22:06:51 +01:00 committed by Anas Nashif
commit 67ba9900f0
16 changed files with 137 additions and 105 deletions

View file

@ -78,11 +78,13 @@ static void canopen_detach_all_rx_filters(CO_CANmodule_t *CANmodule)
}
}
static void canopen_rx_callback(struct zcan_frame *msg, void *arg)
static void canopen_rx_callback(const struct device *dev, struct zcan_frame *msg, void *arg)
{
CO_CANrx_t *buffer = (CO_CANrx_t *)arg;
CO_CANrxMsg_t rxMsg;
ARG_UNUSED(dev);
if (!buffer || !buffer->pFunct) {
LOG_ERR("failed to process CAN rx callback");
return;
@ -94,10 +96,12 @@ static void canopen_rx_callback(struct zcan_frame *msg, void *arg)
buffer->pFunct(buffer->object, &rxMsg);
}
static void canopen_tx_callback(int error, void *arg)
static void canopen_tx_callback(const struct device *dev, int error, void *arg)
{
CO_CANmodule_t *CANmodule = arg;
ARG_UNUSED(dev);
if (!CANmodule) {
LOG_ERR("failed to process CAN tx callback");
return;