diff options
Diffstat (limited to 'drivers/usb/gadget')
-rw-r--r-- | drivers/usb/gadget/at91_udc.c | 21 | ||||
-rw-r--r-- | drivers/usb/gadget/dummy_hcd.c | 36 | ||||
-rw-r--r-- | drivers/usb/gadget/fsl_usb2_udc.c | 36 | ||||
-rw-r--r-- | drivers/usb/gadget/goku_udc.c | 48 | ||||
-rw-r--r-- | drivers/usb/gadget/lh7a40x_udc.c | 27 | ||||
-rw-r--r-- | drivers/usb/gadget/net2280.c | 97 | ||||
-rw-r--r-- | drivers/usb/gadget/omap_udc.c | 108 | ||||
-rw-r--r-- | drivers/usb/gadget/pxa2xx_udc.c | 23 | ||||
-rw-r--r-- | drivers/usb/gadget/s3c2410_udc.c | 33 |
9 files changed, 0 insertions, 429 deletions
diff --git a/drivers/usb/gadget/at91_udc.c b/drivers/usb/gadget/at91_udc.c index ba163f35bf21..63d7d6568699 100644 --- a/drivers/usb/gadget/at91_udc.c +++ b/drivers/usb/gadget/at91_udc.c | |||
@@ -601,25 +601,6 @@ static void at91_ep_free_request(struct usb_ep *_ep, struct usb_request *_req) | |||
601 | kfree(req); | 601 | kfree(req); |
602 | } | 602 | } |
603 | 603 | ||
604 | static void *at91_ep_alloc_buffer( | ||
605 | struct usb_ep *_ep, | ||
606 | unsigned bytes, | ||
607 | dma_addr_t *dma, | ||
608 | gfp_t gfp_flags) | ||
609 | { | ||
610 | *dma = ~0; | ||
611 | return kmalloc(bytes, gfp_flags); | ||
612 | } | ||
613 | |||
614 | static void at91_ep_free_buffer( | ||
615 | struct usb_ep *ep, | ||
616 | void *buf, | ||
617 | dma_addr_t dma, | ||
618 | unsigned bytes) | ||
619 | { | ||
620 | kfree(buf); | ||
621 | } | ||
622 | |||
623 | static int at91_ep_queue(struct usb_ep *_ep, | 604 | static int at91_ep_queue(struct usb_ep *_ep, |
624 | struct usb_request *_req, gfp_t gfp_flags) | 605 | struct usb_request *_req, gfp_t gfp_flags) |
625 | { | 606 | { |
@@ -788,8 +769,6 @@ static const struct usb_ep_ops at91_ep_ops = { | |||
788 | .disable = at91_ep_disable, | 769 | .disable = at91_ep_disable, |
789 | .alloc_request = at91_ep_alloc_request, | 770 | .alloc_request = at91_ep_alloc_request, |
790 | .free_request = at91_ep_free_request, | 771 | .free_request = at91_ep_free_request, |
791 | .alloc_buffer = at91_ep_alloc_buffer, | ||
792 | .free_buffer = at91_ep_free_buffer, | ||
793 | .queue = at91_ep_queue, | 772 | .queue = at91_ep_queue, |
794 | .dequeue = at91_ep_dequeue, | 773 | .dequeue = at91_ep_dequeue, |
795 | .set_halt = at91_ep_set_halt, | 774 | .set_halt = at91_ep_set_halt, |
diff --git a/drivers/usb/gadget/dummy_hcd.c b/drivers/usb/gadget/dummy_hcd.c index 9040b50d6425..f2fbdc7fe376 100644 --- a/drivers/usb/gadget/dummy_hcd.c +++ b/drivers/usb/gadget/dummy_hcd.c | |||
@@ -497,38 +497,6 @@ dummy_free_request (struct usb_ep *_ep, struct usb_request *_req) | |||
497 | kfree (req); | 497 | kfree (req); |
498 | } | 498 | } |
499 | 499 | ||
500 | static void * | ||
501 | dummy_alloc_buffer ( | ||
502 | struct usb_ep *_ep, | ||
503 | unsigned bytes, | ||
504 | dma_addr_t *dma, | ||
505 | gfp_t mem_flags | ||
506 | ) { | ||
507 | char *retval; | ||
508 | struct dummy_ep *ep; | ||
509 | struct dummy *dum; | ||
510 | |||
511 | ep = usb_ep_to_dummy_ep (_ep); | ||
512 | dum = ep_to_dummy (ep); | ||
513 | |||
514 | if (!dum->driver) | ||
515 | return NULL; | ||
516 | retval = kmalloc (bytes, mem_flags); | ||
517 | *dma = (dma_addr_t) retval; | ||
518 | return retval; | ||
519 | } | ||
520 | |||
521 | static void | ||
522 | dummy_free_buffer ( | ||
523 | struct usb_ep *_ep, | ||
524 | void *buf, | ||
525 | dma_addr_t dma, | ||
526 | unsigned bytes | ||
527 | ) { | ||
528 | if (bytes) | ||
529 | kfree (buf); | ||
530 | } | ||
531 | |||
532 | static void | 500 | static void |
533 | fifo_complete (struct usb_ep *ep, struct usb_request *req) | 501 | fifo_complete (struct usb_ep *ep, struct usb_request *req) |
534 | { | 502 | { |
@@ -659,10 +627,6 @@ static const struct usb_ep_ops dummy_ep_ops = { | |||
659 | .alloc_request = dummy_alloc_request, | 627 | .alloc_request = dummy_alloc_request, |
660 | .free_request = dummy_free_request, | 628 | .free_request = dummy_free_request, |
661 | 629 | ||
662 | .alloc_buffer = dummy_alloc_buffer, | ||
663 | .free_buffer = dummy_free_buffer, | ||
664 | /* map, unmap, ... eventually hook the "generic" dma calls */ | ||
665 | |||
666 | .queue = dummy_queue, | 630 | .queue = dummy_queue, |
667 | .dequeue = dummy_dequeue, | 631 | .dequeue = dummy_dequeue, |
668 | 632 | ||
diff --git a/drivers/usb/gadget/fsl_usb2_udc.c b/drivers/usb/gadget/fsl_usb2_udc.c index 4e14bcd7c3b1..10b2b33b8698 100644 --- a/drivers/usb/gadget/fsl_usb2_udc.c +++ b/drivers/usb/gadget/fsl_usb2_udc.c | |||
@@ -601,39 +601,6 @@ static void fsl_free_request(struct usb_ep *_ep, struct usb_request *_req) | |||
601 | kfree(req); | 601 | kfree(req); |
602 | } | 602 | } |
603 | 603 | ||
604 | /*------------------------------------------------------------------ | ||
605 | * Allocate an I/O buffer | ||
606 | *---------------------------------------------------------------------*/ | ||
607 | static void *fsl_alloc_buffer(struct usb_ep *_ep, unsigned bytes, | ||
608 | dma_addr_t *dma, gfp_t gfp_flags) | ||
609 | { | ||
610 | struct fsl_ep *ep; | ||
611 | |||
612 | if (!_ep) | ||
613 | return NULL; | ||
614 | |||
615 | ep = container_of(_ep, struct fsl_ep, ep); | ||
616 | |||
617 | return dma_alloc_coherent(ep->udc->gadget.dev.parent, | ||
618 | bytes, dma, gfp_flags); | ||
619 | } | ||
620 | |||
621 | /*------------------------------------------------------------------ | ||
622 | * frees an i/o buffer | ||
623 | *---------------------------------------------------------------------*/ | ||
624 | static void fsl_free_buffer(struct usb_ep *_ep, void *buf, | ||
625 | dma_addr_t dma, unsigned bytes) | ||
626 | { | ||
627 | struct fsl_ep *ep; | ||
628 | |||
629 | if (!_ep) | ||
630 | return; | ||
631 | |||
632 | ep = container_of(_ep, struct fsl_ep, ep); | ||
633 | |||
634 | dma_free_coherent(ep->udc->gadget.dev.parent, bytes, buf, dma); | ||
635 | } | ||
636 | |||
637 | /*-------------------------------------------------------------------------*/ | 604 | /*-------------------------------------------------------------------------*/ |
638 | static int fsl_queue_td(struct fsl_ep *ep, struct fsl_req *req) | 605 | static int fsl_queue_td(struct fsl_ep *ep, struct fsl_req *req) |
639 | { | 606 | { |
@@ -1047,9 +1014,6 @@ static struct usb_ep_ops fsl_ep_ops = { | |||
1047 | .alloc_request = fsl_alloc_request, | 1014 | .alloc_request = fsl_alloc_request, |
1048 | .free_request = fsl_free_request, | 1015 | .free_request = fsl_free_request, |
1049 | 1016 | ||
1050 | .alloc_buffer = fsl_alloc_buffer, | ||
1051 | .free_buffer = fsl_free_buffer, | ||
1052 | |||
1053 | .queue = fsl_ep_queue, | 1017 | .queue = fsl_ep_queue, |
1054 | .dequeue = fsl_ep_dequeue, | 1018 | .dequeue = fsl_ep_dequeue, |
1055 | 1019 | ||
diff --git a/drivers/usb/gadget/goku_udc.c b/drivers/usb/gadget/goku_udc.c index ae931af05cef..dfadb643597b 100644 --- a/drivers/usb/gadget/goku_udc.c +++ b/drivers/usb/gadget/goku_udc.c | |||
@@ -296,51 +296,6 @@ goku_free_request(struct usb_ep *_ep, struct usb_request *_req) | |||
296 | 296 | ||
297 | /*-------------------------------------------------------------------------*/ | 297 | /*-------------------------------------------------------------------------*/ |
298 | 298 | ||
299 | /* allocating buffers this way eliminates dma mapping overhead, which | ||
300 | * on some platforms will mean eliminating a per-io buffer copy. with | ||
301 | * some kinds of system caches, further tweaks may still be needed. | ||
302 | */ | ||
303 | static void * | ||
304 | goku_alloc_buffer(struct usb_ep *_ep, unsigned bytes, | ||
305 | dma_addr_t *dma, gfp_t gfp_flags) | ||
306 | { | ||
307 | void *retval; | ||
308 | struct goku_ep *ep; | ||
309 | |||
310 | ep = container_of(_ep, struct goku_ep, ep); | ||
311 | if (!_ep) | ||
312 | return NULL; | ||
313 | *dma = DMA_ADDR_INVALID; | ||
314 | |||
315 | if (ep->dma) { | ||
316 | /* the main problem with this call is that it wastes memory | ||
317 | * on typical 1/N page allocations: it allocates 1-N pages. | ||
318 | */ | ||
319 | #warning Using dma_alloc_coherent even with buffers smaller than a page. | ||
320 | retval = dma_alloc_coherent(&ep->dev->pdev->dev, | ||
321 | bytes, dma, gfp_flags); | ||
322 | } else | ||
323 | retval = kmalloc(bytes, gfp_flags); | ||
324 | return retval; | ||
325 | } | ||
326 | |||
327 | static void | ||
328 | goku_free_buffer(struct usb_ep *_ep, void *buf, dma_addr_t dma, unsigned bytes) | ||
329 | { | ||
330 | /* free memory into the right allocator */ | ||
331 | if (dma != DMA_ADDR_INVALID) { | ||
332 | struct goku_ep *ep; | ||
333 | |||
334 | ep = container_of(_ep, struct goku_ep, ep); | ||
335 | if (!_ep) | ||
336 | return; | ||
337 | dma_free_coherent(&ep->dev->pdev->dev, bytes, buf, dma); | ||
338 | } else | ||
339 | kfree (buf); | ||
340 | } | ||
341 | |||
342 | /*-------------------------------------------------------------------------*/ | ||
343 | |||
344 | static void | 299 | static void |
345 | done(struct goku_ep *ep, struct goku_request *req, int status) | 300 | done(struct goku_ep *ep, struct goku_request *req, int status) |
346 | { | 301 | { |
@@ -1026,9 +981,6 @@ static struct usb_ep_ops goku_ep_ops = { | |||
1026 | .alloc_request = goku_alloc_request, | 981 | .alloc_request = goku_alloc_request, |
1027 | .free_request = goku_free_request, | 982 | .free_request = goku_free_request, |
1028 | 983 | ||
1029 | .alloc_buffer = goku_alloc_buffer, | ||
1030 | .free_buffer = goku_free_buffer, | ||
1031 | |||
1032 | .queue = goku_queue, | 984 | .queue = goku_queue, |
1033 | .dequeue = goku_dequeue, | 985 | .dequeue = goku_dequeue, |
1034 | 986 | ||
diff --git a/drivers/usb/gadget/lh7a40x_udc.c b/drivers/usb/gadget/lh7a40x_udc.c index a0a73c08a344..e78c2ddc1f88 100644 --- a/drivers/usb/gadget/lh7a40x_udc.c +++ b/drivers/usb/gadget/lh7a40x_udc.c | |||
@@ -75,10 +75,6 @@ static int lh7a40x_ep_enable(struct usb_ep *ep, | |||
75 | static int lh7a40x_ep_disable(struct usb_ep *ep); | 75 | static int lh7a40x_ep_disable(struct usb_ep *ep); |
76 | static struct usb_request *lh7a40x_alloc_request(struct usb_ep *ep, gfp_t); | 76 | static struct usb_request *lh7a40x_alloc_request(struct usb_ep *ep, gfp_t); |
77 | static void lh7a40x_free_request(struct usb_ep *ep, struct usb_request *); | 77 | static void lh7a40x_free_request(struct usb_ep *ep, struct usb_request *); |
78 | static void *lh7a40x_alloc_buffer(struct usb_ep *ep, unsigned, dma_addr_t *, | ||
79 | gfp_t); | ||
80 | static void lh7a40x_free_buffer(struct usb_ep *ep, void *, dma_addr_t, | ||
81 | unsigned); | ||
82 | static int lh7a40x_queue(struct usb_ep *ep, struct usb_request *, gfp_t); | 78 | static int lh7a40x_queue(struct usb_ep *ep, struct usb_request *, gfp_t); |
83 | static int lh7a40x_dequeue(struct usb_ep *ep, struct usb_request *); | 79 | static int lh7a40x_dequeue(struct usb_ep *ep, struct usb_request *); |
84 | static int lh7a40x_set_halt(struct usb_ep *ep, int); | 80 | static int lh7a40x_set_halt(struct usb_ep *ep, int); |
@@ -104,9 +100,6 @@ static struct usb_ep_ops lh7a40x_ep_ops = { | |||
104 | .alloc_request = lh7a40x_alloc_request, | 100 | .alloc_request = lh7a40x_alloc_request, |
105 | .free_request = lh7a40x_free_request, | 101 | .free_request = lh7a40x_free_request, |
106 | 102 | ||
107 | .alloc_buffer = lh7a40x_alloc_buffer, | ||
108 | .free_buffer = lh7a40x_free_buffer, | ||
109 | |||
110 | .queue = lh7a40x_queue, | 103 | .queue = lh7a40x_queue, |
111 | .dequeue = lh7a40x_dequeue, | 104 | .dequeue = lh7a40x_dequeue, |
112 | 105 | ||
@@ -1134,26 +1127,6 @@ static void lh7a40x_free_request(struct usb_ep *ep, struct usb_request *_req) | |||
1134 | kfree(req); | 1127 | kfree(req); |
1135 | } | 1128 | } |
1136 | 1129 | ||
1137 | static void *lh7a40x_alloc_buffer(struct usb_ep *ep, unsigned bytes, | ||
1138 | dma_addr_t * dma, gfp_t gfp_flags) | ||
1139 | { | ||
1140 | char *retval; | ||
1141 | |||
1142 | DEBUG("%s (%p, %d, %d)\n", __FUNCTION__, ep, bytes, gfp_flags); | ||
1143 | |||
1144 | retval = kmalloc(bytes, gfp_flags & ~(__GFP_DMA | __GFP_HIGHMEM)); | ||
1145 | if (retval) | ||
1146 | *dma = virt_to_bus(retval); | ||
1147 | return retval; | ||
1148 | } | ||
1149 | |||
1150 | static void lh7a40x_free_buffer(struct usb_ep *ep, void *buf, dma_addr_t dma, | ||
1151 | unsigned bytes) | ||
1152 | { | ||
1153 | DEBUG("%s, %p\n", __FUNCTION__, ep); | ||
1154 | kfree(buf); | ||
1155 | } | ||
1156 | |||
1157 | /** Queue one request | 1130 | /** Queue one request |
1158 | * Kickstart transfer if needed | 1131 | * Kickstart transfer if needed |
1159 | * NOTE: Sets INDEX register | 1132 | * NOTE: Sets INDEX register |
diff --git a/drivers/usb/gadget/net2280.c b/drivers/usb/gadget/net2280.c index 00fda334dc72..c3d364ecd4f8 100644 --- a/drivers/usb/gadget/net2280.c +++ b/drivers/usb/gadget/net2280.c | |||
@@ -450,100 +450,6 @@ net2280_free_request (struct usb_ep *_ep, struct usb_request *_req) | |||
450 | 450 | ||
451 | /*-------------------------------------------------------------------------*/ | 451 | /*-------------------------------------------------------------------------*/ |
452 | 452 | ||
453 | /* | ||
454 | * dma-coherent memory allocation (for dma-capable endpoints) | ||
455 | * | ||
456 | * NOTE: the dma_*_coherent() API calls suck. Most implementations are | ||
457 | * (a) page-oriented, so small buffers lose big; and (b) asymmetric with | ||
458 | * respect to calls with irqs disabled: alloc is safe, free is not. | ||
459 | * We currently work around (b), but not (a). | ||
460 | */ | ||
461 | |||
462 | static void * | ||
463 | net2280_alloc_buffer ( | ||
464 | struct usb_ep *_ep, | ||
465 | unsigned bytes, | ||
466 | dma_addr_t *dma, | ||
467 | gfp_t gfp_flags | ||
468 | ) | ||
469 | { | ||
470 | void *retval; | ||
471 | struct net2280_ep *ep; | ||
472 | |||
473 | ep = container_of (_ep, struct net2280_ep, ep); | ||
474 | if (!_ep) | ||
475 | return NULL; | ||
476 | *dma = DMA_ADDR_INVALID; | ||
477 | |||
478 | if (ep->dma) | ||
479 | retval = dma_alloc_coherent(&ep->dev->pdev->dev, | ||
480 | bytes, dma, gfp_flags); | ||
481 | else | ||
482 | retval = kmalloc(bytes, gfp_flags); | ||
483 | return retval; | ||
484 | } | ||
485 | |||
486 | static DEFINE_SPINLOCK(buflock); | ||
487 | static LIST_HEAD(buffers); | ||
488 | |||
489 | struct free_record { | ||
490 | struct list_head list; | ||
491 | struct device *dev; | ||
492 | unsigned bytes; | ||
493 | dma_addr_t dma; | ||
494 | }; | ||
495 | |||
496 | static void do_free(unsigned long ignored) | ||
497 | { | ||
498 | spin_lock_irq(&buflock); | ||
499 | while (!list_empty(&buffers)) { | ||
500 | struct free_record *buf; | ||
501 | |||
502 | buf = list_entry(buffers.next, struct free_record, list); | ||
503 | list_del(&buf->list); | ||
504 | spin_unlock_irq(&buflock); | ||
505 | |||
506 | dma_free_coherent(buf->dev, buf->bytes, buf, buf->dma); | ||
507 | |||
508 | spin_lock_irq(&buflock); | ||
509 | } | ||
510 | spin_unlock_irq(&buflock); | ||
511 | } | ||
512 | |||
513 | static DECLARE_TASKLET(deferred_free, do_free, 0); | ||
514 | |||
515 | static void | ||
516 | net2280_free_buffer ( | ||
517 | struct usb_ep *_ep, | ||
518 | void *address, | ||
519 | dma_addr_t dma, | ||
520 | unsigned bytes | ||
521 | ) { | ||
522 | /* free memory into the right allocator */ | ||
523 | if (dma != DMA_ADDR_INVALID) { | ||
524 | struct net2280_ep *ep; | ||
525 | struct free_record *buf = address; | ||
526 | unsigned long flags; | ||
527 | |||
528 | ep = container_of(_ep, struct net2280_ep, ep); | ||
529 | if (!_ep) | ||
530 | return; | ||
531 | |||
532 | ep = container_of (_ep, struct net2280_ep, ep); | ||
533 | buf->dev = &ep->dev->pdev->dev; | ||
534 | buf->bytes = bytes; | ||
535 | buf->dma = dma; | ||
536 | |||
537 | spin_lock_irqsave(&buflock, flags); | ||
538 | list_add_tail(&buf->list, &buffers); | ||
539 | tasklet_schedule(&deferred_free); | ||
540 | spin_unlock_irqrestore(&buflock, flags); | ||
541 | } else | ||
542 | kfree (address); | ||
543 | } | ||
544 | |||
545 | /*-------------------------------------------------------------------------*/ | ||
546 | |||
547 | /* load a packet into the fifo we use for usb IN transfers. | 453 | /* load a packet into the fifo we use for usb IN transfers. |
548 | * works for all endpoints. | 454 | * works for all endpoints. |
549 | * | 455 | * |
@@ -1392,9 +1298,6 @@ static const struct usb_ep_ops net2280_ep_ops = { | |||
1392 | .alloc_request = net2280_alloc_request, | 1298 | .alloc_request = net2280_alloc_request, |
1393 | .free_request = net2280_free_request, | 1299 | .free_request = net2280_free_request, |
1394 | 1300 | ||
1395 | .alloc_buffer = net2280_alloc_buffer, | ||
1396 | .free_buffer = net2280_free_buffer, | ||
1397 | |||
1398 | .queue = net2280_queue, | 1301 | .queue = net2280_queue, |
1399 | .dequeue = net2280_dequeue, | 1302 | .dequeue = net2280_dequeue, |
1400 | 1303 | ||
diff --git a/drivers/usb/gadget/omap_udc.c b/drivers/usb/gadget/omap_udc.c index c4975a6cf777..9b0f0925dddf 100644 --- a/drivers/usb/gadget/omap_udc.c +++ b/drivers/usb/gadget/omap_udc.c | |||
@@ -296,111 +296,6 @@ omap_free_request(struct usb_ep *ep, struct usb_request *_req) | |||
296 | 296 | ||
297 | /*-------------------------------------------------------------------------*/ | 297 | /*-------------------------------------------------------------------------*/ |
298 | 298 | ||
299 | /* | ||
300 | * dma-coherent memory allocation (for dma-capable endpoints) | ||
301 | * | ||
302 | * NOTE: the dma_*_coherent() API calls suck. Most implementations are | ||
303 | * (a) page-oriented, so small buffers lose big; and (b) asymmetric with | ||
304 | * respect to calls with irqs disabled: alloc is safe, free is not. | ||
305 | * We currently work around (b), but not (a). | ||
306 | */ | ||
307 | |||
308 | static void * | ||
309 | omap_alloc_buffer( | ||
310 | struct usb_ep *_ep, | ||
311 | unsigned bytes, | ||
312 | dma_addr_t *dma, | ||
313 | gfp_t gfp_flags | ||
314 | ) | ||
315 | { | ||
316 | void *retval; | ||
317 | struct omap_ep *ep; | ||
318 | |||
319 | if (!_ep) | ||
320 | return NULL; | ||
321 | |||
322 | ep = container_of(_ep, struct omap_ep, ep); | ||
323 | if (use_dma && ep->has_dma) { | ||
324 | static int warned; | ||
325 | if (!warned && bytes < PAGE_SIZE) { | ||
326 | dev_warn(ep->udc->gadget.dev.parent, | ||
327 | "using dma_alloc_coherent for " | ||
328 | "small allocations wastes memory\n"); | ||
329 | warned++; | ||
330 | } | ||
331 | return dma_alloc_coherent(ep->udc->gadget.dev.parent, | ||
332 | bytes, dma, gfp_flags); | ||
333 | } | ||
334 | |||
335 | retval = kmalloc(bytes, gfp_flags); | ||
336 | if (retval) | ||
337 | *dma = virt_to_phys(retval); | ||
338 | return retval; | ||
339 | } | ||
340 | |||
341 | static DEFINE_SPINLOCK(buflock); | ||
342 | static LIST_HEAD(buffers); | ||
343 | |||
344 | struct free_record { | ||
345 | struct list_head list; | ||
346 | struct device *dev; | ||
347 | unsigned bytes; | ||
348 | dma_addr_t dma; | ||
349 | }; | ||
350 | |||
351 | static void do_free(unsigned long ignored) | ||
352 | { | ||
353 | spin_lock_irq(&buflock); | ||
354 | while (!list_empty(&buffers)) { | ||
355 | struct free_record *buf; | ||
356 | |||
357 | buf = list_entry(buffers.next, struct free_record, list); | ||
358 | list_del(&buf->list); | ||
359 | spin_unlock_irq(&buflock); | ||
360 | |||
361 | dma_free_coherent(buf->dev, buf->bytes, buf, buf->dma); | ||
362 | |||
363 | spin_lock_irq(&buflock); | ||
364 | } | ||
365 | spin_unlock_irq(&buflock); | ||
366 | } | ||
367 | |||
368 | static DECLARE_TASKLET(deferred_free, do_free, 0); | ||
369 | |||
370 | static void omap_free_buffer( | ||
371 | struct usb_ep *_ep, | ||
372 | void *buf, | ||
373 | dma_addr_t dma, | ||
374 | unsigned bytes | ||
375 | ) | ||
376 | { | ||
377 | if (!_ep) { | ||
378 | WARN_ON(1); | ||
379 | return; | ||
380 | } | ||
381 | |||
382 | /* free memory into the right allocator */ | ||
383 | if (dma != DMA_ADDR_INVALID) { | ||
384 | struct omap_ep *ep; | ||
385 | struct free_record *rec = buf; | ||
386 | unsigned long flags; | ||
387 | |||
388 | ep = container_of(_ep, struct omap_ep, ep); | ||
389 | |||
390 | rec->dev = ep->udc->gadget.dev.parent; | ||
391 | rec->bytes = bytes; | ||
392 | rec->dma = dma; | ||
393 | |||
394 | spin_lock_irqsave(&buflock, flags); | ||
395 | list_add_tail(&rec->list, &buffers); | ||
396 | tasklet_schedule(&deferred_free); | ||
397 | spin_unlock_irqrestore(&buflock, flags); | ||
398 | } else | ||
399 | kfree(buf); | ||
400 | } | ||
401 | |||
402 | /*-------------------------------------------------------------------------*/ | ||
403 | |||
404 | static void | 299 | static void |
405 | done(struct omap_ep *ep, struct omap_req *req, int status) | 300 | done(struct omap_ep *ep, struct omap_req *req, int status) |
406 | { | 301 | { |
@@ -1271,9 +1166,6 @@ static struct usb_ep_ops omap_ep_ops = { | |||
1271 | .alloc_request = omap_alloc_request, | 1166 | .alloc_request = omap_alloc_request, |
1272 | .free_request = omap_free_request, | 1167 | .free_request = omap_free_request, |
1273 | 1168 | ||
1274 | .alloc_buffer = omap_alloc_buffer, | ||
1275 | .free_buffer = omap_free_buffer, | ||
1276 | |||
1277 | .queue = omap_ep_queue, | 1169 | .queue = omap_ep_queue, |
1278 | .dequeue = omap_ep_dequeue, | 1170 | .dequeue = omap_ep_dequeue, |
1279 | 1171 | ||
diff --git a/drivers/usb/gadget/pxa2xx_udc.c b/drivers/usb/gadget/pxa2xx_udc.c index 484de6e97662..63b9521c1322 100644 --- a/drivers/usb/gadget/pxa2xx_udc.c +++ b/drivers/usb/gadget/pxa2xx_udc.c | |||
@@ -341,26 +341,6 @@ pxa2xx_ep_free_request (struct usb_ep *_ep, struct usb_request *_req) | |||
341 | kfree(req); | 341 | kfree(req); |
342 | } | 342 | } |
343 | 343 | ||
344 | |||
345 | static void * | ||
346 | pxa2xx_ep_alloc_buffer(struct usb_ep *_ep, unsigned bytes, | ||
347 | dma_addr_t *dma, gfp_t gfp_flags) | ||
348 | { | ||
349 | char *retval; | ||
350 | |||
351 | retval = kmalloc (bytes, gfp_flags & ~(__GFP_DMA|__GFP_HIGHMEM)); | ||
352 | if (retval) | ||
353 | *dma = (dma_addr_t)~0; | ||
354 | return retval; | ||
355 | } | ||
356 | |||
357 | static void | ||
358 | pxa2xx_ep_free_buffer(struct usb_ep *_ep, void *buf, dma_addr_t dma, | ||
359 | unsigned bytes) | ||
360 | { | ||
361 | kfree (buf); | ||
362 | } | ||
363 | |||
364 | /*-------------------------------------------------------------------------*/ | 344 | /*-------------------------------------------------------------------------*/ |
365 | 345 | ||
366 | /* | 346 | /* |
@@ -927,9 +907,6 @@ static struct usb_ep_ops pxa2xx_ep_ops = { | |||
927 | .alloc_request = pxa2xx_ep_alloc_request, | 907 | .alloc_request = pxa2xx_ep_alloc_request, |
928 | .free_request = pxa2xx_ep_free_request, | 908 | .free_request = pxa2xx_ep_free_request, |
929 | 909 | ||
930 | .alloc_buffer = pxa2xx_ep_alloc_buffer, | ||
931 | .free_buffer = pxa2xx_ep_free_buffer, | ||
932 | |||
933 | .queue = pxa2xx_ep_queue, | 910 | .queue = pxa2xx_ep_queue, |
934 | .dequeue = pxa2xx_ep_dequeue, | 911 | .dequeue = pxa2xx_ep_dequeue, |
935 | 912 | ||
diff --git a/drivers/usb/gadget/s3c2410_udc.c b/drivers/usb/gadget/s3c2410_udc.c index d60748add325..0be80c635c48 100644 --- a/drivers/usb/gadget/s3c2410_udc.c +++ b/drivers/usb/gadget/s3c2410_udc.c | |||
@@ -1197,36 +1197,6 @@ s3c2410_udc_free_request(struct usb_ep *_ep, struct usb_request *_req) | |||
1197 | } | 1197 | } |
1198 | 1198 | ||
1199 | /* | 1199 | /* |
1200 | * s3c2410_udc_alloc_buffer | ||
1201 | */ | ||
1202 | static void *s3c2410_udc_alloc_buffer(struct usb_ep *_ep, | ||
1203 | unsigned bytes, dma_addr_t *dma, gfp_t mem_flags) | ||
1204 | { | ||
1205 | char *retval; | ||
1206 | |||
1207 | dprintk(DEBUG_VERBOSE, "%s()\n", __func__); | ||
1208 | |||
1209 | if (!the_controller->driver) | ||
1210 | return NULL; | ||
1211 | |||
1212 | retval = kmalloc (bytes, mem_flags); | ||
1213 | *dma = (dma_addr_t) retval; | ||
1214 | return retval; | ||
1215 | } | ||
1216 | |||
1217 | /* | ||
1218 | * s3c2410_udc_free_buffer | ||
1219 | */ | ||
1220 | static void s3c2410_udc_free_buffer (struct usb_ep *_ep, void *buf, | ||
1221 | dma_addr_t dma, unsigned bytes) | ||
1222 | { | ||
1223 | dprintk(DEBUG_VERBOSE, "%s()\n", __func__); | ||
1224 | |||
1225 | if (bytes) | ||
1226 | kfree (buf); | ||
1227 | } | ||
1228 | |||
1229 | /* | ||
1230 | * s3c2410_udc_queue | 1200 | * s3c2410_udc_queue |
1231 | */ | 1201 | */ |
1232 | static int s3c2410_udc_queue(struct usb_ep *_ep, struct usb_request *_req, | 1202 | static int s3c2410_udc_queue(struct usb_ep *_ep, struct usb_request *_req, |
@@ -1441,9 +1411,6 @@ static const struct usb_ep_ops s3c2410_ep_ops = { | |||
1441 | .alloc_request = s3c2410_udc_alloc_request, | 1411 | .alloc_request = s3c2410_udc_alloc_request, |
1442 | .free_request = s3c2410_udc_free_request, | 1412 | .free_request = s3c2410_udc_free_request, |
1443 | 1413 | ||
1444 | .alloc_buffer = s3c2410_udc_alloc_buffer, | ||
1445 | .free_buffer = s3c2410_udc_free_buffer, | ||
1446 | |||
1447 | .queue = s3c2410_udc_queue, | 1414 | .queue = s3c2410_udc_queue, |
1448 | .dequeue = s3c2410_udc_dequeue, | 1415 | .dequeue = s3c2410_udc_dequeue, |
1449 | 1416 | ||