summaryrefslogtreecommitdiffstats
path: root/drivers/dma/pl330.c
diff options
context:
space:
mode:
authorLars-Peter Clausen <lars@metafoo.de>2014-07-06 14:32:25 -0400
committerVinod Koul <vinod.koul@intel.com>2014-07-15 12:31:03 -0400
commit6079d38ca21e80c13af2d8f8a7b062a0e28615c9 (patch)
tree35e6e1c7550a2c1055d212a0cfaac55526104810 /drivers/dma/pl330.c
parentbe025329fd4223f3442fffc35f8255bd64d0d526 (diff)
dmaengine: pl330: Remove useless xfer_cb indirection
The xfer_cb callback of the pl330_req struct is always set to the same function. This adds an unnecessary step of indirection. Instead just call the callback function directly. Signed-off-by: Lars-Peter Clausen <lars@metafoo.de> Signed-off-by: Vinod Koul <vinod.koul@intel.com>
Diffstat (limited to 'drivers/dma/pl330.c')
-rw-r--r--drivers/dma/pl330.c62
1 files changed, 24 insertions, 38 deletions
diff --git a/drivers/dma/pl330.c b/drivers/dma/pl330.c
index 453ce106b5fc..cf2522e429b0 100644
--- a/drivers/dma/pl330.c
+++ b/drivers/dma/pl330.c
@@ -351,10 +351,6 @@ struct pl330_req {
351 enum dma_transfer_direction rqtype; 351 enum dma_transfer_direction rqtype;
352 /* Index of peripheral for the xfer. */ 352 /* Index of peripheral for the xfer. */
353 unsigned peri:5; 353 unsigned peri:5;
354 /* Unique token for this xfer, set by the client. */
355 void *token;
356 /* Callback to be called after xfer. */
357 void (*xfer_cb)(void *token, enum pl330_op_err err);
358 /* If NULL, req will be done at last set parameters. */ 354 /* If NULL, req will be done at last set parameters. */
359 struct pl330_reqcfg *cfg; 355 struct pl330_reqcfg *cfg;
360 /* Pointer to first xfer in the request. */ 356 /* Pointer to first xfer in the request. */
@@ -551,12 +547,6 @@ struct dma_pl330_desc {
551 struct dma_pl330_chan *pchan; 547 struct dma_pl330_chan *pchan;
552}; 548};
553 549
554static inline void _callback(struct pl330_req *r, enum pl330_op_err err)
555{
556 if (r && r->xfer_cb)
557 r->xfer_cb(r->token, err);
558}
559
560static inline bool _queue_empty(struct pl330_thread *thrd) 550static inline bool _queue_empty(struct pl330_thread *thrd)
561{ 551{
562 return (IS_FREE(&thrd->req[0]) && IS_FREE(&thrd->req[1])) 552 return (IS_FREE(&thrd->req[0]) && IS_FREE(&thrd->req[1]))
@@ -1544,6 +1534,25 @@ xfer_exit:
1544 return ret; 1534 return ret;
1545} 1535}
1546 1536
1537static void dma_pl330_rqcb(struct pl330_req *req, enum pl330_op_err err)
1538{
1539 struct dma_pl330_desc *desc = container_of(req, struct dma_pl330_desc, req);
1540 struct dma_pl330_chan *pch = desc->pchan;
1541 unsigned long flags;
1542
1543 /* If desc aborted */
1544 if (!pch)
1545 return;
1546
1547 spin_lock_irqsave(&pch->lock, flags);
1548
1549 desc->status = DONE;
1550
1551 spin_unlock_irqrestore(&pch->lock, flags);
1552
1553 tasklet_schedule(&pch->task);
1554}
1555
1547static void pl330_dotask(unsigned long data) 1556static void pl330_dotask(unsigned long data)
1548{ 1557{
1549 struct pl330_dmac *pl330 = (struct pl330_dmac *) data; 1558 struct pl330_dmac *pl330 = (struct pl330_dmac *) data;
@@ -1585,10 +1594,8 @@ static void pl330_dotask(unsigned long data)
1585 err = PL330_ERR_ABORT; 1594 err = PL330_ERR_ABORT;
1586 1595
1587 spin_unlock_irqrestore(&pl330->lock, flags); 1596 spin_unlock_irqrestore(&pl330->lock, flags);
1588 1597 dma_pl330_rqcb(thrd->req[1 - thrd->lstenq].r, err);
1589 _callback(thrd->req[1 - thrd->lstenq].r, err); 1598 dma_pl330_rqcb(thrd->req[thrd->lstenq].r, err);
1590 _callback(thrd->req[thrd->lstenq].r, err);
1591
1592 spin_lock_irqsave(&pl330->lock, flags); 1599 spin_lock_irqsave(&pl330->lock, flags);
1593 1600
1594 thrd->req[0].r = NULL; 1601 thrd->req[0].r = NULL;
@@ -1695,7 +1702,7 @@ static int pl330_update(const struct pl330_info *pi)
1695 list_del(&rqdone->rqd); 1702 list_del(&rqdone->rqd);
1696 1703
1697 spin_unlock_irqrestore(&pl330->lock, flags); 1704 spin_unlock_irqrestore(&pl330->lock, flags);
1698 _callback(rqdone, PL330_ERR_NONE); 1705 dma_pl330_rqcb(rqdone, PL330_ERR_NONE);
1699 spin_lock_irqsave(&pl330->lock, flags); 1706 spin_lock_irqsave(&pl330->lock, flags);
1700 } 1707 }
1701 1708
@@ -1852,8 +1859,8 @@ static void pl330_release_channel(void *ch_id)
1852 1859
1853 _stop(thrd); 1860 _stop(thrd);
1854 1861
1855 _callback(thrd->req[1 - thrd->lstenq].r, PL330_ERR_ABORT); 1862 dma_pl330_rqcb(thrd->req[1 - thrd->lstenq].r, PL330_ERR_ABORT);
1856 _callback(thrd->req[thrd->lstenq].r, PL330_ERR_ABORT); 1863 dma_pl330_rqcb(thrd->req[thrd->lstenq].r, PL330_ERR_ABORT);
1857 1864
1858 pl330 = thrd->dmac; 1865 pl330 = thrd->dmac;
1859 1866
@@ -2207,25 +2214,6 @@ static void pl330_tasklet(unsigned long data)
2207 spin_unlock_irqrestore(&pch->lock, flags); 2214 spin_unlock_irqrestore(&pch->lock, flags);
2208} 2215}
2209 2216
2210static void dma_pl330_rqcb(void *token, enum pl330_op_err err)
2211{
2212 struct dma_pl330_desc *desc = token;
2213 struct dma_pl330_chan *pch = desc->pchan;
2214 unsigned long flags;
2215
2216 /* If desc aborted */
2217 if (!pch)
2218 return;
2219
2220 spin_lock_irqsave(&pch->lock, flags);
2221
2222 desc->status = DONE;
2223
2224 spin_unlock_irqrestore(&pch->lock, flags);
2225
2226 tasklet_schedule(&pch->task);
2227}
2228
2229bool pl330_filter(struct dma_chan *chan, void *param) 2217bool pl330_filter(struct dma_chan *chan, void *param)
2230{ 2218{
2231 u8 *peri_id; 2219 u8 *peri_id;
@@ -2417,12 +2405,10 @@ static dma_cookie_t pl330_tx_submit(struct dma_async_tx_descriptor *tx)
2417static inline void _init_desc(struct dma_pl330_desc *desc) 2405static inline void _init_desc(struct dma_pl330_desc *desc)
2418{ 2406{
2419 desc->req.x = &desc->px; 2407 desc->req.x = &desc->px;
2420 desc->req.token = desc;
2421 desc->rqcfg.swap = SWAP_NO; 2408 desc->rqcfg.swap = SWAP_NO;
2422 desc->rqcfg.scctl = CCTRL0; 2409 desc->rqcfg.scctl = CCTRL0;
2423 desc->rqcfg.dcctl = CCTRL0; 2410 desc->rqcfg.dcctl = CCTRL0;
2424 desc->req.cfg = &desc->rqcfg; 2411 desc->req.cfg = &desc->rqcfg;
2425 desc->req.xfer_cb = dma_pl330_rqcb;
2426 desc->txd.tx_submit = pl330_tx_submit; 2412 desc->txd.tx_submit = pl330_tx_submit;
2427 2413
2428 INIT_LIST_HEAD(&desc->node); 2414 INIT_LIST_HEAD(&desc->node);