drivers: dma: Align all drivers using user_data for callback
s/callback_arg/user_data Signed-off-by: Tomasz Bursztyka <tomasz.bursztyka@linux.intel.com>
This commit is contained in:
parent
8144de1513
commit
1580768fd3
16 changed files with 44 additions and 44 deletions
|
@ -99,7 +99,7 @@ static void dw_dma_isr(void *arg)
|
|||
* all the blocks are transferred.
|
||||
*/
|
||||
chan_data->dma_blkcallback(dev,
|
||||
chan_data->blkcallback_arg,
|
||||
chan_data->blkuser_data,
|
||||
channel, 0);
|
||||
}
|
||||
}
|
||||
|
@ -110,7 +110,7 @@ static void dw_dma_isr(void *arg)
|
|||
chan_data = &dev_data->chan[channel];
|
||||
if (chan_data->dma_tfrcallback) {
|
||||
chan_data->dma_tfrcallback(dev,
|
||||
chan_data->tfrcallback_arg,
|
||||
chan_data->tfruser_data,
|
||||
channel, 0);
|
||||
}
|
||||
}
|
||||
|
@ -216,11 +216,11 @@ static int dw_dma_config(struct device *dev, uint32_t channel,
|
|||
*/
|
||||
if (cfg->complete_callback_en) {
|
||||
chan_data->dma_blkcallback = cfg->dma_callback;
|
||||
chan_data->blkcallback_arg = cfg->callback_arg;
|
||||
chan_data->blkuser_data = cfg->user_data;
|
||||
dw_write(dev_cfg->base, DW_MASK_BLOCK, INT_UNMASK(channel));
|
||||
} else {
|
||||
chan_data->dma_tfrcallback = cfg->dma_callback;
|
||||
chan_data->tfrcallback_arg = cfg->callback_arg;
|
||||
chan_data->tfruser_data = cfg->user_data;
|
||||
dw_write(dev_cfg->base, DW_MASK_TFR, INT_UNMASK(channel));
|
||||
}
|
||||
|
||||
|
|
|
@ -31,9 +31,9 @@ extern "C" {
|
|||
/* data for each DMA channel */
|
||||
struct dma_chan_data {
|
||||
uint32_t direction;
|
||||
void *blkcallback_arg;
|
||||
void *blkuser_data;
|
||||
dma_callback_t dma_blkcallback;
|
||||
void *tfrcallback_arg;
|
||||
void *tfruser_data;
|
||||
dma_callback_t dma_tfrcallback;
|
||||
};
|
||||
|
||||
|
|
|
@ -38,7 +38,7 @@ struct call_back {
|
|||
edma_transfer_config_t transferConfig;
|
||||
edma_handle_t edma_handle;
|
||||
struct device *dev;
|
||||
void *callback_arg;
|
||||
void *user_data;
|
||||
dma_callback_t dma_callback;
|
||||
enum dma_channel_direction dir;
|
||||
bool busy;
|
||||
|
@ -73,7 +73,7 @@ static void nxp_edma_callback(edma_handle_t *handle, void *param,
|
|||
ret = 0;
|
||||
}
|
||||
LOG_DBG("transfer %d", tcds);
|
||||
data->dma_callback(data->dev, data->callback_arg, channel, ret);
|
||||
data->dma_callback(data->dev, data->user_data, channel, ret);
|
||||
}
|
||||
|
||||
static void channel_irq(edma_handle_t *handle)
|
||||
|
@ -328,7 +328,7 @@ static int dma_mcux_edma_configure(struct device *dev, uint32_t channel,
|
|||
data->busy = false;
|
||||
if (config->dma_callback) {
|
||||
LOG_DBG("INSTALL call back on channel %d", channel);
|
||||
data->callback_arg = config->callback_arg;
|
||||
data->user_data = config->user_data;
|
||||
data->dma_callback = config->dma_callback;
|
||||
data->dev = dev;
|
||||
}
|
||||
|
|
|
@ -25,7 +25,7 @@ struct nios2_msgdma_dev_cfg {
|
|||
alt_msgdma_standard_descriptor desc;
|
||||
uint32_t direction;
|
||||
struct k_sem sem_lock;
|
||||
void *callback_arg;
|
||||
void *user_data;
|
||||
dma_callback_t dma_callback;
|
||||
};
|
||||
|
||||
|
@ -61,7 +61,7 @@ static void nios2_msgdma_callback(void *context)
|
|||
|
||||
LOG_DBG("msgdma csr status Reg: 0x%x", status);
|
||||
|
||||
dev_cfg->dma_callback(dev, dev_cfg->callback_arg, 0, err_code);
|
||||
dev_cfg->dma_callback(dev, dev_cfg->user_data, 0, err_code);
|
||||
}
|
||||
|
||||
static int nios2_msgdma_config(struct device *dev, uint32_t channel,
|
||||
|
@ -103,7 +103,7 @@ static int nios2_msgdma_config(struct device *dev, uint32_t channel,
|
|||
|
||||
k_sem_take(&dev_cfg->sem_lock, K_FOREVER);
|
||||
dev_cfg->dma_callback = cfg->dma_callback;
|
||||
dev_cfg->callback_arg = cfg->callback_arg;
|
||||
dev_cfg->user_data = cfg->user_data;
|
||||
dev_cfg->direction = cfg->channel_direction;
|
||||
dma_block = cfg->head_block;
|
||||
control = ALTERA_MSGDMA_DESCRIPTOR_CONTROL_TRANSFER_COMPLETE_IRQ_MASK |
|
||||
|
|
|
@ -500,7 +500,7 @@ static int dma_pl330_configure(struct device *dev, uint32_t channel,
|
|||
channel_cfg->trans_size = cfg->head_block->block_size;
|
||||
|
||||
channel_cfg->dma_callback = cfg->dma_callback;
|
||||
channel_cfg->callback_arg = cfg->callback_arg;
|
||||
channel_cfg->user_data = cfg->user_data;
|
||||
|
||||
if (cfg->head_block->source_addr_adj == DMA_ADDR_ADJ_INCREMENT ||
|
||||
cfg->head_block->source_addr_adj == DMA_ADDR_ADJ_NO_CHANGE) {
|
||||
|
@ -536,7 +536,7 @@ static int dma_pl330_transfer_start(struct device *dev, uint32_t channel)
|
|||
|
||||
/* Execute callback */
|
||||
if (channel_cfg->dma_callback) {
|
||||
channel_cfg->dma_callback(dev, channel_cfg->callback_arg,
|
||||
channel_cfg->dma_callback(dev, channel_cfg->user_data,
|
||||
channel, ret);
|
||||
}
|
||||
|
||||
|
|
|
@ -141,7 +141,7 @@ struct dma_pl330_ch_config {
|
|||
enum dma_addr_adj dst_addr_adj;
|
||||
enum dma_channel_direction direction;
|
||||
uint32_t trans_size;
|
||||
void *callback_arg;
|
||||
void *user_data;
|
||||
dma_callback_t dma_callback;
|
||||
uint32_t dma_exe_addr;
|
||||
struct k_mutex ch_mutex;
|
||||
|
|
|
@ -17,7 +17,7 @@ LOG_MODULE_REGISTER(dma_sam0, CONFIG_DMA_LOG_LEVEL);
|
|||
|
||||
struct dma_sam0_channel {
|
||||
dma_callback_t cb;
|
||||
void *cb_arg;
|
||||
void *user_data;
|
||||
};
|
||||
|
||||
struct dma_sam0_data {
|
||||
|
@ -47,12 +47,12 @@ static void dma_sam0_isr(void *arg)
|
|||
|
||||
if (pend & DMAC_INTPEND_TERR) {
|
||||
if (chdata->cb) {
|
||||
chdata->cb(dev, chdata->cb_arg,
|
||||
chdata->cb(dev, chdata->user_data,
|
||||
channel, -DMAC_INTPEND_TERR);
|
||||
}
|
||||
} else if (pend & DMAC_INTPEND_TCMPL) {
|
||||
if (chdata->cb) {
|
||||
chdata->cb(dev, chdata->cb_arg, channel, 0);
|
||||
chdata->cb(dev, chdata->user_data, channel, 0);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -249,7 +249,7 @@ static int dma_sam0_config(struct device *dev, uint32_t channel,
|
|||
|
||||
channel_control = &data->channels[channel];
|
||||
channel_control->cb = config->dma_callback;
|
||||
channel_control->cb_arg = config->callback_arg;
|
||||
channel_control->user_data = config->user_data;
|
||||
|
||||
LOG_DBG("Configured channel %d for %08X to %08X (%u)",
|
||||
channel,
|
||||
|
|
|
@ -28,7 +28,7 @@ LOG_MODULE_REGISTER(dma_sam_xdmac);
|
|||
|
||||
/* DMA channel configuration */
|
||||
struct sam_xdmac_channel_cfg {
|
||||
void *callback_arg;
|
||||
void *user_data;
|
||||
dma_callback_t callback;
|
||||
};
|
||||
|
||||
|
@ -76,7 +76,7 @@ static void sam_xdmac_isr(void *arg)
|
|||
|
||||
/* Execute callback */
|
||||
if (channel_cfg->callback) {
|
||||
channel_cfg->callback(dev, channel_cfg->callback_arg,
|
||||
channel_cfg->callback(dev, channel_cfg->user_data,
|
||||
channel, err);
|
||||
}
|
||||
}
|
||||
|
@ -258,7 +258,7 @@ static int sam_xdmac_config(struct device *dev, uint32_t channel,
|
|||
}
|
||||
|
||||
dev_data->dma_channels[channel].callback = cfg->dma_callback;
|
||||
dev_data->dma_channels[channel].callback_arg = cfg->callback_arg;
|
||||
dev_data->dma_channels[channel].user_data = cfg->user_data;
|
||||
|
||||
(void)memset(&transfer_cfg, 0, sizeof(transfer_cfg));
|
||||
transfer_cfg.sa = cfg->head_block->source_address;
|
||||
|
|
|
@ -90,20 +90,20 @@ static void dma_stm32_irq_handler(void *arg)
|
|||
#ifdef CONFIG_DMAMUX_STM32
|
||||
stream->busy = false;
|
||||
/* the callback function expects the dmamux channel nb */
|
||||
stream->dma_callback(dev, stream->callback_arg,
|
||||
stream->dma_callback(dev, stream->user_data,
|
||||
stream->mux_channel, 0);
|
||||
#else
|
||||
stream->dma_callback(dev, stream->callback_arg,
|
||||
stream->dma_callback(dev, stream->user_data,
|
||||
id + STREAM_OFFSET, 0);
|
||||
#endif /* CONFIG_DMAMUX_STM32 */
|
||||
} else if (stm32_dma_is_unexpected_irq_happened(dma, id)) {
|
||||
LOG_ERR("Unexpected irq happened.");
|
||||
|
||||
#ifdef CONFIG_DMAMUX_STM32
|
||||
stream->dma_callback(dev, stream->callback_arg,
|
||||
stream->dma_callback(dev, stream->user_data,
|
||||
stream->mux_channel, -EIO);
|
||||
#else
|
||||
stream->dma_callback(dev, stream->callback_arg,
|
||||
stream->dma_callback(dev, stream->user_data,
|
||||
id + STREAM_OFFSET, -EIO);
|
||||
#endif /* CONFIG_DMAMUX_STM32 */
|
||||
} else {
|
||||
|
@ -112,10 +112,10 @@ static void dma_stm32_irq_handler(void *arg)
|
|||
dma_stm32_clear_stream_irq(dev, id);
|
||||
|
||||
#ifdef CONFIG_DMAMUX_STM32
|
||||
stream->dma_callback(dev, stream->callback_arg,
|
||||
stream->dma_callback(dev, stream->user_data,
|
||||
stream->mux_channel, -EIO);
|
||||
#else
|
||||
stream->dma_callback(dev, stream->callback_arg,
|
||||
stream->dma_callback(dev, stream->user_data,
|
||||
id + STREAM_OFFSET, -EIO);
|
||||
#endif /* CONFIG_DMAMUX_STM32 */
|
||||
}
|
||||
|
@ -310,7 +310,7 @@ static int dma_stm32_configure(struct device *dev, uint32_t id,
|
|||
stream->busy = true;
|
||||
stream->dma_callback = config->dma_callback;
|
||||
stream->direction = config->channel_direction;
|
||||
stream->callback_arg = config->callback_arg;
|
||||
stream->user_data = config->user_data;
|
||||
stream->src_size = config->source_data_size;
|
||||
stream->dst_size = config->dest_data_size;
|
||||
|
||||
|
|
|
@ -19,7 +19,7 @@ struct dma_stm32_stream {
|
|||
bool busy;
|
||||
uint32_t src_size;
|
||||
uint32_t dst_size;
|
||||
void *callback_arg; /* holds the client data */
|
||||
void *user_data; /* holds the client data */
|
||||
dma_callback_t dma_callback;
|
||||
};
|
||||
|
||||
|
|
|
@ -248,7 +248,7 @@ static bool i2c_sam0_dma_write_start(struct device *dev)
|
|||
dma_cfg.channel_direction = MEMORY_TO_PERIPHERAL;
|
||||
dma_cfg.source_data_size = 1;
|
||||
dma_cfg.dest_data_size = 1;
|
||||
dma_cfg.callback_arg = dev;
|
||||
dma_cfg.user_data = dev;
|
||||
dma_cfg.dma_callback = i2c_sam0_dma_write_done;
|
||||
dma_cfg.block_count = 1;
|
||||
dma_cfg.head_block = &dma_blk;
|
||||
|
@ -345,7 +345,7 @@ static bool i2c_sam0_dma_read_start(struct device *dev)
|
|||
dma_cfg.channel_direction = PERIPHERAL_TO_MEMORY;
|
||||
dma_cfg.source_data_size = 1;
|
||||
dma_cfg.dest_data_size = 1;
|
||||
dma_cfg.callback_arg = dev;
|
||||
dma_cfg.user_data = dev;
|
||||
dma_cfg.dma_callback = i2c_sam0_dma_read_done;
|
||||
dma_cfg.block_count = 1;
|
||||
dma_cfg.head_block = &dma_blk;
|
||||
|
|
|
@ -63,7 +63,7 @@ LOG_MODULE_REGISTER(LOG_DOMAIN);
|
|||
.source_burst_length = CAVS_I2S_DMA_BURST_SIZE,\
|
||||
.dest_burst_length = CAVS_I2S_DMA_BURST_SIZE,\
|
||||
.dma_callback = i2s_dma_tx_callback, \
|
||||
.callback_arg = I2S_DEVICE_OBJECT(i2s_id),\
|
||||
.user_data = I2S_DEVICE_OBJECT(i2s_id),\
|
||||
.complete_callback_en = 1, \
|
||||
.error_callback_en = 1, \
|
||||
.block_count = 1, \
|
||||
|
@ -79,7 +79,7 @@ LOG_MODULE_REGISTER(LOG_DOMAIN);
|
|||
.source_burst_length = CAVS_I2S_DMA_BURST_SIZE,\
|
||||
.dest_burst_length = CAVS_I2S_DMA_BURST_SIZE,\
|
||||
.dma_callback = i2s_dma_rx_callback,\
|
||||
.callback_arg = I2S_DEVICE_OBJECT(i2s_id),\
|
||||
.user_data = I2S_DEVICE_OBJECT(i2s_id),\
|
||||
.complete_callback_en = 1, \
|
||||
.error_callback_en = 1, \
|
||||
.block_count = 1, \
|
||||
|
|
|
@ -186,7 +186,7 @@ static int start_dma(struct device *dev_dma, uint32_t channel,
|
|||
}
|
||||
|
||||
/* This function is executed in the interrupt context */
|
||||
static void dma_rx_callback(struct device *dma_dev, void *callback_arg,
|
||||
static void dma_rx_callback(struct device *dma_dev, void *user_data,
|
||||
uint32_t channel, int status)
|
||||
{
|
||||
struct device *dev = get_dev_from_dma_channel(channel);
|
||||
|
@ -196,7 +196,7 @@ static void dma_rx_callback(struct device *dma_dev, void *callback_arg,
|
|||
struct stream *stream = &dev_data->rx;
|
||||
int ret;
|
||||
|
||||
ARG_UNUSED(callback_arg);
|
||||
ARG_UNUSED(user_data);
|
||||
__ASSERT_NO_MSG(stream->mem_block != NULL);
|
||||
|
||||
/* Stop reception if there was an error */
|
||||
|
@ -246,7 +246,7 @@ rx_disable:
|
|||
}
|
||||
|
||||
/* This function is executed in the interrupt context */
|
||||
static void dma_tx_callback(struct device *dma_dev, void *callback_arg,
|
||||
static void dma_tx_callback(struct device *dma_dev, void *user_data,
|
||||
uint32_t channel, int status)
|
||||
{
|
||||
struct device *dev = get_dev_from_dma_channel(channel);
|
||||
|
@ -257,7 +257,7 @@ static void dma_tx_callback(struct device *dma_dev, void *callback_arg,
|
|||
size_t mem_block_size;
|
||||
int ret;
|
||||
|
||||
ARG_UNUSED(callback_arg);
|
||||
ARG_UNUSED(user_data);
|
||||
__ASSERT_NO_MSG(stream->mem_block != NULL);
|
||||
|
||||
/* All block data sent */
|
||||
|
|
|
@ -581,7 +581,7 @@ static int uart_sam0_init(struct device *dev)
|
|||
dma_cfg.channel_direction = MEMORY_TO_PERIPHERAL;
|
||||
dma_cfg.source_data_size = 1;
|
||||
dma_cfg.dest_data_size = 1;
|
||||
dma_cfg.callback_arg = dev;
|
||||
dma_cfg.user_data = dev;
|
||||
dma_cfg.dma_callback = uart_sam0_dma_tx_done;
|
||||
dma_cfg.block_count = 1;
|
||||
dma_cfg.head_block = &dma_blk;
|
||||
|
@ -609,7 +609,7 @@ static int uart_sam0_init(struct device *dev)
|
|||
dma_cfg.channel_direction = PERIPHERAL_TO_MEMORY;
|
||||
dma_cfg.source_data_size = 1;
|
||||
dma_cfg.dest_data_size = 1;
|
||||
dma_cfg.callback_arg = dev;
|
||||
dma_cfg.user_data = dev;
|
||||
dma_cfg.dma_callback = uart_sam0_dma_rx_done;
|
||||
dma_cfg.block_count = 1;
|
||||
dma_cfg.head_block = &dma_blk;
|
||||
|
|
|
@ -60,7 +60,7 @@ uint32_t nop_tx;
|
|||
static void dma_callback(struct device *dev, void *arg,
|
||||
uint32_t channel, int status)
|
||||
{
|
||||
/* callback_arg directly holds the client data */
|
||||
/* arg directly holds the client data */
|
||||
struct spi_stm32_data *data = arg;
|
||||
|
||||
if (status != 0) {
|
||||
|
@ -129,7 +129,7 @@ static int spi_stm32_dma_tx_load(struct device *dev, const uint8_t *buf,
|
|||
/* direction is given by the DT */
|
||||
stream->dma_cfg.head_block = &blk_cfg;
|
||||
/* give the client data as arg, as the callback comes from the dma */
|
||||
stream->dma_cfg.callback_arg = data;
|
||||
stream->dma_cfg.user_data = data;
|
||||
/* pass our client origin to the dma: data->dma_tx.dma_channel */
|
||||
ret = dma_config(data->dev_dma_tx, data->dma_tx.channel,
|
||||
&stream->dma_cfg);
|
||||
|
@ -178,7 +178,7 @@ static int spi_stm32_dma_rx_load(struct device *dev, uint8_t *buf, size_t len)
|
|||
|
||||
/* direction is given by the DT */
|
||||
stream->dma_cfg.head_block = &blk_cfg;
|
||||
stream->dma_cfg.callback_arg = data;
|
||||
stream->dma_cfg.user_data = data;
|
||||
|
||||
|
||||
/* pass our client origin to the dma: data->dma_rx.channel */
|
||||
|
|
|
@ -452,7 +452,7 @@ static int spi_sam0_dma_rx_load(struct device *dev, uint8_t *buf,
|
|||
dma_cfg.channel_direction = PERIPHERAL_TO_MEMORY;
|
||||
dma_cfg.source_data_size = 1;
|
||||
dma_cfg.dest_data_size = 1;
|
||||
dma_cfg.callback_arg = dev;
|
||||
dma_cfg.user_data = dev;
|
||||
dma_cfg.dma_callback = spi_sam0_dma_rx_done;
|
||||
dma_cfg.block_count = 1;
|
||||
dma_cfg.head_block = &dma_blk;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue