*/
 }
 
-static inline unsigned long kuap_get_and_check_amr(void)
+static inline unsigned long kuap_get_and_assert_locked(void)
 {
        if (mmu_has_feature(MMU_FTR_BOOK3S_KUAP)) {
                unsigned long amr = mfspr(SPRN_AMR);
        return 0;
 }
 
-#else /* CONFIG_PPC_PKEY */
-
-static inline void kuap_user_restore(struct pt_regs *regs)
-{
-}
-
-static inline void kuap_kernel_restore(struct pt_regs *regs, unsigned long amr)
-{
-}
-
-static inline unsigned long kuap_get_and_check_amr(void)
-{
-       return 0;
-}
-
-#endif /* CONFIG_PPC_PKEY */
-
-
-#ifdef CONFIG_PPC_KUAP
-
-static inline void kuap_check_amr(void)
+static inline void kuap_assert_locked(void)
 {
        if (IS_ENABLED(CONFIG_PPC_KUAP_DEBUG) && mmu_has_feature(MMU_FTR_BOOK3S_KUAP))
                WARN_ON_ONCE(mfspr(SPRN_AMR) != AMR_KUAP_BLOCKED);
 
        return false;
 }
 
-static inline void kuap_check_amr(void) { }
+static inline void kuap_assert_locked(void) { }
+static inline void kuap_save_and_lock(struct pt_regs *regs) { }
+static inline void kuap_user_restore(struct pt_regs *regs) { }
+static inline void kuap_kernel_restore(struct pt_regs *regs, unsigned long amr) { }
+
+static inline unsigned long kuap_get_and_assert_locked(void)
+{
+       return 0;
+}
 
 /*
  * book3s/64/kup-radix.h defines these functions for the !KUAP case to flush
 
        } else
 #endif
 #ifdef CONFIG_PPC64
-               kuap_check_amr();
+               kuap_assert_locked();
 #endif
 
        booke_restore_dbcr0();
        CT_WARN_ON(ct_state() == CONTEXT_USER);
 
 #ifdef CONFIG_PPC64
-       kuap_check_amr();
+       kuap_assert_locked();
 #endif
 
        regs->result = r3;
         * AMR can only have been unlocked if we interrupted the kernel.
         */
 #ifdef CONFIG_PPC64
-       kuap_check_amr();
+       kuap_assert_locked();
 #endif
 
        local_irq_save(flags);
        unsigned long flags;
        unsigned long ret = 0;
 #ifdef CONFIG_PPC64
-       unsigned long amr;
+       unsigned long kuap;
 #endif
 
        if (!IS_ENABLED(CONFIG_BOOKE) && !IS_ENABLED(CONFIG_40x) &&
                CT_WARN_ON(ct_state() == CONTEXT_USER);
 
 #ifdef CONFIG_PPC64
-       amr = kuap_get_and_check_amr();
+       kuap = kuap_get_and_assert_locked();
 #endif
 
        if (unlikely(current_thread_info()->flags & _TIF_EMULATE_STACK_STORE)) {
         * value from the check above.
         */
 #ifdef CONFIG_PPC64
-       kuap_kernel_restore(regs, amr);
+       kuap_kernel_restore(regs, kuap);
 #endif
 
        return ret;
 
         * and re-locking AMR but we shouldn't get here in the first place,
         * hence the warning.
         */
-       kuap_check_amr();
+       kuap_assert_locked();
 
        if (kuap_state != AMR_KUAP_BLOCKED)
                set_kuap(AMR_KUAP_BLOCKED);