Re: [PATCH 2/3] usb: musb: move dma mapping operations to separate functions

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hello.

Mian Yousaf Kaukab wrote:

Moreover, instead of keeping a boolean musb_request.mapped state, three states
are maintained. This allows the unmap operation to be called from more than one
place and to keep track if the mapping is done by the musb driver or anyone
else.

DMA mappings are done after checking musb_ep->dma so where applicable checks for
it are removed. And where possible, checks for is_dma_capable() are merged with
map state check

Signed-off-by: Mian Yousaf Kaukab <mian.yousaf.kaukab@xxxxxxxxxxxxxx>
---
This patch is based on git://gitorious.org/usb/usb.git musb-hw

 drivers/usb/musb/musb_gadget.c |  122 +++++++++++++++++++++++++---------------
 drivers/usb/musb/musb_gadget.h |    8 ++-
 2 files changed, 84 insertions(+), 46 deletions(-)

diff --git a/drivers/usb/musb/musb_gadget.c b/drivers/usb/musb/musb_gadget.c
index edff014..7ee8467 100644
--- a/drivers/usb/musb/musb_gadget.c
+++ b/drivers/usb/musb/musb_gadget.c
[...]
@@ -1150,29 +1204,7 @@ static int musb_gadget_queue(struct usb_ep *ep, struct usb_request *req,
 	request->epnum = musb_ep->current_epnum;
 	request->tx = musb_ep->is_in;
- if (is_dma_capable() && musb_ep->dma) {
-		if (request->request.dma == DMA_ADDR_INVALID) {
-			request->request.dma = dma_map_single(
-					musb->controller,
-					request->request.buf,
-					request->request.length,
-					request->tx
-						? DMA_TO_DEVICE
-						: DMA_FROM_DEVICE);
-			request->mapped = 1;
-		} else {
-			dma_sync_single_for_device(musb->controller,
-					request->request.dma,
-					request->request.length,
-					request->tx
-						? DMA_TO_DEVICE
-						: DMA_FROM_DEVICE);
-			request->mapped = 0;
-		}
-	} else if (!req->buf) {
-		return -ENODATA;

Hm, you say the patch is against the musb-hw branch, but the above two lines are long removed upstream. Well, I've double checked and the lines are present in that branch. So it seems there'll be a conflict here when merging this patch to Greg's tree...

-	} else
-		request->mapped = 0;
+	musb_dma_map_request(musb, musb_ep, request);
spin_lock_irqsave(&musb->lock, lockflags);

WBR, Sergei

--
To unsubscribe from this list: send the line "unsubscribe linux-usb" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[Index of Archives]     [Linux Media]     [Linux Input]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]     [Old Linux USB Devel Archive]

  Powered by Linux