aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--drivers/dma/amba-pl08x.c32
1 files changed, 9 insertions, 23 deletions
diff --git a/drivers/dma/amba-pl08x.c b/drivers/dma/amba-pl08x.c
index c42c7ef6b93a..9297240cae3a 100644
--- a/drivers/dma/amba-pl08x.c
+++ b/drivers/dma/amba-pl08x.c
@@ -1352,25 +1352,6 @@ static void pl08x_issue_pending(struct dma_chan *chan)
1352 spin_unlock_irqrestore(&plchan->vc.lock, flags); 1352 spin_unlock_irqrestore(&plchan->vc.lock, flags);
1353} 1353}
1354 1354
1355static int pl08x_prep_channel_resources(struct pl08x_dma_chan *plchan,
1356 struct pl08x_txd *txd)
1357{
1358 struct pl08x_driver_data *pl08x = plchan->host;
1359 int num_llis;
1360
1361 num_llis = pl08x_fill_llis_for_desc(pl08x, txd);
1362 if (!num_llis) {
1363 unsigned long flags;
1364
1365 spin_lock_irqsave(&plchan->vc.lock, flags);
1366 pl08x_free_txd(pl08x, txd);
1367 spin_unlock_irqrestore(&plchan->vc.lock, flags);
1368
1369 return -EINVAL;
1370 }
1371 return 0;
1372}
1373
1374static struct pl08x_txd *pl08x_get_txd(struct pl08x_dma_chan *plchan) 1355static struct pl08x_txd *pl08x_get_txd(struct pl08x_dma_chan *plchan)
1375{ 1356{
1376 struct pl08x_txd *txd = kzalloc(sizeof(*txd), GFP_NOWAIT); 1357 struct pl08x_txd *txd = kzalloc(sizeof(*txd), GFP_NOWAIT);
@@ -1430,9 +1411,11 @@ static struct dma_async_tx_descriptor *pl08x_prep_dma_memcpy(
1430 txd->cctl |= pl08x_select_bus(pl08x->mem_buses, 1411 txd->cctl |= pl08x_select_bus(pl08x->mem_buses,
1431 pl08x->mem_buses); 1412 pl08x->mem_buses);
1432 1413
1433 ret = pl08x_prep_channel_resources(plchan, txd); 1414 ret = pl08x_fill_llis_for_desc(plchan->host, txd);
1434 if (ret) 1415 if (!ret) {
1416 pl08x_free_txd(pl08x, txd);
1435 return NULL; 1417 return NULL;
1418 }
1436 1419
1437 return vchan_tx_prep(&plchan->vc, &txd->vd, flags); 1420 return vchan_tx_prep(&plchan->vc, &txd->vd, flags);
1438} 1421}
@@ -1546,9 +1529,12 @@ static struct dma_async_tx_descriptor *pl08x_prep_slave_sg(
1546 } 1529 }
1547 } 1530 }
1548 1531
1549 ret = pl08x_prep_channel_resources(plchan, txd); 1532 ret = pl08x_fill_llis_for_desc(plchan->host, txd);
1550 if (ret) 1533 if (!ret) {
1534 pl08x_release_mux(plchan);
1535 pl08x_free_txd(pl08x, txd);
1551 return NULL; 1536 return NULL;
1537 }
1552 1538
1553 return vchan_tx_prep(&plchan->vc, &txd->vd, flags); 1539 return vchan_tx_prep(&plchan->vc, &txd->vd, flags);
1554} 1540}