The function with its comment is a useful clue for understanding the
code, so move it at the very top.

Signed-off-by: Ahmad Fatoum <a.fat...@pengutronix.de>
---
 arch/arm/cpu/mmu_64.c | 66 +++++++++++++++++++++----------------------
 1 file changed, 33 insertions(+), 33 deletions(-)

diff --git a/arch/arm/cpu/mmu_64.c b/arch/arm/cpu/mmu_64.c
index 6e617a15a6d7..9f709fc2d865 100644
--- a/arch/arm/cpu/mmu_64.c
+++ b/arch/arm/cpu/mmu_64.c
@@ -24,6 +24,39 @@
 
 #include "mmu_64.h"
 
+static size_t granule_size(int level)
+{
+       /*
+        *  With 4k page granule, a virtual address is split into 4 lookup parts
+        *  spanning 9 bits each:
+        *
+        *    _______________________________________________
+        *   |       |       |       |       |       |       |
+        *   |   0   |  Lv0  |  Lv1  |  Lv2  |  Lv3  |  off  |
+        *   |_______|_______|_______|_______|_______|_______|
+        *     63-48   47-39   38-30   29-21   20-12   11-00
+        *
+        *             mask        page size
+        *
+        *    Lv0: FF8000000000       --
+        *    Lv1:   7FC0000000       1G
+        *    Lv2:     3FE00000       2M
+        *    Lv3:       1FF000       4K
+        *    off:          FFF
+        */
+       switch (level) {
+       default:
+       case 0:
+               return L0_XLAT_SIZE;
+       case 1:
+               return L1_XLAT_SIZE;
+       case 2:
+               return L2_XLAT_SIZE;
+       case 3:
+               return L3_XLAT_SIZE;
+       }
+}
+
 static uint64_t *get_ttb(void)
 {
        return (uint64_t *)get_ttbr(current_el());
@@ -210,39 +243,6 @@ static int __arch_remap_range(uint64_t virt, uint64_t 
phys, uint64_t size,
        return 0;
 }
 
-static size_t granule_size(int level)
-{
-       /*
-        *  With 4k page granule, a virtual address is split into 4 lookup parts
-        *  spanning 9 bits each:
-        *
-        *    _______________________________________________
-        *   |       |       |       |       |       |       |
-        *   |   0   |  Lv0  |  Lv1  |  Lv2  |  Lv3  |  off  |
-        *   |_______|_______|_______|_______|_______|_______|
-        *     63-48   47-39   38-30   29-21   20-12   11-00
-        *
-        *             mask        page size
-        *
-        *    Lv0: FF8000000000       --
-        *    Lv1:   7FC0000000       1G
-        *    Lv2:     3FE00000       2M
-        *    Lv3:       1FF000       4K
-        *    off:          FFF
-        */
-       switch (level) {
-       default:
-       case 0:
-               return L0_XLAT_SIZE;
-       case 1:
-               return L1_XLAT_SIZE;
-       case 2:
-               return L2_XLAT_SIZE;
-       case 3:
-               return L3_XLAT_SIZE;
-       }
-}
-
 static bool pte_is_cacheable(uint64_t pte)
 {
        return (pte & PTE_ATTRINDX_MASK) == PTE_ATTRINDX(MT_NORMAL);
-- 
2.39.5


Reply via email to