Commit 8804d5be authored by Christophe Leroy's avatar Christophe Leroy Committed by Michael Ellerman

powerpc/lib/code-patching: Use PPC_RAW_() macros

Instead of open coding with PPC_INST_ defines, use
PPC_RAW_() macros. It improves readability.
Signed-off-by: default avatarChristophe Leroy <christophe.leroy@csgroup.eu>
Signed-off-by: default avatarMichael Ellerman <mpe@ellerman.id.au>
Link: https://lore.kernel.org/r/8c92f1d9e825ee47c6f88fe43ad42d2a8cc2ab4a.1621506159.git.christophe.leroy@csgroup.eu
parent 07cd1832
...@@ -73,9 +73,9 @@ void __patch_exception(int exc, unsigned long addr); ...@@ -73,9 +73,9 @@ void __patch_exception(int exc, unsigned long addr);
#endif #endif
#define OP_RT_RA_MASK 0xffff0000UL #define OP_RT_RA_MASK 0xffff0000UL
#define LIS_R2 (PPC_INST_ADDIS | __PPC_RT(R2)) #define LIS_R2 (PPC_RAW_LIS(_R2, 0))
#define ADDIS_R2_R12 (PPC_INST_ADDIS | __PPC_RT(R2) | __PPC_RA(R12)) #define ADDIS_R2_R12 (PPC_RAW_ADDIS(_R2, _R12, 0))
#define ADDI_R2_R2 (PPC_INST_ADDI | __PPC_RT(R2) | __PPC_RA(R2)) #define ADDI_R2_R2 (PPC_RAW_ADDI(_R2, _R2, 0))
static inline unsigned long ppc_function_entry(void *func) static inline unsigned long ppc_function_entry(void *func)
...@@ -180,12 +180,10 @@ static inline unsigned long ppc_kallsyms_lookup_name(const char *name) ...@@ -180,12 +180,10 @@ static inline unsigned long ppc_kallsyms_lookup_name(const char *name)
#define R2_STACK_OFFSET 40 #define R2_STACK_OFFSET 40
#endif #endif
#define PPC_INST_LD_TOC (PPC_INST_LD | ___PPC_RT(__REG_R2) | \ #define PPC_INST_LD_TOC PPC_RAW_LD(_R2, _R1, R2_STACK_OFFSET)
___PPC_RA(__REG_R1) | R2_STACK_OFFSET)
/* usually preceded by a mflr r0 */ /* usually preceded by a mflr r0 */
#define PPC_INST_STD_LR (PPC_INST_STD | ___PPC_RS(__REG_R0) | \ #define PPC_INST_STD_LR PPC_RAW_STD(_R0, _R1, PPC_LR_STKOFF)
___PPC_RA(__REG_R1) | PPC_LR_STKOFF)
#endif /* CONFIG_PPC64 */ #endif /* CONFIG_PPC64 */
#endif /* _ASM_POWERPC_CODE_PATCHING_H */ #endif /* _ASM_POWERPC_CODE_PATCHING_H */
...@@ -203,7 +203,7 @@ __ftrace_make_nop(struct module *mod, ...@@ -203,7 +203,7 @@ __ftrace_make_nop(struct module *mod,
} }
if (!ppc_inst_equal(op, ppc_inst(PPC_INST_LD_TOC))) { if (!ppc_inst_equal(op, ppc_inst(PPC_INST_LD_TOC))) {
pr_err("Expected %08x found %s\n", PPC_INST_LD_TOC, ppc_inst_as_str(op)); pr_err("Expected %08lx found %s\n", PPC_INST_LD_TOC, ppc_inst_as_str(op));
return -EINVAL; return -EINVAL;
} }
#endif /* CONFIG_MPROFILE_KERNEL */ #endif /* CONFIG_MPROFILE_KERNEL */
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment