From 1ebd1ef708f16653c382b210acefcbaebea71e4e Mon Sep 17 00:00:00 2001 From: David Schleef Date: Wed, 4 Sep 2002 21:41:08 +0000 Subject: [PATCH] remember to reserve buffer after allocating it --- comedi/drivers/mite.c | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) diff --git a/comedi/drivers/mite.c b/comedi/drivers/mite.c index 7deaef5d..2b000b55 100644 --- a/comedi/drivers/mite.c +++ b/comedi/drivers/mite.c @@ -409,6 +409,18 @@ int mite_buf_alloc(struct mite_struct *mite, comedi_async *async, #ifdef USE_KMALLOC kfree(async->prealloc_buf); #else + { + unsigned long addr = (unsigned long)async->prealloc_buf; + unsigned long size = async->prealloc_bufsz; + unsigned long page; + + while(size>0){ + page = kvirt_to_pa(addr); + mem_map_unreserve(virt_to_page(__va(page))); + addr += PAGE_SIZE; + size -= PAGE_SIZE; + } + } vfree(async->prealloc_buf); #endif async->prealloc_buf = NULL; @@ -420,6 +432,18 @@ int mite_buf_alloc(struct mite_struct *mite, comedi_async *async, async->prealloc_buf = kmalloc(new_size, GFP_KERNEL); #else async->prealloc_buf = vmalloc_32(new_size); + { + unsigned long addr = (unsigned long)async->prealloc_buf; + unsigned long size = async->prealloc_bufsz; + unsigned long page; + + while(size>0){ + page = kvirt_to_pa(addr); + mem_map_reserve(virt_to_page(__va(page))); + addr += PAGE_SIZE; + size -= PAGE_SIZE; + } + } #endif if(async->prealloc_buf == NULL){ async->prealloc_bufsz = 0; -- 2.26.2