From: David Schleef Date: Fri, 13 Oct 2000 09:27:15 +0000 (+0000) Subject: fixes for kernel >=2.4.0-test7 X-Git-Tag: r0_7_50~4 X-Git-Url: http://git.tremily.us/?a=commitdiff_plain;h=412c857a4be7e13eff851f71e81ce369b6d6ac0f;p=comedi.git fixes for kernel >=2.4.0-test7 --- diff --git a/comedi/kvmem.c b/comedi/kvmem.c index 6ed3874a..d23b8fb5 100644 --- a/comedi/kvmem.c +++ b/comedi/kvmem.c @@ -6,7 +6,11 @@ void * rvmalloc(unsigned long size) void * mem; unsigned long adr, page; +#if LINUX_VERSION_CODE < 0x020300 mem=vmalloc(size); +#else + mem=vmalloc_32(size); +#endif if (mem) { memset(mem, 0, size); /* Clear the ram out, no junk to the user */ @@ -18,7 +22,7 @@ void * rvmalloc(unsigned long size) mem_map_reserve(MAP_NR(phys_to_virt(page))); #else page = kvirt_to_pa(adr); - mem_map_reserve(MAP_NR(__va(page))); + mem_map_reserve(virt_to_page(__va(page))); #endif adr+=PAGE_SIZE; size-=PAGE_SIZE; @@ -41,7 +45,7 @@ void rvfree(void * mem, unsigned long size) mem_map_unreserve(MAP_NR(phys_to_virt(page))); #else page = kvirt_to_pa(adr); - mem_map_unreserve(MAP_NR(__va(page))); + mem_map_unreserve(virt_to_page(__va(page))); #endif adr+=PAGE_SIZE; size-=PAGE_SIZE; diff --git a/comedi/kvmem.h b/comedi/kvmem.h index a09427e8..deb540a4 100644 --- a/comedi/kvmem.h +++ b/comedi/kvmem.h @@ -59,14 +59,15 @@ static inline unsigned long uvirt_to_kva(pgd_t *pgd, unsigned long adr) pmd_t *pmd; pte_t *ptep, pte; - if(!pgd_none(*pgd)) { pmd = pmd_offset(pgd, adr); if (!pmd_none(*pmd)) { ptep = pte_offset(pmd, adr); pte = *ptep; - if(pte_present(pte)) - ret = (page_address(pte_page(pte))|(adr&(PAGE_SIZE-1))); + if(pte_present(pte)){ + ret = (unsigned long) page_address(pte_page(pte)); + ret |= (adr&(PAGE_SIZE-1)); + } } } return ret;