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: Ralf Baechle <ralf@linux-mips.org>
Cc: David Brownell <dbrownell@users.sourceforge.net>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>

authored by Ralf Baechle and committed by Greg Kroah-Hartman 14360ab7 0d8c7aea

-29
-29
drivers/usb/gadget/goku_udc.c
··· 297 298 /*-------------------------------------------------------------------------*/ 299 300 - #undef USE_KMALLOC 301 - 302 - /* many common platforms have dma-coherent caches, which means that it's 303 - * safe to use kmalloc() memory for all i/o buffers without using any 304 - * cache flushing calls. (unless you're trying to share cache lines 305 - * between dma and non-dma activities, which is a slow idea in any case.) 306 - * 307 - * other platforms need more care, with 2.6 having a moderately general 308 - * solution except for the common "buffer is smaller than a page" case. 309 - */ 310 - #if defined(CONFIG_X86) 311 - #define USE_KMALLOC 312 - 313 - #elif defined(CONFIG_MIPS) && !defined(CONFIG_DMA_NONCOHERENT) 314 - #define USE_KMALLOC 315 - 316 - #elif defined(CONFIG_PPC) && !defined(CONFIG_NOT_COHERENT_CACHE) 317 - #define USE_KMALLOC 318 - 319 - #endif 320 - 321 /* allocating buffers this way eliminates dma mapping overhead, which 322 * on some platforms will mean eliminating a per-io buffer copy. with 323 * some kinds of system caches, further tweaks may still be needed. ··· 313 return NULL; 314 *dma = DMA_ADDR_INVALID; 315 316 - #if defined(USE_KMALLOC) 317 - retval = kmalloc(bytes, gfp_flags); 318 - if (retval) 319 - *dma = virt_to_phys(retval); 320 - #else 321 if (ep->dma) { 322 /* the main problem with this call is that it wastes memory 323 * on typical 1/N page allocations: it allocates 1-N pages. ··· 322 bytes, dma, gfp_flags); 323 } else 324 retval = kmalloc(bytes, gfp_flags); 325 - #endif 326 return retval; 327 } 328 ··· 329 goku_free_buffer(struct usb_ep *_ep, void *buf, dma_addr_t dma, unsigned bytes) 330 { 331 /* free memory into the right allocator */ 332 - #ifndef USE_KMALLOC 333 if (dma != DMA_ADDR_INVALID) { 334 struct goku_ep *ep; 335 ··· 337 return; 338 dma_free_coherent(&ep->dev->pdev->dev, bytes, buf, dma); 339 } else 340 - #endif 341 kfree (buf); 342 } 343
··· 297 298 /*-------------------------------------------------------------------------*/ 299 300 /* allocating buffers this way eliminates dma mapping overhead, which 301 * on some platforms will mean eliminating a per-io buffer copy. with 302 * some kinds of system caches, further tweaks may still be needed. ··· 334 return NULL; 335 *dma = DMA_ADDR_INVALID; 336 337 if (ep->dma) { 338 /* the main problem with this call is that it wastes memory 339 * on typical 1/N page allocations: it allocates 1-N pages. ··· 348 bytes, dma, gfp_flags); 349 } else 350 retval = kmalloc(bytes, gfp_flags); 351 return retval; 352 } 353 ··· 356 goku_free_buffer(struct usb_ep *_ep, void *buf, dma_addr_t dma, unsigned bytes) 357 { 358 /* free memory into the right allocator */ 359 if (dma != DMA_ADDR_INVALID) { 360 struct goku_ep *ep; 361 ··· 365 return; 366 dma_free_coherent(&ep->dev->pdev->dev, bytes, buf, dma); 367 } else 368 kfree (buf); 369 } 370