drivers: Apply IPM callback signature change where relevant

Of course IPM drivers now provide their device instance. There are 2
drivers using IPM callbacks as well, so they get the imp device instance
pointer now through the callback.

Fixes #26923

Signed-off-by: Tomasz Bursztyka <tomasz.bursztyka@linux.intel.com>
This commit is contained in:
Tomasz Bursztyka 2020-07-08 19:13:49 +02:00 committed by Carles Cufí
commit c6706561b9
8 changed files with 21 additions and 15 deletions

View file

@ -115,7 +115,8 @@ const struct virtio_dispatch dispatch = {
.notify = virtio_notify,
};
static void ipm_callback(void *context, uint32_t id, volatile void *data)
static void ipm_callback(struct device *dev, void *context,
uint32_t id, volatile void *data)
{
BT_DBG("Got callback of id %u", id);
k_sem_give(&rx_sem);

View file

@ -84,8 +84,8 @@ static void ipm_console_thread(void *arg1, void *arg2, void *arg3)
}
}
static void ipm_console_receive_callback(void *context, uint32_t id,
volatile void *data)
static void ipm_console_receive_callback(struct device *ipm_dev, void *context,
uint32_t id, volatile void *data)
{
struct device *d;
struct ipm_console_receiver_runtime_data *driver_data;
@ -109,7 +109,7 @@ static void ipm_console_receive_callback(void *context, uint32_t id,
* re-enables the channel and consumes the data.
*/
if (ring_buf_space_get(&driver_data->rb) == 0) {
ipm_set_enabled(driver_data->ipm_device, 0);
ipm_set_enabled(ipm_dev, 0);
driver_data->channel_disabled = 1;
}
}

View file

@ -68,7 +68,7 @@ static void cavs_idc_isr(struct device *dev)
ext = UINT_TO_POINTER(
idc_read(REG_IDCTEFC(i), curr_cpu_id) &
REG_IDCTEFC_MSG_MASK);
drv_data->cb(drv_data->ctx, id, ext);
drv_data->cb(dev, drv_data->ctx, id, ext);
}
break;
}

View file

@ -69,7 +69,7 @@ static void imx_mu_isr(void *arg)
}
if (data->callback) {
data->callback(data->callback_ctx,
data->callback(dev, data->callback_ctx,
(uint32_t)id,
&data32[0]);
}

View file

@ -52,7 +52,7 @@ static void mcux_mailbox_isr(void *arg)
if (data->callback) {
/* Only one MAILBOX, id is unused and set to 0 */
data->callback(data->callback_ctx, 0, &value);
data->callback(dev, data->callback_ctx, 0, &value);
}
/* Add for ARM errata 838869, affects Cortex-M4, Cortex-M4F
* Store immediate overlapping exception return operation

View file

@ -137,8 +137,8 @@ static void ipm_mhu_isr(void *arg)
ipm_mhu_clear_val(d, cpu_id, ipm_mhu_status);
if (driver_data->callback) {
driver_data->callback(driver_data->callback_ctx, cpu_id,
&ipm_mhu_status);
driver_data->callback(d, driver_data->callback_ctx, cpu_id,
&ipm_mhu_status);
}
}
@ -157,8 +157,8 @@ static int ipm_mhu_max_data_size_get(struct device *d)
}
static void ipm_mhu_register_cb(struct device *d,
ipm_callback_t cb,
void *context)
ipm_callback_t cb,
void *context)
{
struct ipm_mhu_data *driver_data = DEV_DATA(d);

View file

@ -27,6 +27,8 @@ static void gipm_send(uint32_t id);
#if IS_ENABLED(CONFIG_IPM_NRF_SINGLE_INSTANCE)
DEVICE_DECLARE(ipm_nrf);
static void nrfx_ipc_handler(uint32_t event_mask, void *p_context)
{
if (nrfx_ipm_data.callback) {
@ -36,7 +38,8 @@ static void nrfx_ipc_handler(uint32_t event_mask, void *p_context)
__ASSERT(event_idx < NRFX_IPC_ID_MAX_VALUE,
"Illegal event_idx: %d", event_idx);
event_mask &= ~BIT(event_idx);
nrfx_ipm_data.callback(nrfx_ipm_data.callback_ctx,
nrfx_ipm_data.callback(DEVICE_GET(ipm_nrf),
nrfx_ipm_data.callback_ctx,
event_idx,
NULL);
}
@ -117,8 +120,8 @@ DEVICE_AND_API_INIT(ipm_nrf, DT_INST_LABEL(0),
struct vipm_nrf_data {
ipm_callback_t callback[NRFX_IPC_ID_MAX_VALUE];
void *callback_ctx[NRFX_IPC_ID_MAX_VALUE];
struct device *ipm_device[NRFX_IPC_ID_MAX_VALUE];
bool ipm_init;
struct device *ipm_device;
};
static struct vipm_nrf_data nrfx_vipm_data;
@ -133,7 +136,8 @@ static void vipm_dispatcher(uint32_t event_mask, void *p_context)
event_mask &= ~BIT(event_idx);
if (nrfx_vipm_data.callback[event_idx] != NULL) {
nrfx_vipm_data.callback[event_idx]
(nrfx_vipm_data.callback_ctx[event_idx],
(nrfx_vipm_data.ipm_device[event_idx],
nrfx_vipm_data.callback_ctx[event_idx],
0,
NULL);
}
@ -195,6 +199,7 @@ static void vipm_nrf_##_idx##_register_callback(struct device *dev, \
if (IS_ENABLED(CONFIG_IPM_MSG_CH_##_idx##_RX)) { \
nrfx_vipm_data.callback[_idx] = cb; \
nrfx_vipm_data.callback_ctx[_idx] = context; \
nrfx_vipm_data.ipm_device[_idx] = dev; \
} else { \
LOG_WRN("Trying to register a callback" \
"for TX channel IPM_" #_idx); \

View file

@ -122,7 +122,7 @@ static void stm32_ipcc_mailbox_rx_isr(void *arg)
if (data->callback) {
/* Only one MAILBOX, id is unused and set to 0 */
data->callback(data->callback_ctx, i, &value);
data->callback(dev, data->callback_ctx, i, &value);
}
/* clear status to acknoledge message reception */
IPCC_ClearFlag_CHx(cfg->ipcc, i);