diff options
-rw-r--r-- | drivers/usb/renesas_usbhs/fifo.c | 18 |
1 files changed, 14 insertions, 4 deletions
diff --git a/drivers/usb/renesas_usbhs/fifo.c b/drivers/usb/renesas_usbhs/fifo.c index 7be4e7d57ace..280ed5ff021b 100644 --- a/drivers/usb/renesas_usbhs/fifo.c +++ b/drivers/usb/renesas_usbhs/fifo.c | |||
@@ -810,20 +810,27 @@ static void xfer_work(struct work_struct *work) | |||
810 | { | 810 | { |
811 | struct usbhs_pkt *pkt = container_of(work, struct usbhs_pkt, work); | 811 | struct usbhs_pkt *pkt = container_of(work, struct usbhs_pkt, work); |
812 | struct usbhs_pipe *pipe = pkt->pipe; | 812 | struct usbhs_pipe *pipe = pkt->pipe; |
813 | struct usbhs_fifo *fifo = usbhs_pipe_to_fifo(pipe); | 813 | struct usbhs_fifo *fifo; |
814 | struct usbhs_priv *priv = usbhs_pipe_to_priv(pipe); | 814 | struct usbhs_priv *priv = usbhs_pipe_to_priv(pipe); |
815 | struct dma_async_tx_descriptor *desc; | 815 | struct dma_async_tx_descriptor *desc; |
816 | struct dma_chan *chan = usbhsf_dma_chan_get(fifo, pkt); | 816 | struct dma_chan *chan; |
817 | struct device *dev = usbhs_priv_to_dev(priv); | 817 | struct device *dev = usbhs_priv_to_dev(priv); |
818 | enum dma_transfer_direction dir; | 818 | enum dma_transfer_direction dir; |
819 | unsigned long flags; | ||
819 | 820 | ||
821 | usbhs_lock(priv, flags); | ||
822 | fifo = usbhs_pipe_to_fifo(pipe); | ||
823 | if (!fifo) | ||
824 | goto xfer_work_end; | ||
825 | |||
826 | chan = usbhsf_dma_chan_get(fifo, pkt); | ||
820 | dir = usbhs_pipe_is_dir_in(pipe) ? DMA_DEV_TO_MEM : DMA_MEM_TO_DEV; | 827 | dir = usbhs_pipe_is_dir_in(pipe) ? DMA_DEV_TO_MEM : DMA_MEM_TO_DEV; |
821 | 828 | ||
822 | desc = dmaengine_prep_slave_single(chan, pkt->dma + pkt->actual, | 829 | desc = dmaengine_prep_slave_single(chan, pkt->dma + pkt->actual, |
823 | pkt->trans, dir, | 830 | pkt->trans, dir, |
824 | DMA_PREP_INTERRUPT | DMA_CTRL_ACK); | 831 | DMA_PREP_INTERRUPT | DMA_CTRL_ACK); |
825 | if (!desc) | 832 | if (!desc) |
826 | return; | 833 | goto xfer_work_end; |
827 | 834 | ||
828 | desc->callback = usbhsf_dma_complete; | 835 | desc->callback = usbhsf_dma_complete; |
829 | desc->callback_param = pipe; | 836 | desc->callback_param = pipe; |
@@ -831,7 +838,7 @@ static void xfer_work(struct work_struct *work) | |||
831 | pkt->cookie = dmaengine_submit(desc); | 838 | pkt->cookie = dmaengine_submit(desc); |
832 | if (pkt->cookie < 0) { | 839 | if (pkt->cookie < 0) { |
833 | dev_err(dev, "Failed to submit dma descriptor\n"); | 840 | dev_err(dev, "Failed to submit dma descriptor\n"); |
834 | return; | 841 | goto xfer_work_end; |
835 | } | 842 | } |
836 | 843 | ||
837 | dev_dbg(dev, " %s %d (%d/ %d)\n", | 844 | dev_dbg(dev, " %s %d (%d/ %d)\n", |
@@ -842,6 +849,9 @@ static void xfer_work(struct work_struct *work) | |||
842 | usbhs_pipe_set_trans_count_if_bulk(pipe, pkt->trans); | 849 | usbhs_pipe_set_trans_count_if_bulk(pipe, pkt->trans); |
843 | dma_async_issue_pending(chan); | 850 | dma_async_issue_pending(chan); |
844 | usbhs_pipe_enable(pipe); | 851 | usbhs_pipe_enable(pipe); |
852 | |||
853 | xfer_work_end: | ||
854 | usbhs_unlock(priv, flags); | ||
845 | } | 855 | } |
846 | 856 | ||
847 | /* | 857 | /* |