summaryrefslogtreecommitdiffstats
path: root/driver/kmem.c
diff options
context:
space:
mode:
authorSuren A. Chilingaryan <csa@suren.me>2015-11-20 14:24:17 +0100
committerSuren A. Chilingaryan <csa@suren.me>2015-11-20 14:24:17 +0100
commitcc5107c6d3db46ba213db974c630fc0fa1b89d68 (patch)
tree6c16375da1d5c7c5d4d853c5e0ba7775bbc99c8a /driver/kmem.c
parent517ecf828e60e1e364c3ab6e67c2acd8a3c1b0c1 (diff)
downloadpcitool-cc5107c6d3db46ba213db974c630fc0fa1b89d68.tar.gz
pcitool-cc5107c6d3db46ba213db974c630fc0fa1b89d68.tar.bz2
pcitool-cc5107c6d3db46ba213db974c630fc0fa1b89d68.tar.xz
pcitool-cc5107c6d3db46ba213db974c630fc0fa1b89d68.zip
Configure number of DMA buffers in IPEDMA and improve checking and reporting inconsistent kmem buffers while re-using
Diffstat (limited to 'driver/kmem.c')
-rw-r--r--driver/kmem.c8
1 files changed, 6 insertions, 2 deletions
diff --git a/driver/kmem.c b/driver/kmem.c
index 7539ae6..618b5bf 100644
--- a/driver/kmem.c
+++ b/driver/kmem.c
@@ -53,23 +53,27 @@ int pcidriver_kmem_alloc(pcidriver_privdata_t *privdata, kmem_handle_t *kmem_han
} else {
if (kmem_handle->type != kmem_entry->type) {
mod_info("Invalid type of reusable kmem_entry, currently: %lu, but requested: %lu\n", kmem_entry->type, kmem_handle->type);
+ kmem_handle->type = kmem_entry->type;
return -EINVAL;
}
if (((kmem_handle->type&PCILIB_KMEM_TYPE_MASK) == PCILIB_KMEM_TYPE_PAGE)&&(kmem_handle->size == 0)) {
- kmem_handle->size = kmem_entry->size;
+ kmem_handle->size = kmem_entry->size;
} else if (kmem_handle->size != kmem_entry->size) {
mod_info("Invalid size of reusable kmem_entry, currently: %lu, but requested: %lu\n", kmem_entry->size, kmem_handle->size);
+ kmem_handle->size = kmem_entry->size;
return -EINVAL;
}
-
+
if (kmem_handle->align != kmem_entry->align) {
mod_info("Invalid alignment of reusable kmem_entry, currently: %lu, but requested: %lu\n", kmem_entry->align, kmem_handle->align);
+ kmem_handle->align = kmem_entry->align;
return -EINVAL;
}
if (((kmem_entry->mode&KMEM_MODE_EXCLUSIVE)?1:0) != ((flags&KMEM_FLAG_EXCLUSIVE)?1:0)) {
mod_info("Invalid mode of reusable kmem_entry\n");
+ kmem_handle->flags = (kmem_entry->mode&KMEM_MODE_EXCLUSIVE)?KMEM_FLAG_EXCLUSIVE:0;
return -EINVAL;
}
}