From 79dbc09e09d48ebb4a087f003789a8bf22d2cc13 Mon Sep 17 00:00:00 2001 From: Holger Waechtler Date: Fri, 24 Jan 2003 12:26:47 +0000 Subject: implement vmalloc_to_page() again in order to maintain backward compatibility --- linux/drivers/media/dvb/dvb-core/compat.c | 23 +++++++++++++++++++++++ linux/drivers/media/dvb/dvb-core/compat.h | 7 +++++++ 2 files changed, 30 insertions(+) (limited to 'linux') diff --git a/linux/drivers/media/dvb/dvb-core/compat.c b/linux/drivers/media/dvb/dvb-core/compat.c index 40280c8aa..255d89616 100644 --- a/linux/drivers/media/dvb/dvb-core/compat.c +++ b/linux/drivers/media/dvb/dvb-core/compat.c @@ -128,3 +128,26 @@ EXPORT_SYMBOL(crc32_le); #endif +#if (LINUX_VERSION_CODE < KERNEL_VERSION(2,5,0)) +struct page * vmalloc_to_page(void *vmalloc_addr) +{ + unsigned long addr = (unsigned long) vmalloc_addr; + struct page *page = NULL; + pgd_t *pgd = pgd_offset_k(addr); + pmd_t *pmd; + pte_t *ptep, pte; + + if (!pgd_none(*pgd)) { + pmd = pmd_offset(pgd, addr); + if (!pmd_none(*pmd)) { + ptep = pte_offset(pmd, addr); + pte = *ptep; + if (pte_present(pte)) + page = pte_page(pte); + } + } + return page; +} +EXPORT_SYMBOL(vmalloc_to_page); +#endif + diff --git a/linux/drivers/media/dvb/dvb-core/compat.h b/linux/drivers/media/dvb/dvb-core/compat.h index 2e38e0042..49f32ecbd 100644 --- a/linux/drivers/media/dvb/dvb-core/compat.h +++ b/linux/drivers/media/dvb/dvb-core/compat.h @@ -80,5 +80,12 @@ int try_module_get(struct module *mod) #endif +#if LINUX_VERSION_CODE < KERNEL_VERSION(2,5,0) + +extern struct page * vmalloc_to_page(void *addr); + +#endif + + #endif -- cgit v1.2.3