riscv: Fixup compile error BUILD_BUG_ON failed
[linux-2.6-microblaze.git] / arch / riscv / kernel / patch.c
index 3fe7a52..0b55287 100644 (file)
@@ -20,7 +20,12 @@ struct patch_insn {
 };
 
 #ifdef CONFIG_MMU
-static void *patch_map(void *addr, int fixmap)
+/*
+ * The fix_to_virt(, idx) needs a const value (not a dynamic variable of
+ * reg-a0) or BUILD_BUG_ON failed with "idx >= __end_of_fixed_addresses".
+ * So use '__always_inline' and 'const unsigned int fixmap' here.
+ */
+static __always_inline void *patch_map(void *addr, const unsigned int fixmap)
 {
        uintptr_t uintaddr = (uintptr_t) addr;
        struct page *page;
@@ -37,7 +42,6 @@ static void *patch_map(void *addr, int fixmap)
        return (void *)set_fixmap_offset(fixmap, page_to_phys(page) +
                                         (uintaddr & ~PAGE_MASK));
 }
-NOKPROBE_SYMBOL(patch_map);
 
 static void patch_unmap(int fixmap)
 {