Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 289589
b: refs/heads/master
c: c5cc5ed
h: refs/heads/master
i:
  289587: 227e19a
v: v3
  • Loading branch information
Peter Chen authored and Felipe Balbi committed Feb 24, 2012
1 parent 58b89a9 commit dce924e
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 11 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: 3b2a2e47174cd978258bbb0fdf2e2b1b5ec2144c
refs/heads/master: c5cc5ed86667d4ae74fe40ee4ed893f4b46aba05
18 changes: 8 additions & 10 deletions trunk/drivers/usb/gadget/fsl_udc_core.c
Original file line number Diff line number Diff line change
Expand Up @@ -769,7 +769,7 @@ static void fsl_queue_td(struct fsl_ep *ep, struct fsl_req *req)
* @is_last: return flag if it is the last dTD of the request
* return: pointer to the built dTD */
static struct ep_td_struct *fsl_build_dtd(struct fsl_req *req, unsigned *length,
dma_addr_t *dma, int *is_last)
dma_addr_t *dma, int *is_last, gfp_t gfp_flags)
{
u32 swap_temp;
struct ep_td_struct *dtd;
Expand All @@ -778,7 +778,7 @@ static struct ep_td_struct *fsl_build_dtd(struct fsl_req *req, unsigned *length,
*length = min(req->req.length - req->req.actual,
(unsigned)EP_MAX_LENGTH_TRANSFER);

dtd = dma_pool_alloc(udc_controller->td_pool, GFP_KERNEL, dma);
dtd = dma_pool_alloc(udc_controller->td_pool, gfp_flags, dma);
if (dtd == NULL)
return dtd;

Expand Down Expand Up @@ -828,7 +828,7 @@ static struct ep_td_struct *fsl_build_dtd(struct fsl_req *req, unsigned *length,
}

/* Generate dtd chain for a request */
static int fsl_req_to_dtd(struct fsl_req *req)
static int fsl_req_to_dtd(struct fsl_req *req, gfp_t gfp_flags)
{
unsigned count;
int is_last;
Expand All @@ -837,7 +837,7 @@ static int fsl_req_to_dtd(struct fsl_req *req)
dma_addr_t dma;

do {
dtd = fsl_build_dtd(req, &count, &dma, &is_last);
dtd = fsl_build_dtd(req, &count, &dma, &is_last, gfp_flags);
if (dtd == NULL)
return -ENOMEM;

Expand Down Expand Up @@ -911,13 +911,11 @@ fsl_ep_queue(struct usb_ep *_ep, struct usb_request *_req, gfp_t gfp_flags)
req->req.actual = 0;
req->dtd_count = 0;

spin_lock_irqsave(&udc->lock, flags);

/* build dtds and push them to device queue */
if (!fsl_req_to_dtd(req)) {
if (!fsl_req_to_dtd(req, gfp_flags)) {
spin_lock_irqsave(&udc->lock, flags);
fsl_queue_td(ep, req);
} else {
spin_unlock_irqrestore(&udc->lock, flags);
return -ENOMEM;
}

Expand Down Expand Up @@ -1296,7 +1294,7 @@ static int ep0_prime_status(struct fsl_udc *udc, int direction)
ep_is_in(ep) ? DMA_TO_DEVICE : DMA_FROM_DEVICE);
req->mapped = 1;

if (fsl_req_to_dtd(req) == 0)
if (fsl_req_to_dtd(req, GFP_ATOMIC) == 0)
fsl_queue_td(ep, req);
else
return -ENOMEM;
Expand Down Expand Up @@ -1380,7 +1378,7 @@ static void ch9getstatus(struct fsl_udc *udc, u8 request_type, u16 value,
req->mapped = 1;

/* prime the data phase */
if ((fsl_req_to_dtd(req) == 0))
if ((fsl_req_to_dtd(req, GFP_ATOMIC) == 0))
fsl_queue_td(ep, req);
else /* no mem */
goto stall;
Expand Down

0 comments on commit dce924e

Please sign in to comment.