What is the difference between __va () and phys_to_virt ()?

What is the difference between __va () and phys_to_virt (), what do these two separate implementations need for the same purpose, is there any difference between the two?

+4
source share
1 answer

phys_to_virt and __va are preprocessor macros. phys_to_virt:

#if !defined(CONFIG_MMU)
#define virt_to_phys(address)   ((unsigned long)(address))
#define phys_to_virt(address)   ((void *)(address))
#else
#define virt_to_phys(address)   (__pa(address))
#define phys_to_virt(address)   (__va(address))
#endif

And __va

#define __va(x) ((void *)((unsigned long) (x)))

If CONFIG_MMU is not defined, then equal.

+3
source

All Articles