kernels/linux-2.4.0/drivers/usb/ibmcam.c
/* Given PGD from the address space's page table, return the kernel
 * virtual mapping of the physical memory mapped at ADR.
 */
Given PGD from the address space's page table, return the kernel
virtual mapping of the physical memory mapped at ADR.
Given PGD from the address space ' s page table return the kernel virtual mapping of the physical memory mapped at ADR .
static inline unsigned long uvirt_to_kva(pgd_t *pgd, unsigned long adr)
{
	unsigned long ret = 0UL;
	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 = (unsigned long) page_address(pte_page(pte));
				ret |= (adr & (PAGE_SIZE - 1));
			}
		}
	}
	MDEBUG(printk("uv2kva(%lx-->%lx)", adr, ret));
	return ret;
}
static inline unsigned long uvirt_to_kva ( pgd_t * pgd , unsigned long adr ) { unsigned long ret = 0UL ; 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 = ( unsigned long ) page_address ( pte_page ( pte ) ) ; ret |= ( adr & ( PAGE_SIZE - 1 ) ) ; } } } MDEBUG ( printk ( " " , adr , ret ) ) ; return ret ; }
Given PGD from the address space's page table, return the kernel
 virtual mapping of the physical memory mapped at ADR.
Given PGD from the address space ' s page table return the kernel virtual mapping of the physical memory mapped at ADR .