diff options
| author | Chen Gang <[email protected]> | 2016-01-14 15:18:33 -0800 |
|---|---|---|
| committer | Linus Torvalds <[email protected]> | 2016-01-14 16:00:49 -0800 |
| commit | 8f235d1a3eb7198affe7cadf676a10afb8a46a1a (patch) | |
| tree | 78f5ec435417423e50a3a3d59a0af8abbf5cd15c /include/linux | |
| parent | 3aa2385111168187f24a6db04697c6fab0fab9b4 (diff) | |
mm: add PHYS_PFN, use it in __phys_to_pfn()
__phys_to_pfn and __pfn_to_phys are symmetric, PHYS_PFN and PFN_PHYS are
semmetric:
- y = (phys_addr_t)x << PAGE_SHIFT
- y >> PAGE_SHIFT = (phys_add_t)x
- (unsigned long)(y >> PAGE_SHIFT) = x
[[email protected]: use macro arg name `x']
[[email protected]: include linux/pfn.h for PHYS_PFN definition]
Signed-off-by: Chen Gang <[email protected]>
Cc: Oleg Nesterov <[email protected]>
Signed-off-by: Arnd Bergmann <[email protected]>
Signed-off-by: Andrew Morton <[email protected]>
Signed-off-by: Linus Torvalds <[email protected]>
Diffstat (limited to 'include/linux')
| -rw-r--r-- | include/linux/pfn.h | 1 |
1 files changed, 1 insertions, 0 deletions
diff --git a/include/linux/pfn.h b/include/linux/pfn.h index 7646637221f3..97f3e88aead4 100644 --- a/include/linux/pfn.h +++ b/include/linux/pfn.h @@ -9,5 +9,6 @@ #define PFN_UP(x) (((x) + PAGE_SIZE-1) >> PAGE_SHIFT) #define PFN_DOWN(x) ((x) >> PAGE_SHIFT) #define PFN_PHYS(x) ((phys_addr_t)(x) << PAGE_SHIFT) +#define PHYS_PFN(x) ((unsigned long)((x) >> PAGE_SHIFT)) #endif |