Merge branches 'release', 'asus', 'sony-laptop' and 'thinkpad' into release
[pandora-kernel.git] / drivers / usb / core / buffer.c
index ead2475..cadb2dc 100644 (file)
@@ -11,7 +11,6 @@
 #include <linux/device.h>
 #include <linux/mm.h>
 #include <asm/io.h>
-#include <asm/scatterlist.h>
 #include <linux/dma-mapping.h>
 #include <linux/dmapool.h>
 #include <linux/usb.h>
@@ -54,11 +53,13 @@ int hcd_buffer_create(struct usb_hcd *hcd)
        char            name[16];
        int             i, size;
 
-       if (!hcd->self.controller->dma_mask)
+       if (!hcd->self.controller->dma_mask &&
+           !(hcd->driver->flags & HCD_LOCAL_MEM))
                return 0;
 
-       for (i = 0; i < HCD_BUFFER_POOLS; i++) { 
-               if (!(size = pool_max [i]))
+       for (i = 0; i < HCD_BUFFER_POOLS; i++) {
+               size = pool_max[i];
+               if (!size)
                        continue;
                snprintf(name, sizeof name, "buffer-%d", size);
                hcd->pool[i] = dma_pool_create(name, hcd->self.controller,
@@ -81,10 +82,10 @@ int hcd_buffer_create(struct usb_hcd *hcd)
  */
 void hcd_buffer_destroy(struct usb_hcd *hcd)
 {
-       int             i;
+       int i;
 
-       for (i = 0; i < HCD_BUFFER_POOLS; i++) { 
-               struct dma_pool         *pool = hcd->pool[i];
+       for (i = 0; i < HCD_BUFFER_POOLS; i++) {
+               struct dma_pool *pool = hcd->pool[i];
                if (pool) {
                        dma_pool_destroy(pool);
                        hcd->pool[i] = NULL;
@@ -108,7 +109,8 @@ void *hcd_buffer_alloc(
        int                     i;
 
        /* some USB hosts just use PIO */
-       if (!bus->controller->dma_mask) {
+       if (!bus->controller->dma_mask &&
+           !(hcd->driver->flags & HCD_LOCAL_MEM)) {
                *dma = ~(dma_addr_t) 0;
                return kmalloc(size, mem_flags);
        }
@@ -133,7 +135,8 @@ void hcd_buffer_free(
        if (!addr)
                return;
 
-       if (!bus->controller->dma_mask) {
+       if (!bus->controller->dma_mask &&
+           !(hcd->driver->flags & HCD_LOCAL_MEM)) {
                kfree(addr);
                return;
        }