What is difference between __va() and phys_to_virt() ,what is need of these two separate implementation for same purpose, any difference between these two?
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 are equals.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With