From: David Schleef Date: Wed, 4 Sep 2002 21:41:08 +0000 (+0000) Subject: remember to reserve buffer after allocating it X-Git-Tag: r0_7_66~110 X-Git-Url: http://git.tremily.us/?a=commitdiff_plain;h=1ebd1ef708f16653c382b210acefcbaebea71e4e;p=comedi.git remember to reserve buffer after allocating it --- 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;