diff options
author | Jon Mason <jon.mason@intel.com> | 2013-11-19 11:34:47 -0500 |
---|---|---|
committer | Jon Mason <jon.mason@intel.com> | 2013-11-20 11:57:32 -0500 |
commit | 94681194e667c33ba303f1225814197594cbfc34 (patch) | |
tree | 2f25a1cd655eef1e64b151e56537e4085d101f77 /drivers/ntb/ntb_transport.c | |
parent | fca4d5188c1123ff63205e35e2c5f551a21d30c4 (diff) |
NTB: correct dmaengine_get/put usage
dmaengine_get() causes the initialization of the per-cpu channel tables.
It needs to be called prior to dma_find_channel().
Initial version by Dan Williams <dan.j.williams@intel.com>
Signed-off-by: Jon Mason <jon.mason@intel.com>
Diffstat (limited to 'drivers/ntb/ntb_transport.c')
-rw-r--r-- | drivers/ntb/ntb_transport.c | 9 |
1 files changed, 6 insertions, 3 deletions
diff --git a/drivers/ntb/ntb_transport.c b/drivers/ntb/ntb_transport.c index 7010f23dab18..172501d47600 100644 --- a/drivers/ntb/ntb_transport.c +++ b/drivers/ntb/ntb_transport.c | |||
@@ -1419,11 +1419,12 @@ ntb_transport_create_queue(void *data, struct pci_dev *pdev, | |||
1419 | qp->tx_handler = handlers->tx_handler; | 1419 | qp->tx_handler = handlers->tx_handler; |
1420 | qp->event_handler = handlers->event_handler; | 1420 | qp->event_handler = handlers->event_handler; |
1421 | 1421 | ||
1422 | dmaengine_get(); | ||
1422 | qp->dma_chan = dma_find_channel(DMA_MEMCPY); | 1423 | qp->dma_chan = dma_find_channel(DMA_MEMCPY); |
1423 | if (!qp->dma_chan) | 1424 | if (!qp->dma_chan) { |
1425 | dmaengine_put(); | ||
1424 | dev_info(&pdev->dev, "Unable to allocate DMA channel, using CPU instead\n"); | 1426 | dev_info(&pdev->dev, "Unable to allocate DMA channel, using CPU instead\n"); |
1425 | else | 1427 | } |
1426 | dmaengine_get(); | ||
1427 | 1428 | ||
1428 | for (i = 0; i < NTB_QP_DEF_NUM_ENTRIES; i++) { | 1429 | for (i = 0; i < NTB_QP_DEF_NUM_ENTRIES; i++) { |
1429 | entry = kzalloc(sizeof(struct ntb_queue_entry), GFP_ATOMIC); | 1430 | entry = kzalloc(sizeof(struct ntb_queue_entry), GFP_ATOMIC); |
@@ -1464,6 +1465,8 @@ err2: | |||
1464 | err1: | 1465 | err1: |
1465 | while ((entry = ntb_list_rm(&qp->ntb_rx_free_q_lock, &qp->rx_free_q))) | 1466 | while ((entry = ntb_list_rm(&qp->ntb_rx_free_q_lock, &qp->rx_free_q))) |
1466 | kfree(entry); | 1467 | kfree(entry); |
1468 | if (qp->dma_chan) | ||
1469 | dmaengine_put(); | ||
1467 | set_bit(free_queue, &nt->qp_bitmap); | 1470 | set_bit(free_queue, &nt->qp_bitmap); |
1468 | err: | 1471 | err: |
1469 | return NULL; | 1472 | return NULL; |