mirror of
https://github.com/Fishwaldo/Star64_linux.git
synced 2025-07-21 14:21:48 +00:00
dmaengine: prepare for generic 'unmap' data
Add a hook for a common dma unmap implementation to enable removal of the per driver custom unmap code. (A reworked version of Bartlomiej Zolnierkiewicz's patches to remove the custom callbacks and the size increase of dma_async_tx_descriptor for drivers that don't care about raid). Cc: Vinod Koul <vinod.koul@intel.com> Cc: Tomasz Figa <t.figa@samsung.com> Cc: Dave Jiang <dave.jiang@intel.com> [bzolnier: prepare pl330 driver for adding missing unmap while at it] Signed-off-by: Bartlomiej Zolnierkiewicz <b.zolnierkie@samsung.com> Signed-off-by: Kyungmin Park <kyungmin.park@samsung.com> Signed-off-by: Dan Williams <dan.j.williams@intel.com>
This commit is contained in:
parent
56ea27fd61
commit
d38a8c622a
15 changed files with 41 additions and 0 deletions
|
@ -413,6 +413,17 @@ void dma_chan_cleanup(struct kref *kref);
|
|||
typedef bool (*dma_filter_fn)(struct dma_chan *chan, void *filter_param);
|
||||
|
||||
typedef void (*dma_async_tx_callback)(void *dma_async_param);
|
||||
|
||||
struct dmaengine_unmap_data {
|
||||
u8 to_cnt;
|
||||
u8 from_cnt;
|
||||
u8 bidi_cnt;
|
||||
struct device *dev;
|
||||
struct kref kref;
|
||||
size_t len;
|
||||
dma_addr_t addr[0];
|
||||
};
|
||||
|
||||
/**
|
||||
* struct dma_async_tx_descriptor - async transaction descriptor
|
||||
* ---dma generic offload fields---
|
||||
|
@ -438,6 +449,7 @@ struct dma_async_tx_descriptor {
|
|||
dma_cookie_t (*tx_submit)(struct dma_async_tx_descriptor *tx);
|
||||
dma_async_tx_callback callback;
|
||||
void *callback_param;
|
||||
struct dmaengine_unmap_data *unmap;
|
||||
#ifdef CONFIG_ASYNC_TX_ENABLE_CHANNEL_SWITCH
|
||||
struct dma_async_tx_descriptor *next;
|
||||
struct dma_async_tx_descriptor *parent;
|
||||
|
@ -445,6 +457,20 @@ struct dma_async_tx_descriptor {
|
|||
#endif
|
||||
};
|
||||
|
||||
static inline void dma_set_unmap(struct dma_async_tx_descriptor *tx,
|
||||
struct dmaengine_unmap_data *unmap)
|
||||
{
|
||||
kref_get(&unmap->kref);
|
||||
tx->unmap = unmap;
|
||||
}
|
||||
|
||||
static inline void dma_descriptor_unmap(struct dma_async_tx_descriptor *tx)
|
||||
{
|
||||
if (tx->unmap) {
|
||||
tx->unmap = NULL;
|
||||
}
|
||||
}
|
||||
|
||||
#ifndef CONFIG_ASYNC_TX_ENABLE_CHANNEL_SWITCH
|
||||
static inline void txd_lock(struct dma_async_tx_descriptor *txd)
|
||||
{
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue