summaryrefslogtreecommitdiffstats
path: root/driver
diff options
context:
space:
mode:
authorSuren A. Chilingaryan <csa@suren.me>2014-04-02 23:28:35 +0200
committerSuren A. Chilingaryan <csa@suren.me>2014-04-02 23:28:35 +0200
commitd8c13eb6ff5a1c9cc28617d83dbde454c7222be4 (patch)
tree41df427123d96b0887a0c86e9bbfb44c4ba7109f /driver
parente6a8592b05d25d33eaaa8241f5081b1099f56fd0 (diff)
downloadpcitool-d8c13eb6ff5a1c9cc28617d83dbde454c7222be4.tar.gz
pcitool-d8c13eb6ff5a1c9cc28617d83dbde454c7222be4.tar.bz2
pcitool-d8c13eb6ff5a1c9cc28617d83dbde454c7222be4.tar.xz
pcitool-d8c13eb6ff5a1c9cc28617d83dbde454c7222be4.zip
Add __GFP_DMA flag while allocating DMA buffers
Diffstat (limited to 'driver')
-rw-r--r--driver/kmem.c8
1 files changed, 7 insertions, 1 deletions
diff --git a/driver/kmem.c b/driver/kmem.c
index 0da37bb..f6e22a1 100644
--- a/driver/kmem.c
+++ b/driver/kmem.c
@@ -37,6 +37,7 @@
*/
int pcidriver_kmem_alloc(pcidriver_privdata_t *privdata, kmem_handle_t *kmem_handle)
{
+ int flags;
pcidriver_kmem_entry_t *kmem_entry;
void *retptr;
@@ -135,7 +136,12 @@ int pcidriver_kmem_alloc(pcidriver_privdata_t *privdata, kmem_handle_t *kmem_han
retptr = pci_alloc_consistent( privdata->pdev, kmem_handle->size, &(kmem_entry->dma_handle) );
break;
case PCILIB_KMEM_TYPE_PAGE:
- retptr = (void*)__get_free_pages(GFP_KERNEL, get_order(PAGE_SIZE));
+ flags = GFP_KERNEL;
+
+ if ((kmem_entry->type == PCILIB_KMEM_TYPE_DMA_S2C_PAGE)||(kmem_entry->type == PCILIB_KMEM_TYPE_DMA_C2S_PAGE))
+ flags |= __GFP_DMA;
+
+ retptr = (void*)__get_free_pages(flags, get_order(PAGE_SIZE));
kmem_entry->dma_handle = 0;
kmem_handle->size = PAGE_SIZE;