Commit 14360ab7 authored by Ralf Baechle's avatar Ralf Baechle Committed by Greg Kroah-Hartman

USB: goku_udc: Remove crude cache coherency code

This is deep architecture specific magic and does should not to exist
in a driver.
Signed-off-by: default avatarRalf Baechle <ralf@linux-mips.org>
Cc: David Brownell <dbrownell@users.sourceforge.net>
Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@suse.de>
parent 0d8c7aea
...@@ -297,27 +297,6 @@ goku_free_request(struct usb_ep *_ep, struct usb_request *_req) ...@@ -297,27 +297,6 @@ goku_free_request(struct usb_ep *_ep, struct usb_request *_req)
/*-------------------------------------------------------------------------*/ /*-------------------------------------------------------------------------*/
#undef USE_KMALLOC
/* many common platforms have dma-coherent caches, which means that it's
* safe to use kmalloc() memory for all i/o buffers without using any
* cache flushing calls. (unless you're trying to share cache lines
* between dma and non-dma activities, which is a slow idea in any case.)
*
* other platforms need more care, with 2.6 having a moderately general
* solution except for the common "buffer is smaller than a page" case.
*/
#if defined(CONFIG_X86)
#define USE_KMALLOC
#elif defined(CONFIG_MIPS) && !defined(CONFIG_DMA_NONCOHERENT)
#define USE_KMALLOC
#elif defined(CONFIG_PPC) && !defined(CONFIG_NOT_COHERENT_CACHE)
#define USE_KMALLOC
#endif
/* allocating buffers this way eliminates dma mapping overhead, which /* allocating buffers this way eliminates dma mapping overhead, which
* on some platforms will mean eliminating a per-io buffer copy. with * on some platforms will mean eliminating a per-io buffer copy. with
* some kinds of system caches, further tweaks may still be needed. * some kinds of system caches, further tweaks may still be needed.
...@@ -334,11 +313,6 @@ goku_alloc_buffer(struct usb_ep *_ep, unsigned bytes, ...@@ -334,11 +313,6 @@ goku_alloc_buffer(struct usb_ep *_ep, unsigned bytes,
return NULL; return NULL;
*dma = DMA_ADDR_INVALID; *dma = DMA_ADDR_INVALID;
#if defined(USE_KMALLOC)
retval = kmalloc(bytes, gfp_flags);
if (retval)
*dma = virt_to_phys(retval);
#else
if (ep->dma) { if (ep->dma) {
/* the main problem with this call is that it wastes memory /* the main problem with this call is that it wastes memory
* on typical 1/N page allocations: it allocates 1-N pages. * on typical 1/N page allocations: it allocates 1-N pages.
...@@ -348,7 +322,6 @@ goku_alloc_buffer(struct usb_ep *_ep, unsigned bytes, ...@@ -348,7 +322,6 @@ goku_alloc_buffer(struct usb_ep *_ep, unsigned bytes,
bytes, dma, gfp_flags); bytes, dma, gfp_flags);
} else } else
retval = kmalloc(bytes, gfp_flags); retval = kmalloc(bytes, gfp_flags);
#endif
return retval; return retval;
} }
...@@ -356,7 +329,6 @@ static void ...@@ -356,7 +329,6 @@ static void
goku_free_buffer(struct usb_ep *_ep, void *buf, dma_addr_t dma, unsigned bytes) goku_free_buffer(struct usb_ep *_ep, void *buf, dma_addr_t dma, unsigned bytes)
{ {
/* free memory into the right allocator */ /* free memory into the right allocator */
#ifndef USE_KMALLOC
if (dma != DMA_ADDR_INVALID) { if (dma != DMA_ADDR_INVALID) {
struct goku_ep *ep; struct goku_ep *ep;
...@@ -365,7 +337,6 @@ goku_free_buffer(struct usb_ep *_ep, void *buf, dma_addr_t dma, unsigned bytes) ...@@ -365,7 +337,6 @@ goku_free_buffer(struct usb_ep *_ep, void *buf, dma_addr_t dma, unsigned bytes)
return; return;
dma_free_coherent(&ep->dev->pdev->dev, bytes, buf, dma); dma_free_coherent(&ep->dev->pdev->dev, bytes, buf, dma);
} else } else
#endif
kfree (buf); kfree (buf);
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment