Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 275808
b: refs/heads/master
c: 954aad8
h: refs/heads/master
v: v3
  • Loading branch information
Michael Grzeschik authored and Greg Kroah-Hartman committed Nov 14, 2011
1 parent 5667a06 commit 5582a87
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 5 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: 001428e4871d6c62f5e16c62df681624d8b480c1
refs/heads/master: 954aad8cd18c928e2db5229f6fa71c80d1c3d8b5
12 changes: 8 additions & 4 deletions trunk/drivers/usb/gadget/ci13xxx_udc.c
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,9 @@
/******************************************************************************
* DEFINE
*****************************************************************************/

#define DMA_ADDR_INVALID (~(dma_addr_t)0)

/* ctrl register bank access */
static DEFINE_SPINLOCK(udc_lock);

Expand Down Expand Up @@ -1434,7 +1437,7 @@ static int _hardware_enqueue(struct ci13xxx_ep *mEp, struct ci13xxx_req *mReq)
return -EALREADY;

mReq->req.status = -EALREADY;
if (length && !mReq->req.dma) {
if (length && mReq->req.dma == DMA_ADDR_INVALID) {
mReq->req.dma = \
dma_map_single(mEp->device, mReq->req.buf,
length, mEp->dir ? DMA_TO_DEVICE :
Expand All @@ -1453,7 +1456,7 @@ static int _hardware_enqueue(struct ci13xxx_ep *mEp, struct ci13xxx_req *mReq)
dma_unmap_single(mEp->device, mReq->req.dma,
length, mEp->dir ? DMA_TO_DEVICE :
DMA_FROM_DEVICE);
mReq->req.dma = 0;
mReq->req.dma = DMA_ADDR_INVALID;
mReq->map = 0;
}
return -ENOMEM;
Expand Down Expand Up @@ -1549,7 +1552,7 @@ static int _hardware_dequeue(struct ci13xxx_ep *mEp, struct ci13xxx_req *mReq)
if (mReq->map) {
dma_unmap_single(mEp->device, mReq->req.dma, mReq->req.length,
mEp->dir ? DMA_TO_DEVICE : DMA_FROM_DEVICE);
mReq->req.dma = 0;
mReq->req.dma = DMA_ADDR_INVALID;
mReq->map = 0;
}

Expand Down Expand Up @@ -2189,6 +2192,7 @@ static struct usb_request *ep_alloc_request(struct usb_ep *ep, gfp_t gfp_flags)
mReq = kzalloc(sizeof(struct ci13xxx_req), gfp_flags);
if (mReq != NULL) {
INIT_LIST_HEAD(&mReq->queue);
mReq->req.dma = DMA_ADDR_INVALID;

mReq->ptr = dma_pool_alloc(mEp->td_pool, gfp_flags,
&mReq->dma);
Expand Down Expand Up @@ -2328,7 +2332,7 @@ static int ep_dequeue(struct usb_ep *ep, struct usb_request *req)
if (mReq->map) {
dma_unmap_single(mEp->device, mReq->req.dma, mReq->req.length,
mEp->dir ? DMA_TO_DEVICE : DMA_FROM_DEVICE);
mReq->req.dma = 0;
mReq->req.dma = DMA_ADDR_INVALID;
mReq->map = 0;
}
req->status = -ECONNRESET;
Expand Down

0 comments on commit 5582a87

Please sign in to comment.