Skip to content

Commit 012dcef

Browse files
Christoph Hellwigdjbw
authored andcommitted
mm: move __phys_to_pfn and __pfn_to_phys to asm/generic/memory_model.h
Three architectures already define these, and we'll need them genericly soon. Signed-off-by: Christoph Hellwig <[email protected]> Signed-off-by: Dan Williams <[email protected]>
1 parent cb389b9 commit 012dcef

File tree

4 files changed

+6
-18
lines changed

4 files changed

+6
-18
lines changed

arch/arm/include/asm/memory.h

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -118,12 +118,6 @@
118118
#define DTCM_OFFSET UL(0xfffe8000)
119119
#endif
120120

121-
/*
122-
* Convert a physical address to a Page Frame Number and back
123-
*/
124-
#define __phys_to_pfn(paddr) ((unsigned long)((paddr) >> PAGE_SHIFT))
125-
#define __pfn_to_phys(pfn) ((phys_addr_t)(pfn) << PAGE_SHIFT)
126-
127121
/*
128122
* Convert a page to/from a physical address
129123
*/

arch/arm64/include/asm/memory.h

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -80,12 +80,6 @@
8080
#define __virt_to_phys(x) (((phys_addr_t)(x) - PAGE_OFFSET + PHYS_OFFSET))
8181
#define __phys_to_virt(x) ((unsigned long)((x) - PHYS_OFFSET + PAGE_OFFSET))
8282

83-
/*
84-
* Convert a physical address to a Page Frame Number and back
85-
*/
86-
#define __phys_to_pfn(paddr) ((unsigned long)((paddr) >> PAGE_SHIFT))
87-
#define __pfn_to_phys(pfn) ((phys_addr_t)(pfn) << PAGE_SHIFT)
88-
8983
/*
9084
* Convert a page to/from a physical address
9185
*/

arch/unicore32/include/asm/memory.h

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -60,12 +60,6 @@
6060
#define __phys_to_virt(x) ((x) - PHYS_OFFSET + PAGE_OFFSET)
6161
#endif
6262

63-
/*
64-
* Convert a physical address to a Page Frame Number and back
65-
*/
66-
#define __phys_to_pfn(paddr) ((paddr) >> PAGE_SHIFT)
67-
#define __pfn_to_phys(pfn) ((pfn) << PAGE_SHIFT)
68-
6963
/*
7064
* Convert a page to/from a physical address
7165
*/

include/asm-generic/memory_model.h

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -69,6 +69,12 @@
6969
})
7070
#endif /* CONFIG_FLATMEM/DISCONTIGMEM/SPARSEMEM */
7171

72+
/*
73+
* Convert a physical address to a Page Frame Number and back
74+
*/
75+
#define __phys_to_pfn(paddr) ((unsigned long)((paddr) >> PAGE_SHIFT))
76+
#define __pfn_to_phys(pfn) ((pfn) << PAGE_SHIFT)
77+
7278
#define page_to_pfn __page_to_pfn
7379
#define pfn_to_page __pfn_to_page
7480

0 commit comments

Comments
 (0)