aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/usb/core/buffer.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/usb/core/buffer.c')
-rw-r--r--drivers/usb/core/buffer.c21
1 files changed, 14 insertions, 7 deletions
diff --git a/drivers/usb/core/buffer.c b/drivers/usb/core/buffer.c
index 2c6965484fe..08e33fbeccd 100644
--- a/drivers/usb/core/buffer.c
+++ b/drivers/usb/core/buffer.c
@@ -115,9 +115,14 @@ void *hcd_buffer_alloc(
return kmalloc(size, mem_flags);
}
- for (i = 0; i < HCD_BUFFER_POOLS; i++) {
- if (size <= pool_max [i])
- return dma_pool_alloc(hcd->pool [i], mem_flags, dma);
+ /* we won't use internal SRAM as data payload, when we can't get
+ any benefits from it */
+ if (!hcd->has_sram || !hcd->sram_no_payload) {
+ for (i = 0; i < HCD_BUFFER_POOLS; i++) {
+ if (size <= pool_max [i])
+ return dma_pool_alloc(hcd->pool [i],
+ mem_flags, dma);
+ }
}
return dma_alloc_coherent(hcd->self.controller, size, dma, mem_flags);
}
@@ -141,10 +146,12 @@ void hcd_buffer_free(
return;
}
- for (i = 0; i < HCD_BUFFER_POOLS; i++) {
- if (size <= pool_max [i]) {
- dma_pool_free(hcd->pool [i], addr, dma);
- return;
+ if (!hcd->has_sram || !hcd->sram_no_payload) {
+ for (i = 0; i < HCD_BUFFER_POOLS; i++) {
+ if (size <= pool_max [i]) {
+ dma_pool_free(hcd->pool [i], addr, dma);
+ return;
+ }
}
}
dma_free_coherent(hcd->self.controller, size, addr, dma);