aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/rapidio
diff options
context:
space:
mode:
authorAlexandre Bounine <alexandre.bounine@idt.com>2016-03-22 17:26:59 -0400
committerLinus Torvalds <torvalds@linux-foundation.org>2016-03-22 18:36:02 -0400
commit83472457505c454592d91807754135d0ad34b125 (patch)
tree3c93685eba4fff5416df6201fdd6f9b4c2fc7774 /drivers/rapidio
parent72d8a0d23083ba89fb00a7ad9b07419e34ebe47c (diff)
rapidio/tsi721_dma: update error reporting from prep_sg callback
Switch to returning error-valued pointer instead of simple NULL pointer. This allows to properly identify situation when request queue is full and therefore gives to upper layer an option to retry operation later. Signed-off-by: Alexandre Bounine <alexandre.bounine@idt.com> Cc: Matt Porter <mporter@kernel.crashing.org> Cc: Aurelien Jacquiot <a-jacquiot@ti.com> Cc: Andre van Herk <andre.van.herk@prodrive-technologies.com> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Diffstat (limited to 'drivers/rapidio')
-rw-r--r--drivers/rapidio/devices/tsi721_dma.c37
1 files changed, 21 insertions, 16 deletions
diff --git a/drivers/rapidio/devices/tsi721_dma.c b/drivers/rapidio/devices/tsi721_dma.c
index 494482e4ab0a..5bc9071ebcae 100644
--- a/drivers/rapidio/devices/tsi721_dma.c
+++ b/drivers/rapidio/devices/tsi721_dma.c
@@ -767,7 +767,7 @@ struct dma_async_tx_descriptor *tsi721_prep_rio_sg(struct dma_chan *dchan,
767 void *tinfo) 767 void *tinfo)
768{ 768{
769 struct tsi721_bdma_chan *bdma_chan = to_tsi721_chan(dchan); 769 struct tsi721_bdma_chan *bdma_chan = to_tsi721_chan(dchan);
770 struct tsi721_tx_desc *desc, *_d; 770 struct tsi721_tx_desc *desc;
771 struct rio_dma_ext *rext = tinfo; 771 struct rio_dma_ext *rext = tinfo;
772 enum dma_rtype rtype; 772 enum dma_rtype rtype;
773 struct dma_async_tx_descriptor *txd = NULL; 773 struct dma_async_tx_descriptor *txd = NULL;
@@ -775,7 +775,7 @@ struct dma_async_tx_descriptor *tsi721_prep_rio_sg(struct dma_chan *dchan,
775 if (!sgl || !sg_len) { 775 if (!sgl || !sg_len) {
776 tsi_err(&dchan->dev->device, "DMAC%d No SG list", 776 tsi_err(&dchan->dev->device, "DMAC%d No SG list",
777 bdma_chan->id); 777 bdma_chan->id);
778 return NULL; 778 return ERR_PTR(-EINVAL);
779 } 779 }
780 780
781 tsi_debug(DMA, &dchan->dev->device, "DMAC%d %s", bdma_chan->id, 781 tsi_debug(DMA, &dchan->dev->device, "DMAC%d %s", bdma_chan->id,
@@ -800,28 +800,33 @@ struct dma_async_tx_descriptor *tsi721_prep_rio_sg(struct dma_chan *dchan,
800 tsi_err(&dchan->dev->device, 800 tsi_err(&dchan->dev->device,
801 "DMAC%d Unsupported DMA direction option", 801 "DMAC%d Unsupported DMA direction option",
802 bdma_chan->id); 802 bdma_chan->id);
803 return NULL; 803 return ERR_PTR(-EINVAL);
804 } 804 }
805 805
806 spin_lock_bh(&bdma_chan->lock); 806 spin_lock_bh(&bdma_chan->lock);
807 807
808 list_for_each_entry_safe(desc, _d, &bdma_chan->free_list, desc_node) { 808 if (!list_empty(&bdma_chan->free_list)) {
809 if (async_tx_test_ack(&desc->txd)) { 809 desc = list_first_entry(&bdma_chan->free_list,
810 list_del_init(&desc->desc_node); 810 struct tsi721_tx_desc, desc_node);
811 desc->destid = rext->destid; 811 list_del_init(&desc->desc_node);
812 desc->rio_addr = rext->rio_addr; 812 desc->destid = rext->destid;
813 desc->rio_addr_u = 0; 813 desc->rio_addr = rext->rio_addr;
814 desc->rtype = rtype; 814 desc->rio_addr_u = 0;
815 desc->sg_len = sg_len; 815 desc->rtype = rtype;
816 desc->sg = sgl; 816 desc->sg_len = sg_len;
817 txd = &desc->txd; 817 desc->sg = sgl;
818 txd->flags = flags; 818 txd = &desc->txd;
819 break; 819 txd->flags = flags;
820 }
821 } 820 }
822 821
823 spin_unlock_bh(&bdma_chan->lock); 822 spin_unlock_bh(&bdma_chan->lock);
824 823
824 if (!txd) {
825 tsi_debug(DMA, &dchan->dev->device,
826 "DMAC%d free TXD is not available", bdma_chan->id);
827 return ERR_PTR(-EBUSY);
828 }
829
825 return txd; 830 return txd;
826} 831}
827 832