summaryrefslogtreecommitdiffstats
path: root/drivers/dma/pl330.c
diff options
context:
space:
mode:
authorLars-Peter Clausen <lars@metafoo.de>2014-07-06 14:32:32 -0400
committerVinod Koul <vinod.koul@intel.com>2014-07-15 12:31:04 -0400
commitc26939e5204c533b9348cdd0b4155758f9276df1 (patch)
tree3adefe316c92b0d616f21451bcb2e4861d69a801 /drivers/dma/pl330.c
parent8ed30a14265fc2ebace02ea321c463facedfac17 (diff)
dmaengine: pl330: Remove pl330_chan_ctrl()
The pl330_chan_ctrl() function has 3 internal code paths which, except for the locking, do not share any code outside of their sections. One code path is never exercised and can be removed. The other two are mostly just forwards to the _start() and _stop() calls. This patch modifies the code to instead of going via pl330_chan_ctrl() to call _start() and _stop() directly. This allows to completely remove pl330_chan_ctrl(). 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.c71
1 files changed, 10 insertions, 61 deletions
diff --git a/drivers/dma/pl330.c b/drivers/dma/pl330.c
index 105e33e3bb33..bc5878a5c09e 100644
--- a/drivers/dma/pl330.c
+++ b/drivers/dma/pl330.c
@@ -329,15 +329,6 @@ enum pl330_op_err {
329 PL330_ERR_FAIL, 329 PL330_ERR_FAIL,
330}; 330};
331 331
332enum pl330_chan_op {
333 /* Start the channel */
334 PL330_OP_START,
335 /* Abort the active xfer */
336 PL330_OP_ABORT,
337 /* Stop xfer and flush queue */
338 PL330_OP_FLUSH,
339};
340
341enum dmamov_dst { 332enum dmamov_dst {
342 SAR = 0, 333 SAR = 0,
343 CCR, 334 CCR,
@@ -1623,55 +1614,6 @@ updt_exit:
1623 return ret; 1614 return ret;
1624} 1615}
1625 1616
1626static int pl330_chan_ctrl(struct pl330_thread *thrd, enum pl330_chan_op op)
1627{
1628 struct pl330_dmac *pl330;
1629 unsigned long flags;
1630 int ret = 0, active;
1631
1632 if (!thrd || thrd->free || thrd->dmac->state == DYING)
1633 return -EINVAL;
1634
1635 pl330 = thrd->dmac;
1636 active = thrd->req_running;
1637
1638 spin_lock_irqsave(&pl330->lock, flags);
1639
1640 switch (op) {
1641 case PL330_OP_FLUSH:
1642 /* Make sure the channel is stopped */
1643 _stop(thrd);
1644
1645 thrd->req[0].desc = NULL;
1646 thrd->req[1].desc = NULL;
1647 thrd->req_running = -1;
1648 break;
1649
1650 case PL330_OP_ABORT:
1651 /* Make sure the channel is stopped */
1652 _stop(thrd);
1653
1654 /* ABORT is only for the active req */
1655 if (active == -1)
1656 break;
1657
1658 thrd->req[active].desc = NULL;
1659 thrd->req_running = -1;
1660
1661 /* Start the next */
1662 case PL330_OP_START:
1663 if ((active == -1) && !_start(thrd))
1664 ret = -EIO;
1665 break;
1666
1667 default:
1668 ret = -EINVAL;
1669 }
1670
1671 spin_unlock_irqrestore(&pl330->lock, flags);
1672 return ret;
1673}
1674
1675/* Reserve an event */ 1617/* Reserve an event */
1676static inline int _alloc_event(struct pl330_thread *thrd) 1618static inline int _alloc_event(struct pl330_thread *thrd)
1677{ 1619{
@@ -2033,7 +1975,9 @@ static void pl330_tasklet(unsigned long data)
2033 fill_queue(pch); 1975 fill_queue(pch);
2034 1976
2035 /* Make sure the PL330 Channel thread is active */ 1977 /* Make sure the PL330 Channel thread is active */
2036 pl330_chan_ctrl(pch->thread, PL330_OP_START); 1978 spin_lock(&pch->thread->dmac->lock);
1979 _start(pch->thread);
1980 spin_unlock(&pch->thread->dmac->lock);
2037 1981
2038 while (!list_empty(&pch->completed_list)) { 1982 while (!list_empty(&pch->completed_list)) {
2039 dma_async_tx_callback callback; 1983 dma_async_tx_callback callback;
@@ -2133,8 +2077,13 @@ static int pl330_control(struct dma_chan *chan, enum dma_ctrl_cmd cmd, unsigned
2133 case DMA_TERMINATE_ALL: 2077 case DMA_TERMINATE_ALL:
2134 spin_lock_irqsave(&pch->lock, flags); 2078 spin_lock_irqsave(&pch->lock, flags);
2135 2079
2136 /* FLUSH the PL330 Channel thread */ 2080 spin_lock(&pl330->lock);
2137 pl330_chan_ctrl(pch->thread, PL330_OP_FLUSH); 2081 _stop(pch->thread);
2082 spin_unlock(&pl330->lock);
2083
2084 pch->thread->req[0].desc = NULL;
2085 pch->thread->req[1].desc = NULL;
2086 pch->thread->req_running = -1;
2138 2087
2139 /* Mark all desc done */ 2088 /* Mark all desc done */
2140 list_for_each_entry(desc, &pch->submitted_list, node) { 2089 list_for_each_entry(desc, &pch->submitted_list, node) {