diff options
author | Christophe Leroy <christophe.leroy@csgroup.eu> | 2021-05-20 13:50:40 +0000 |
---|---|---|
committer | Michael Ellerman <mpe@ellerman.id.au> | 2021-06-16 23:35:30 +1000 |
commit | 042e0860e1c1d60a0ab1ff3f16b7f420573133e0 (patch) | |
tree | 7ea6a3877e2ced03e51d2d7c8974b31037b59ec0 | |
parent | 9134806e149ebb214f122f0f84254096d3768bb2 (diff) | |
download | linux-stable-042e0860e1c1d60a0ab1ff3f16b7f420573133e0.tar.gz linux-stable-042e0860e1c1d60a0ab1ff3f16b7f420573133e0.tar.bz2 linux-stable-042e0860e1c1d60a0ab1ff3f16b7f420573133e0.zip |
powerpc/inst: Improve readability of get_user_instr() and friends
Remove unneeded line splits.
And remove unneeded local variable initialisation.
Signed-off-by: Christophe Leroy <christophe.leroy@csgroup.eu>
Signed-off-by: Michael Ellerman <mpe@ellerman.id.au>
Link: https://lore.kernel.org/r/fb097fda78cc6852905ef00f8f7bf371b6cc66f7.1621516826.git.christophe.leroy@csgroup.eu
-rw-r--r-- | arch/powerpc/include/asm/inst.h | 16 |
1 files changed, 6 insertions, 10 deletions
diff --git a/arch/powerpc/include/asm/inst.h b/arch/powerpc/include/asm/inst.h index 530583afa946..dab26b0493d5 100644 --- a/arch/powerpc/include/asm/inst.h +++ b/arch/powerpc/include/asm/inst.h @@ -8,7 +8,7 @@ #define ___get_user_instr(gu_op, dest, ptr) \ ({ \ - long __gui_ret = 0; \ + long __gui_ret; \ u32 __user *__gui_ptr = (u32 __user *)ptr; \ struct ppc_inst __gui_inst; \ unsigned int __prefix, __suffix; \ @@ -18,8 +18,7 @@ if (__gui_ret == 0) { \ if ((__prefix >> 26) == OP_PREFIX) { \ __gui_ret = gu_op(__suffix, __gui_ptr + 1); \ - __gui_inst = ppc_inst_prefix(__prefix, \ - __suffix); \ + __gui_inst = ppc_inst_prefix(__prefix, __suffix); \ } else { \ __gui_inst = ppc_inst(__prefix); \ } \ @@ -36,11 +35,9 @@ }) #endif /* CONFIG_PPC64 */ -#define get_user_instr(x, ptr) \ - ___get_user_instr(get_user, x, ptr) +#define get_user_instr(x, ptr) ___get_user_instr(get_user, x, ptr) -#define __get_user_instr(x, ptr) \ - ___get_user_instr(__get_user, x, ptr) +#define __get_user_instr(x, ptr) ___get_user_instr(__get_user, x, ptr) /* * Instruction data type for POWER @@ -75,13 +72,12 @@ static inline u32 ppc_inst_suffix(struct ppc_inst x) static inline bool ppc_inst_prefixed(struct ppc_inst x) { - return (ppc_inst_primary_opcode(x) == 1) && ppc_inst_suffix(x) != 0xff; + return ppc_inst_primary_opcode(x) == OP_PREFIX && ppc_inst_suffix(x) != 0xff; } static inline struct ppc_inst ppc_inst_swab(struct ppc_inst x) { - return ppc_inst_prefix(swab32(ppc_inst_val(x)), - swab32(ppc_inst_suffix(x))); + return ppc_inst_prefix(swab32(ppc_inst_val(x)), swab32(ppc_inst_suffix(x))); } static inline struct ppc_inst ppc_inst_read(const struct ppc_inst *ptr) |