drivers: ipm: Align all drivers using user_data for the callback
s/context/user_data Signed-off-by: Tomasz Bursztyka <tomasz.bursztyka@linux.intel.com>
This commit is contained in:
parent
0d4477604a
commit
caf78ca11b
6 changed files with 26 additions and 26 deletions
|
@ -23,7 +23,7 @@ extern void z_sched_ipi(void);
|
||||||
|
|
||||||
struct cavs_idc_data {
|
struct cavs_idc_data {
|
||||||
ipm_callback_t cb;
|
ipm_callback_t cb;
|
||||||
void *ctx;
|
void *user_data;
|
||||||
};
|
};
|
||||||
|
|
||||||
DEVICE_DECLARE(cavs_idc);
|
DEVICE_DECLARE(cavs_idc);
|
||||||
|
@ -68,7 +68,7 @@ static void cavs_idc_isr(struct device *dev)
|
||||||
ext = UINT_TO_POINTER(
|
ext = UINT_TO_POINTER(
|
||||||
idc_read(REG_IDCTEFC(i), curr_cpu_id) &
|
idc_read(REG_IDCTEFC(i), curr_cpu_id) &
|
||||||
REG_IDCTEFC_MSG_MASK);
|
REG_IDCTEFC_MSG_MASK);
|
||||||
drv_data->cb(dev, drv_data->ctx, id, ext);
|
drv_data->cb(dev, drv_data->user_data, id, ext);
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
@ -157,12 +157,12 @@ static uint32_t cavs_idc_max_id_val_get(struct device *dev)
|
||||||
}
|
}
|
||||||
|
|
||||||
static void cavs_idc_register_callback(struct device *dev, ipm_callback_t cb,
|
static void cavs_idc_register_callback(struct device *dev, ipm_callback_t cb,
|
||||||
void *context)
|
void *user_data)
|
||||||
{
|
{
|
||||||
struct cavs_idc_data *drv_data = dev->driver_data;
|
struct cavs_idc_data *drv_data = dev->driver_data;
|
||||||
|
|
||||||
drv_data->cb = cb;
|
drv_data->cb = cb;
|
||||||
drv_data->ctx = context;
|
drv_data->user_data = user_data;
|
||||||
}
|
}
|
||||||
|
|
||||||
static int cavs_idc_set_enabled(struct device *dev, int enable)
|
static int cavs_idc_set_enabled(struct device *dev, int enable)
|
||||||
|
|
|
@ -28,7 +28,7 @@ struct imx_mu_config {
|
||||||
|
|
||||||
struct imx_mu_data {
|
struct imx_mu_data {
|
||||||
ipm_callback_t callback;
|
ipm_callback_t callback;
|
||||||
void *callback_ctx;
|
void *user_data;
|
||||||
};
|
};
|
||||||
|
|
||||||
static void imx_mu_isr(void *arg)
|
static void imx_mu_isr(void *arg)
|
||||||
|
@ -69,7 +69,7 @@ static void imx_mu_isr(void *arg)
|
||||||
}
|
}
|
||||||
|
|
||||||
if (data->callback) {
|
if (data->callback) {
|
||||||
data->callback(dev, data->callback_ctx,
|
data->callback(dev, data->user_data,
|
||||||
(uint32_t)id,
|
(uint32_t)id,
|
||||||
&data32[0]);
|
&data32[0]);
|
||||||
}
|
}
|
||||||
|
@ -140,12 +140,12 @@ static uint32_t imx_mu_ipm_max_id_val_get(struct device *dev)
|
||||||
|
|
||||||
static void imx_mu_ipm_register_callback(struct device *dev,
|
static void imx_mu_ipm_register_callback(struct device *dev,
|
||||||
ipm_callback_t cb,
|
ipm_callback_t cb,
|
||||||
void *context)
|
void *user_data)
|
||||||
{
|
{
|
||||||
struct imx_mu_data *driver_data = dev->driver_data;
|
struct imx_mu_data *driver_data = dev->driver_data;
|
||||||
|
|
||||||
driver_data->callback = cb;
|
driver_data->callback = cb;
|
||||||
driver_data->callback_ctx = context;
|
driver_data->user_data = user_data;
|
||||||
}
|
}
|
||||||
|
|
||||||
static int imx_mu_ipm_set_enabled(struct device *dev, int enable)
|
static int imx_mu_ipm_set_enabled(struct device *dev, int enable)
|
||||||
|
|
|
@ -137,7 +137,7 @@ static void ipm_mhu_isr(void *arg)
|
||||||
ipm_mhu_clear_val(d, cpu_id, ipm_mhu_status);
|
ipm_mhu_clear_val(d, cpu_id, ipm_mhu_status);
|
||||||
|
|
||||||
if (driver_data->callback) {
|
if (driver_data->callback) {
|
||||||
driver_data->callback(d, driver_data->callback_ctx, cpu_id,
|
driver_data->callback(d, driver_data->user_data, cpu_id,
|
||||||
&ipm_mhu_status);
|
&ipm_mhu_status);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -158,12 +158,12 @@ static int ipm_mhu_max_data_size_get(struct device *d)
|
||||||
|
|
||||||
static void ipm_mhu_register_cb(struct device *d,
|
static void ipm_mhu_register_cb(struct device *d,
|
||||||
ipm_callback_t cb,
|
ipm_callback_t cb,
|
||||||
void *context)
|
void *user_data)
|
||||||
{
|
{
|
||||||
struct ipm_mhu_data *driver_data = DEV_DATA(d);
|
struct ipm_mhu_data *driver_data = DEV_DATA(d);
|
||||||
|
|
||||||
driver_data->callback = cb;
|
driver_data->callback = cb;
|
||||||
driver_data->callback_ctx = context;
|
driver_data->user_data = user_data;
|
||||||
}
|
}
|
||||||
|
|
||||||
static const struct ipm_driver_api ipm_mhu_driver_api = {
|
static const struct ipm_driver_api ipm_mhu_driver_api = {
|
||||||
|
@ -183,7 +183,7 @@ static const struct ipm_mhu_device_config ipm_mhu_cfg_0 = {
|
||||||
|
|
||||||
static struct ipm_mhu_data ipm_mhu_data_0 = {
|
static struct ipm_mhu_data ipm_mhu_data_0 = {
|
||||||
.callback = NULL,
|
.callback = NULL,
|
||||||
.callback_ctx = NULL,
|
.user_data = NULL,
|
||||||
};
|
};
|
||||||
|
|
||||||
DEVICE_AND_API_INIT(mhu_0,
|
DEVICE_AND_API_INIT(mhu_0,
|
||||||
|
@ -214,7 +214,7 @@ static const struct ipm_mhu_device_config ipm_mhu_cfg_1 = {
|
||||||
|
|
||||||
static struct ipm_mhu_data ipm_mhu_data_1 = {
|
static struct ipm_mhu_data ipm_mhu_data_1 = {
|
||||||
.callback = NULL,
|
.callback = NULL,
|
||||||
.callback_ctx = NULL,
|
.user_data = NULL,
|
||||||
};
|
};
|
||||||
|
|
||||||
DEVICE_AND_API_INIT(mhu_1,
|
DEVICE_AND_API_INIT(mhu_1,
|
||||||
|
|
|
@ -65,7 +65,7 @@ struct ipm_mhu_device_config {
|
||||||
/* Device data structure */
|
/* Device data structure */
|
||||||
struct ipm_mhu_data {
|
struct ipm_mhu_data {
|
||||||
ipm_callback_t callback;
|
ipm_callback_t callback;
|
||||||
void *callback_ctx;
|
void *user_data;
|
||||||
};
|
};
|
||||||
|
|
||||||
#ifdef __cplusplus
|
#ifdef __cplusplus
|
||||||
|
|
|
@ -17,7 +17,7 @@ LOG_MODULE_REGISTER(ipm_nrfx_ipc);
|
||||||
|
|
||||||
struct ipm_nrf_data {
|
struct ipm_nrf_data {
|
||||||
ipm_callback_t callback;
|
ipm_callback_t callback;
|
||||||
void *callback_ctx;
|
void *user_data;
|
||||||
};
|
};
|
||||||
|
|
||||||
static struct ipm_nrf_data nrfx_ipm_data;
|
static struct ipm_nrf_data nrfx_ipm_data;
|
||||||
|
@ -39,7 +39,7 @@ static void nrfx_ipc_handler(uint32_t event_mask, void *p_context)
|
||||||
"Illegal event_idx: %d", event_idx);
|
"Illegal event_idx: %d", event_idx);
|
||||||
event_mask &= ~BIT(event_idx);
|
event_mask &= ~BIT(event_idx);
|
||||||
nrfx_ipm_data.callback(DEVICE_GET(ipm_nrf),
|
nrfx_ipm_data.callback(DEVICE_GET(ipm_nrf),
|
||||||
nrfx_ipm_data.callback_ctx,
|
nrfx_ipm_data.user_data,
|
||||||
event_idx,
|
event_idx,
|
||||||
NULL);
|
NULL);
|
||||||
}
|
}
|
||||||
|
@ -77,10 +77,10 @@ static uint32_t ipm_nrf_max_id_val_get(struct device *dev)
|
||||||
|
|
||||||
static void ipm_nrf_register_callback(struct device *dev,
|
static void ipm_nrf_register_callback(struct device *dev,
|
||||||
ipm_callback_t cb,
|
ipm_callback_t cb,
|
||||||
void *context)
|
void *user_data)
|
||||||
{
|
{
|
||||||
nrfx_ipm_data.callback = cb;
|
nrfx_ipm_data.callback = cb;
|
||||||
nrfx_ipm_data.callback_ctx = context;
|
nrfx_ipm_data.user_data = user_data;
|
||||||
}
|
}
|
||||||
|
|
||||||
static int ipm_nrf_set_enabled(struct device *dev, int enable)
|
static int ipm_nrf_set_enabled(struct device *dev, int enable)
|
||||||
|
@ -119,7 +119,7 @@ DEVICE_AND_API_INIT(ipm_nrf, DT_INST_LABEL(0),
|
||||||
|
|
||||||
struct vipm_nrf_data {
|
struct vipm_nrf_data {
|
||||||
ipm_callback_t callback[NRFX_IPC_ID_MAX_VALUE];
|
ipm_callback_t callback[NRFX_IPC_ID_MAX_VALUE];
|
||||||
void *callback_ctx[NRFX_IPC_ID_MAX_VALUE];
|
void *user_data[NRFX_IPC_ID_MAX_VALUE];
|
||||||
struct device *ipm_device[NRFX_IPC_ID_MAX_VALUE];
|
struct device *ipm_device[NRFX_IPC_ID_MAX_VALUE];
|
||||||
bool ipm_init;
|
bool ipm_init;
|
||||||
};
|
};
|
||||||
|
@ -137,7 +137,7 @@ static void vipm_dispatcher(uint32_t event_mask, void *p_context)
|
||||||
if (nrfx_vipm_data.callback[event_idx] != NULL) {
|
if (nrfx_vipm_data.callback[event_idx] != NULL) {
|
||||||
nrfx_vipm_data.callback[event_idx]
|
nrfx_vipm_data.callback[event_idx]
|
||||||
(nrfx_vipm_data.ipm_device[event_idx],
|
(nrfx_vipm_data.ipm_device[event_idx],
|
||||||
nrfx_vipm_data.callback_ctx[event_idx],
|
nrfx_vipm_data.user_data[event_idx],
|
||||||
0,
|
0,
|
||||||
NULL);
|
NULL);
|
||||||
}
|
}
|
||||||
|
@ -194,11 +194,11 @@ static int vipm_nrf_##_idx##_send(struct device *dev, int wait, \
|
||||||
\
|
\
|
||||||
static void vipm_nrf_##_idx##_register_callback(struct device *dev, \
|
static void vipm_nrf_##_idx##_register_callback(struct device *dev, \
|
||||||
ipm_callback_t cb, \
|
ipm_callback_t cb, \
|
||||||
void *context) \
|
void *user_data) \
|
||||||
{ \
|
{ \
|
||||||
if (IS_ENABLED(CONFIG_IPM_MSG_CH_##_idx##_RX)) { \
|
if (IS_ENABLED(CONFIG_IPM_MSG_CH_##_idx##_RX)) { \
|
||||||
nrfx_vipm_data.callback[_idx] = cb; \
|
nrfx_vipm_data.callback[_idx] = cb; \
|
||||||
nrfx_vipm_data.callback_ctx[_idx] = context; \
|
nrfx_vipm_data.user_data[_idx] = user_data; \
|
||||||
nrfx_vipm_data.ipm_device[_idx] = dev; \
|
nrfx_vipm_data.ipm_device[_idx] = dev; \
|
||||||
} else { \
|
} else { \
|
||||||
LOG_WRN("Trying to register a callback" \
|
LOG_WRN("Trying to register a callback" \
|
||||||
|
|
|
@ -96,7 +96,7 @@ struct stm32_ipcc_mailbox_config {
|
||||||
struct stm32_ipcc_mbx_data {
|
struct stm32_ipcc_mbx_data {
|
||||||
uint32_t num_ch;
|
uint32_t num_ch;
|
||||||
ipm_callback_t callback;
|
ipm_callback_t callback;
|
||||||
void *callback_ctx;
|
void *user_data;
|
||||||
};
|
};
|
||||||
|
|
||||||
static struct stm32_ipcc_mbx_data stm32_IPCC_data;
|
static struct stm32_ipcc_mbx_data stm32_IPCC_data;
|
||||||
|
@ -122,7 +122,7 @@ static void stm32_ipcc_mailbox_rx_isr(void *arg)
|
||||||
|
|
||||||
if (data->callback) {
|
if (data->callback) {
|
||||||
/* Only one MAILBOX, id is unused and set to 0 */
|
/* Only one MAILBOX, id is unused and set to 0 */
|
||||||
data->callback(dev, data->callback_ctx, i, &value);
|
data->callback(dev, data->user_data, i, &value);
|
||||||
}
|
}
|
||||||
/* clear status to acknoledge message reception */
|
/* clear status to acknoledge message reception */
|
||||||
IPCC_ClearFlag_CHx(cfg->ipcc, i);
|
IPCC_ClearFlag_CHx(cfg->ipcc, i);
|
||||||
|
@ -203,12 +203,12 @@ static uint32_t stm32_ipcc_mailbox_ipm_max_id_val_get(struct device *d)
|
||||||
|
|
||||||
static void stm32_ipcc_mailbox_ipm_register_callback(struct device *d,
|
static void stm32_ipcc_mailbox_ipm_register_callback(struct device *d,
|
||||||
ipm_callback_t cb,
|
ipm_callback_t cb,
|
||||||
void *context)
|
void *user_data)
|
||||||
{
|
{
|
||||||
struct stm32_ipcc_mbx_data *data = DEV_DATA(d);
|
struct stm32_ipcc_mbx_data *data = DEV_DATA(d);
|
||||||
|
|
||||||
data->callback = cb;
|
data->callback = cb;
|
||||||
data->callback_ctx = context;
|
data->user_data = user_data;
|
||||||
}
|
}
|
||||||
|
|
||||||
static int stm32_ipcc_mailbox_ipm_set_enabled(struct device *dev, int enable)
|
static int stm32_ipcc_mailbox_ipm_set_enabled(struct device *dev, int enable)
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue