Skip to content

Commit 185ecb5

Browse files
Alexandre BounineVinod Koul
authored andcommitted
dmaengine: add context parameter to prep_slave_sg and prep_dma_cyclic
Add context parameter to device_prep_slave_sg() and device_prep_dma_cyclic() interfaces to allow passing client/target specific information associated with the data transfer. Modify all affected DMA engine drivers. Signed-off-by: Alexandre Bounine <[email protected]> Acked-by: Linus Walleij <[email protected]> Acked-by: Felipe Balbi <[email protected]> Signed-off-by: Vinod Koul <[email protected]>
1 parent 1605282 commit 185ecb5

19 files changed

+49
-30
lines changed

drivers/dma/amba-pl08x.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1313,7 +1313,7 @@ static struct dma_async_tx_descriptor *pl08x_prep_dma_memcpy(
13131313
static struct dma_async_tx_descriptor *pl08x_prep_slave_sg(
13141314
struct dma_chan *chan, struct scatterlist *sgl,
13151315
unsigned int sg_len, enum dma_transfer_direction direction,
1316-
unsigned long flags)
1316+
unsigned long flags, void *context)
13171317
{
13181318
struct pl08x_dma_chan *plchan = to_pl08x_chan(chan);
13191319
struct pl08x_driver_data *pl08x = plchan->host;

drivers/dma/at_hdmac.c

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -639,11 +639,12 @@ atc_prep_dma_memcpy(struct dma_chan *chan, dma_addr_t dest, dma_addr_t src,
639639
* @sg_len: number of entries in @scatterlist
640640
* @direction: DMA direction
641641
* @flags: tx descriptor status flags
642+
* @context: transaction context (ignored)
642643
*/
643644
static struct dma_async_tx_descriptor *
644645
atc_prep_slave_sg(struct dma_chan *chan, struct scatterlist *sgl,
645646
unsigned int sg_len, enum dma_transfer_direction direction,
646-
unsigned long flags)
647+
unsigned long flags, void *context)
647648
{
648649
struct at_dma_chan *atchan = to_at_dma_chan(chan);
649650
struct at_dma_slave *atslave = chan->private;
@@ -840,10 +841,12 @@ atc_dma_cyclic_fill_desc(struct at_dma_slave *atslave, struct at_desc *desc,
840841
* @buf_len: total number of bytes for the entire buffer
841842
* @period_len: number of bytes for each period
842843
* @direction: transfer direction, to or from device
844+
* @context: transfer context (ignored)
843845
*/
844846
static struct dma_async_tx_descriptor *
845847
atc_prep_dma_cyclic(struct dma_chan *chan, dma_addr_t buf_addr, size_t buf_len,
846-
size_t period_len, enum dma_transfer_direction direction)
848+
size_t period_len, enum dma_transfer_direction direction,
849+
void *context)
847850
{
848851
struct at_dma_chan *atchan = to_at_dma_chan(chan);
849852
struct at_dma_slave *atslave = chan->private;

drivers/dma/coh901318.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1021,7 +1021,7 @@ coh901318_prep_memcpy(struct dma_chan *chan, dma_addr_t dest, dma_addr_t src,
10211021
static struct dma_async_tx_descriptor *
10221022
coh901318_prep_slave_sg(struct dma_chan *chan, struct scatterlist *sgl,
10231023
unsigned int sg_len, enum dma_transfer_direction direction,
1024-
unsigned long flags)
1024+
unsigned long flags, void *context)
10251025
{
10261026
struct coh901318_chan *cohc = to_coh901318_chan(chan);
10271027
struct coh901318_lli *lli;

drivers/dma/dw_dmac.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -704,7 +704,7 @@ dwc_prep_dma_memcpy(struct dma_chan *chan, dma_addr_t dest, dma_addr_t src,
704704
static struct dma_async_tx_descriptor *
705705
dwc_prep_slave_sg(struct dma_chan *chan, struct scatterlist *sgl,
706706
unsigned int sg_len, enum dma_transfer_direction direction,
707-
unsigned long flags)
707+
unsigned long flags, void *context)
708708
{
709709
struct dw_dma_chan *dwc = to_dw_dma_chan(chan);
710710
struct dw_dma_slave *dws = chan->private;

drivers/dma/ep93xx_dma.c

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -975,13 +975,14 @@ ep93xx_dma_prep_dma_memcpy(struct dma_chan *chan, dma_addr_t dest,
975975
* @sg_len: number of entries in @sgl
976976
* @dir: direction of tha DMA transfer
977977
* @flags: flags for the descriptor
978+
* @context: operation context (ignored)
978979
*
979980
* Returns a valid DMA descriptor or %NULL in case of failure.
980981
*/
981982
static struct dma_async_tx_descriptor *
982983
ep93xx_dma_prep_slave_sg(struct dma_chan *chan, struct scatterlist *sgl,
983984
unsigned int sg_len, enum dma_transfer_direction dir,
984-
unsigned long flags)
985+
unsigned long flags, void *context)
985986
{
986987
struct ep93xx_dma_chan *edmac = to_ep93xx_dma_chan(chan);
987988
struct ep93xx_dma_desc *desc, *first;
@@ -1048,6 +1049,7 @@ ep93xx_dma_prep_slave_sg(struct dma_chan *chan, struct scatterlist *sgl,
10481049
* @buf_len: length of the buffer (in bytes)
10491050
* @period_len: lenght of a single period
10501051
* @dir: direction of the operation
1052+
* @context: operation context (ignored)
10511053
*
10521054
* Prepares a descriptor for cyclic DMA operation. This means that once the
10531055
* descriptor is submitted, we will be submitting in a @period_len sized
@@ -1060,7 +1062,7 @@ ep93xx_dma_prep_slave_sg(struct dma_chan *chan, struct scatterlist *sgl,
10601062
static struct dma_async_tx_descriptor *
10611063
ep93xx_dma_prep_dma_cyclic(struct dma_chan *chan, dma_addr_t dma_addr,
10621064
size_t buf_len, size_t period_len,
1063-
enum dma_transfer_direction dir)
1065+
enum dma_transfer_direction dir, void *context)
10641066
{
10651067
struct ep93xx_dma_chan *edmac = to_ep93xx_dma_chan(chan);
10661068
struct ep93xx_dma_desc *desc, *first;

drivers/dma/fsldma.c

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -759,14 +759,16 @@ static struct dma_async_tx_descriptor *fsl_dma_prep_sg(struct dma_chan *dchan,
759759
* @sg_len: number of entries in @scatterlist
760760
* @direction: DMA direction
761761
* @flags: DMAEngine flags
762+
* @context: transaction context (ignored)
762763
*
763764
* Prepare a set of descriptors for a DMA_SLAVE transaction. Following the
764765
* DMA_SLAVE API, this gets the device-specific information from the
765766
* chan->private variable.
766767
*/
767768
static struct dma_async_tx_descriptor *fsl_dma_prep_slave_sg(
768769
struct dma_chan *dchan, struct scatterlist *sgl, unsigned int sg_len,
769-
enum dma_transfer_direction direction, unsigned long flags)
770+
enum dma_transfer_direction direction, unsigned long flags,
771+
void *context)
770772
{
771773
/*
772774
* This operation is not supported on the Freescale DMA controller

drivers/dma/imx-dma.c

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -354,7 +354,7 @@ static void imxdma_free_chan_resources(struct dma_chan *chan)
354354
static struct dma_async_tx_descriptor *imxdma_prep_slave_sg(
355355
struct dma_chan *chan, struct scatterlist *sgl,
356356
unsigned int sg_len, enum dma_transfer_direction direction,
357-
unsigned long flags)
357+
unsigned long flags, void *context)
358358
{
359359
struct imxdma_channel *imxdmac = to_imxdma_chan(chan);
360360
struct scatterlist *sg;
@@ -405,7 +405,8 @@ static struct dma_async_tx_descriptor *imxdma_prep_slave_sg(
405405

406406
static struct dma_async_tx_descriptor *imxdma_prep_dma_cyclic(
407407
struct dma_chan *chan, dma_addr_t dma_addr, size_t buf_len,
408-
size_t period_len, enum dma_transfer_direction direction)
408+
size_t period_len, enum dma_transfer_direction direction,
409+
void *context)
409410
{
410411
struct imxdma_channel *imxdmac = to_imxdma_chan(chan);
411412
struct imxdma_engine *imxdma = imxdmac->imxdma;

drivers/dma/imx-sdma.c

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -903,7 +903,7 @@ static void sdma_free_chan_resources(struct dma_chan *chan)
903903
static struct dma_async_tx_descriptor *sdma_prep_slave_sg(
904904
struct dma_chan *chan, struct scatterlist *sgl,
905905
unsigned int sg_len, enum dma_transfer_direction direction,
906-
unsigned long flags)
906+
unsigned long flags, void *context)
907907
{
908908
struct sdma_channel *sdmac = to_sdma_chan(chan);
909909
struct sdma_engine *sdma = sdmac->sdma;
@@ -1001,7 +1001,8 @@ static struct dma_async_tx_descriptor *sdma_prep_slave_sg(
10011001

10021002
static struct dma_async_tx_descriptor *sdma_prep_dma_cyclic(
10031003
struct dma_chan *chan, dma_addr_t dma_addr, size_t buf_len,
1004-
size_t period_len, enum dma_transfer_direction direction)
1004+
size_t period_len, enum dma_transfer_direction direction,
1005+
void *context)
10051006
{
10061007
struct sdma_channel *sdmac = to_sdma_chan(chan);
10071008
struct sdma_engine *sdma = sdmac->sdma;

drivers/dma/intel_mid_dma.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -714,13 +714,14 @@ static struct dma_async_tx_descriptor *intel_mid_dma_prep_memcpy(
714714
* @sg_len: length of sg txn
715715
* @direction: DMA transfer dirtn
716716
* @flags: DMA flags
717+
* @context: transfer context (ignored)
717718
*
718719
* Prepares LLI based periphral transfer
719720
*/
720721
static struct dma_async_tx_descriptor *intel_mid_dma_prep_slave_sg(
721722
struct dma_chan *chan, struct scatterlist *sgl,
722723
unsigned int sg_len, enum dma_transfer_direction direction,
723-
unsigned long flags)
724+
unsigned long flags, void *context)
724725
{
725726
struct intel_mid_dma_chan *midc = NULL;
726727
struct intel_mid_dma_slave *mids = NULL;

drivers/dma/ipu/ipu_idmac.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1335,7 +1335,8 @@ static void ipu_gc_tasklet(unsigned long arg)
13351335
/* Allocate and initialise a transfer descriptor. */
13361336
static struct dma_async_tx_descriptor *idmac_prep_slave_sg(struct dma_chan *chan,
13371337
struct scatterlist *sgl, unsigned int sg_len,
1338-
enum dma_transfer_direction direction, unsigned long tx_flags)
1338+
enum dma_transfer_direction direction, unsigned long tx_flags,
1339+
void *context)
13391340
{
13401341
struct idmac_channel *ichan = to_idmac_chan(chan);
13411342
struct idmac_tx_desc *desc = NULL;

drivers/dma/mxs-dma.c

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -340,7 +340,7 @@ static void mxs_dma_free_chan_resources(struct dma_chan *chan)
340340
static struct dma_async_tx_descriptor *mxs_dma_prep_slave_sg(
341341
struct dma_chan *chan, struct scatterlist *sgl,
342342
unsigned int sg_len, enum dma_transfer_direction direction,
343-
unsigned long append)
343+
unsigned long append, void *context)
344344
{
345345
struct mxs_dma_chan *mxs_chan = to_mxs_dma_chan(chan);
346346
struct mxs_dma_engine *mxs_dma = mxs_chan->mxs_dma;
@@ -435,7 +435,8 @@ static struct dma_async_tx_descriptor *mxs_dma_prep_slave_sg(
435435

436436
static struct dma_async_tx_descriptor *mxs_dma_prep_dma_cyclic(
437437
struct dma_chan *chan, dma_addr_t dma_addr, size_t buf_len,
438-
size_t period_len, enum dma_transfer_direction direction)
438+
size_t period_len, enum dma_transfer_direction direction,
439+
void *context)
439440
{
440441
struct mxs_dma_chan *mxs_chan = to_mxs_dma_chan(chan);
441442
struct mxs_dma_engine *mxs_dma = mxs_chan->mxs_dma;

drivers/dma/pch_dma.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -587,7 +587,8 @@ static void pd_issue_pending(struct dma_chan *chan)
587587

588588
static struct dma_async_tx_descriptor *pd_prep_slave_sg(struct dma_chan *chan,
589589
struct scatterlist *sgl, unsigned int sg_len,
590-
enum dma_transfer_direction direction, unsigned long flags)
590+
enum dma_transfer_direction direction, unsigned long flags,
591+
void *context)
591592
{
592593
struct pch_dma_chan *pd_chan = to_pd_chan(chan);
593594
struct pch_dma_slave *pd_slave = chan->private;

drivers/dma/pl330.c

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2685,7 +2685,8 @@ static inline int get_burst_len(struct dma_pl330_desc *desc, size_t len)
26852685

26862686
static struct dma_async_tx_descriptor *pl330_prep_dma_cyclic(
26872687
struct dma_chan *chan, dma_addr_t dma_addr, size_t len,
2688-
size_t period_len, enum dma_transfer_direction direction)
2688+
size_t period_len, enum dma_transfer_direction direction,
2689+
void *context)
26892690
{
26902691
struct dma_pl330_desc *desc;
26912692
struct dma_pl330_chan *pch = to_pchan(chan);
@@ -2775,7 +2776,7 @@ pl330_prep_dma_memcpy(struct dma_chan *chan, dma_addr_t dst,
27752776
static struct dma_async_tx_descriptor *
27762777
pl330_prep_slave_sg(struct dma_chan *chan, struct scatterlist *sgl,
27772778
unsigned int sg_len, enum dma_transfer_direction direction,
2778-
unsigned long flg)
2779+
unsigned long flg, void *context)
27792780
{
27802781
struct dma_pl330_desc *first, *desc = NULL;
27812782
struct dma_pl330_chan *pch = to_pchan(chan);

drivers/dma/shdma.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -669,7 +669,8 @@ static struct dma_async_tx_descriptor *sh_dmae_prep_memcpy(
669669

670670
static struct dma_async_tx_descriptor *sh_dmae_prep_slave_sg(
671671
struct dma_chan *chan, struct scatterlist *sgl, unsigned int sg_len,
672-
enum dma_transfer_direction direction, unsigned long flags)
672+
enum dma_transfer_direction direction, unsigned long flags,
673+
void *context)
673674
{
674675
struct sh_dmae_slave *param;
675676
struct sh_dmae_chan *sh_chan;

drivers/dma/sirf-dma.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -489,7 +489,7 @@ static struct dma_async_tx_descriptor *sirfsoc_dma_prep_interleaved(
489489
static struct dma_async_tx_descriptor *
490490
sirfsoc_dma_prep_cyclic(struct dma_chan *chan, dma_addr_t addr,
491491
size_t buf_len, size_t period_len,
492-
enum dma_transfer_direction direction)
492+
enum dma_transfer_direction direction, void *context)
493493
{
494494
struct sirfsoc_dma_chan *schan = dma_chan_to_sirfsoc_dma_chan(chan);
495495
struct sirfsoc_dma_desc *sdesc = NULL;

drivers/dma/ste_dma40.c

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2289,7 +2289,8 @@ static struct dma_async_tx_descriptor *d40_prep_slave_sg(struct dma_chan *chan,
22892289
struct scatterlist *sgl,
22902290
unsigned int sg_len,
22912291
enum dma_transfer_direction direction,
2292-
unsigned long dma_flags)
2292+
unsigned long dma_flags,
2293+
void *context)
22932294
{
22942295
if (direction != DMA_DEV_TO_MEM && direction != DMA_MEM_TO_DEV)
22952296
return NULL;
@@ -2300,7 +2301,7 @@ static struct dma_async_tx_descriptor *d40_prep_slave_sg(struct dma_chan *chan,
23002301
static struct dma_async_tx_descriptor *
23012302
dma40_prep_dma_cyclic(struct dma_chan *chan, dma_addr_t dma_addr,
23022303
size_t buf_len, size_t period_len,
2303-
enum dma_transfer_direction direction)
2304+
enum dma_transfer_direction direction, void *context)
23042305
{
23052306
unsigned int periods = buf_len / period_len;
23062307
struct dma_async_tx_descriptor *txd;

drivers/dma/timb_dma.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -542,7 +542,8 @@ static void td_issue_pending(struct dma_chan *chan)
542542

543543
static struct dma_async_tx_descriptor *td_prep_slave_sg(struct dma_chan *chan,
544544
struct scatterlist *sgl, unsigned int sg_len,
545-
enum dma_transfer_direction direction, unsigned long flags)
545+
enum dma_transfer_direction direction, unsigned long flags,
546+
void *context)
546547
{
547548
struct timb_dma_chan *td_chan =
548549
container_of(chan, struct timb_dma_chan, chan);

drivers/dma/txx9dmac.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -833,7 +833,7 @@ txx9dmac_prep_dma_memcpy(struct dma_chan *chan, dma_addr_t dest, dma_addr_t src,
833833
static struct dma_async_tx_descriptor *
834834
txx9dmac_prep_slave_sg(struct dma_chan *chan, struct scatterlist *sgl,
835835
unsigned int sg_len, enum dma_transfer_direction direction,
836-
unsigned long flags)
836+
unsigned long flags, void *context)
837837
{
838838
struct txx9dmac_chan *dc = to_txx9dmac_chan(chan);
839839
struct txx9dmac_dev *ddev = dc->ddev;

include/linux/dmaengine.h

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -582,10 +582,11 @@ struct dma_device {
582582
struct dma_async_tx_descriptor *(*device_prep_slave_sg)(
583583
struct dma_chan *chan, struct scatterlist *sgl,
584584
unsigned int sg_len, enum dma_transfer_direction direction,
585-
unsigned long flags);
585+
unsigned long flags, void *context);
586586
struct dma_async_tx_descriptor *(*device_prep_dma_cyclic)(
587587
struct dma_chan *chan, dma_addr_t buf_addr, size_t buf_len,
588-
size_t period_len, enum dma_transfer_direction direction);
588+
size_t period_len, enum dma_transfer_direction direction,
589+
void *context);
589590
struct dma_async_tx_descriptor *(*device_prep_interleaved_dma)(
590591
struct dma_chan *chan, struct dma_interleaved_template *xt,
591592
unsigned long flags);
@@ -619,23 +620,24 @@ static inline struct dma_async_tx_descriptor *dmaengine_prep_slave_single(
619620
struct scatterlist sg;
620621
sg_init_one(&sg, buf, len);
621622

622-
return chan->device->device_prep_slave_sg(chan, &sg, 1, dir, flags);
623+
return chan->device->device_prep_slave_sg(chan, &sg, 1,
624+
dir, flags, NULL);
623625
}
624626

625627
static inline struct dma_async_tx_descriptor *dmaengine_prep_slave_sg(
626628
struct dma_chan *chan, struct scatterlist *sgl, unsigned int sg_len,
627629
enum dma_transfer_direction dir, unsigned long flags)
628630
{
629631
return chan->device->device_prep_slave_sg(chan, sgl, sg_len,
630-
dir, flags);
632+
dir, flags, NULL);
631633
}
632634

633635
static inline struct dma_async_tx_descriptor *dmaengine_prep_dma_cyclic(
634636
struct dma_chan *chan, dma_addr_t buf_addr, size_t buf_len,
635637
size_t period_len, enum dma_transfer_direction dir)
636638
{
637639
return chan->device->device_prep_dma_cyclic(chan, buf_addr, buf_len,
638-
period_len, dir);
640+
period_len, dir, NULL);
639641
}
640642

641643
static inline int dmaengine_terminate_all(struct dma_chan *chan)

0 commit comments

Comments
 (0)