summaryrefslogtreecommitdiffstats
path: root/driver/kmem.c
diff options
context:
space:
mode:
Diffstat (limited to 'driver/kmem.c')
-rw-r--r--driver/kmem.c17
1 files changed, 12 insertions, 5 deletions
diff --git a/driver/kmem.c b/driver/kmem.c
index b8ce0d0..4f36e79 100644
--- a/driver/kmem.c
+++ b/driver/kmem.c
@@ -24,6 +24,11 @@
#include "kmem.h" /* prototypes for kernel memory */
#include "sysfs.h" /* prototypes for sysfs */
+/* VM_RESERVED is removed in 3.7-rc1 */
+#ifndef VM_RESERVED
+# define VM_RESERVED (VM_DONTEXPAND | VM_DONTDUMP)
+#endif
+
/**
*
* Allocates new kernel memory including the corresponding management structure, makes
@@ -32,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;
@@ -139,12 +145,17 @@ int pcidriver_kmem_alloc(pcidriver_privdata_t *privdata, kmem_handle_t *kmem_han
}
break;
case PCILIB_KMEM_TYPE_PAGE:
+ 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;
+
if (kmem_handle->size == 0)
kmem_handle->size = PAGE_SIZE;
else if (kmem_handle->size%PAGE_SIZE)
goto kmem_alloc_mem_fail;
- retptr = (void*)__get_free_pages(GFP_KERNEL|__GFP_DMA, get_order(kmem_handle->size));
+ retptr = (void*)__get_free_pages(flags, get_order(kmem_handle->size));
kmem_entry->dma_handle = 0;
if (retptr) {
@@ -621,10 +632,6 @@ int pcidriver_mmap_kmem(pcidriver_privdata_t *privdata, struct vm_area_struct *v
page_to_pfn(virt_to_page((void*)kmem_entry->cpua)));
if ((kmem_entry->type&PCILIB_KMEM_TYPE_MASK) == PCILIB_KMEM_TYPE_REGION) {
- mod_info("Mapping address %08lx / Size %08lx\n",
- (unsigned long)kmem_entry->dma_handle,
- (vma_size < kmem_entry->size)?vma_size:kmem_entry->size);
-
ret = remap_pfn_range_compat(
vma,
vma->vm_start,