return location + ppc_inst_len(tmp);
 }
 
-static inline u64 ppc_inst_as_u64(struct ppc_inst x)
+static inline unsigned long ppc_inst_as_ulong(struct ppc_inst x)
 {
-#ifdef CONFIG_CPU_LITTLE_ENDIAN
-       return (u64)ppc_inst_suffix(x) << 32 | ppc_inst_val(x);
-#else
-       return (u64)ppc_inst_val(x) << 32 | ppc_inst_suffix(x);
-#endif
+       if (IS_ENABLED(CONFIG_PPC32))
+               return ppc_inst_val(x);
+       else if (IS_ENABLED(CONFIG_CPU_LITTLE_ENDIAN))
+               return (u64)ppc_inst_suffix(x) << 32 | ppc_inst_val(x);
+       else
+               return (u64)ppc_inst_val(x) << 32 | ppc_inst_suffix(x);
 }
 
 #define PPC_INST_STR_LEN sizeof("00000000 00000000")
 
         * 3. load instruction to be emulated into relevant register, and
         */
        temp = ppc_inst_read((struct ppc_inst *)p->ainsn.insn);
-       patch_imm64_load_insns(ppc_inst_as_u64(temp), 4, buff + TMPL_INSN_IDX);
+       patch_imm64_load_insns(ppc_inst_as_ulong(temp), 4, buff + TMPL_INSN_IDX);
 
        /*
         * 4. branch back from trampoline
 
 
                __put_kernel_nofault(patch_addr, &val, u32, failed);
        } else {
-               u64 val = ppc_inst_as_u64(instr);
+               u64 val = ppc_inst_as_ulong(instr);
 
                __put_kernel_nofault(patch_addr, &val, u64, failed);
        }
 
                if (!ppc_inst_prefixed(inst))
                        dump_func(ppc_inst_val(inst), adr);
                else
-                       dump_func(ppc_inst_as_u64(inst), adr);
+                       dump_func(ppc_inst_as_ulong(inst), adr);
                printf("\n");
        }
        return adr - first_adr;