summaryrefslogtreecommitdiffstats
path: root/drivers/usb/core/buffer.c
diff options
context:
space:
mode:
authorMagnus Damm <magnus.damm@gmail.com>2008-01-23 15:58:35 +0900
committerGreg Kroah-Hartman <gregkh@suse.de>2008-02-01 14:35:05 -0800
commitb3476675320eda83cf061a686cdc80b76f2bfdc4 (patch)
tree11d31a0ade5c961fd5738a67b99ccb411325607d /drivers/usb/core/buffer.c
parent0915f490d81c1a5098b399ec6c0be45bd421ee1d (diff)
downloadop-kernel-dev-b3476675320eda83cf061a686cdc80b76f2bfdc4.zip
op-kernel-dev-b3476675320eda83cf061a686cdc80b76f2bfdc4.tar.gz
usb: dma bounce buffer support
usb: dma bounce buffer support V4 This patch adds dma bounce buffer support to the usb core. These buffers can be enabled with the HCD_LOCAL_MEM flag, and they make sure that all data passed to the host controller is allocated using dma_alloc_coherent(). Signed-off-by: Magnus Damm <damm@igel.co.jp> Acked-by: Alan Stern <stern@rowland.harvard.edu> Acked-by: David Brownell <dbrownell@users.sourceforge.net> Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
Diffstat (limited to 'drivers/usb/core/buffer.c')
-rw-r--r--drivers/usb/core/buffer.c9
1 files changed, 6 insertions, 3 deletions
diff --git a/drivers/usb/core/buffer.c b/drivers/usb/core/buffer.c
index 28d4972..acd9f00 100644
--- a/drivers/usb/core/buffer.c
+++ b/drivers/usb/core/buffer.c
@@ -53,7 +53,8 @@ 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++) {
@@ -107,7 +108,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);
}
@@ -132,7 +134,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;
}
OpenPOWER on IntegriCloud